Skip Menu |

This queue is for tickets about the Tickit-Widget-Tabbed CPAN distribution.

Report information
The Basics
Id: 90082
Status: resolved
Priority: 0/
Queue: Tickit-Widget-Tabbed

People
Owner: Nobody in particular
Requestors: sharyanto [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 0.011



Subject: All examples in examples/ currently do not work
Can't locate object method "pen_active" via package "Tickit::Widget::Tabbed" at demo-tabs.pl line 17. Constructing a legacy ->render CustomRibbon::horizontal at /home/s1/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Tickit/Widget/Tabbed.pm line 251. Can't locate object method "pen_active" via package "Tickit::Widget::Tabbed" at demo-custom-ribbon.pl line 15. and "demo-logtail.pl somefile" aborts a couple of seconds later with: Can't call method "dev" on an undefined value at /home/s1/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/IO/Async/File.pm line 172.
Oops. The trouble of shipping examples tends to be that they don't have unit tests themselves... On Wed Nov 06 05:06:13 2013, SHARYANTO wrote: Show quoted text
> Can't locate object method "pen_active" via package > "Tickit::Widget::Tabbed" at demo-tabs.pl line 17. > > Constructing a legacy ->render CustomRibbon::horizontal at > /home/s1/perl5/perlbrew/perls/perl- > 5.10.1/lib/site_perl/5.10.1/Tickit/Widget/Tabbed.pm line 251. > Can't locate object method "pen_active" via package > "Tickit::Widget::Tabbed" at demo-custom-ribbon.pl line 15.
Fixed - having changed the styling API from custom methods into using the standard Tickit::Style system, I forgot to update the examples. Show quoted text
> and "demo-logtail.pl somefile" aborts a couple of seconds later with: > Can't call method "dev" on an undefined value at > /home/s1/perl5/perlbrew/perls/perl- > 5.10.1/lib/site_perl/5.10.1/IO/Async/File.pm line 172.
Hmmm... a more interesting one. -- Paul Evans
On Wed Nov 06 05:06:13 2013, SHARYANTO wrote: Show quoted text
> and "demo-logtail.pl somefile" aborts a couple of seconds later with: > Can't call method "dev" on an undefined value at > /home/s1/perl5/perlbrew/perls/perl- > 5.10.1/lib/site_perl/5.10.1/IO/Async/File.pm line 172.
Turns out to have been an IO::Async bug - IaFileStream no longer pays attention to 'handle', only 'read_handle'. That's now fixed upstream, and also I'll change the demo to pass 'read_handle' anyway. Will be in next release. -- Paul Evans
Subject: rt90082.patch
=== modified file 'examples/demo-custom-ribbon.pl' --- examples/demo-custom-ribbon.pl 2012-08-31 18:31:16 +0000 +++ examples/demo-custom-ribbon.pl 2013-11-06 14:00:53 +0000 @@ -11,8 +11,11 @@ my $tabbed = Tickit::Widget::Tabbed->new( tab_position => "bottom", ribbon_class => "CustomRibbon", + style => { + active_b => 1, + active_u => 1, + }, ); -$tabbed->pen_active->chattrs( { b => 1, u => 1 } ); my $counter = 1; sub add_tab @@ -44,6 +47,13 @@ package CustomRibbon; use base qw( Tickit::Widget::Tabbed::Ribbon ); +use Tickit::Style -copy; + +BEGIN { + style_definition base => + current_fg => 8; +} + package CustomRibbon::horizontal; use base qw( CustomRibbon ); @@ -52,48 +62,34 @@ sub lines { 1 } sub cols { 1 } -sub render +sub render_to_rb { my $self = shift; - my %args = @_; - - my $win = $self->window or return; + my ( $rb, $rect ) = @_; my @tabs = $self->tabs; - my $col = 0; - my $printed; - - # TODO: consider whether $win->print should return width? - - $win->goto( 0, $col ); - $win->print( $printed = sprintf "[%d tabs]: ", scalar @tabs ); - $col += textwidth $printed; + $rb->goto( 0, 0 ); + $rb->text( sprintf "[%d tabs]: ", scalar @tabs ); my $active = $self->active_tab; - $win->print( $printed = $active->label, $self->active_pen ); - $col += textwidth $printed; + $rb->text( $active->label, $self->active_pen ); - $win->print( $printed = " [also:" ); - $col += textwidth $printed; + $rb->text( " [also:" ); foreach my $tab ( @tabs ) { - $win->erasech( 1, 1 ); $col += 1; + $rb->erase( 1 ); if( $tab == $active ) { - $win->print( $printed = "x" x textwidth( $tab->label ), fg => 8 ); + $rb->text( "x" x textwidth( $tab->label ), $self->get_style_pen( "current" ) ); } else { - $win->print( $printed = $tab->label ); + $rb->text( $tab->label ); } - $col += textwidth $printed; - } - - $win->print( "]" ); - $col += 1; - - if( ( my $spare = $win->cols - $col ) > 0 ) { - $win->erasech( $spare ); - } + } + + $rb->text( "]" ); + + $rb->erase_to( $self->window->cols ); } sub scroll_to_visible { } === modified file 'examples/demo-logtail.pl' --- examples/demo-logtail.pl 2011-11-10 23:03:02 +0000 +++ examples/demo-logtail.pl 2013-11-06 16:55:55 +0000 @@ -27,7 +27,7 @@ my $stream = IO::Async::Protocol::LineStream->new( transport => IO::Async::FileStream->new( - handle => $fh, + read_handle => $fh, on_initial => sub { my ( $self ) = @_; $self->seek_to_last( "\n" ); === modified file 'examples/demo-tabs.pl' --- examples/demo-tabs.pl 2012-08-13 22:52:35 +0000 +++ examples/demo-tabs.pl 2013-11-06 13:46:56 +0000 @@ -13,8 +13,13 @@ 'position|p=s' => \(my $position = "bottom"), ) or exit(1); -my $tabbed = Tickit::Widget::Tabbed->new( tab_position => $position ); -$tabbed->pen_active->chattrs( { b => 1, u => 1 } ); +my $tabbed = Tickit::Widget::Tabbed->new( + tab_position => $position, + style => { + active_b => 1, + active_u => 1, + }, +); my $counter = 1; sub add_tab
Fixed in 0.011 -- Paul Evans