From 07ee868777ce74809ff7359913ae5eeb39a10980 Mon Sep 17 00:00:00 2001 From: etienne Date: Thu, 27 Dec 2007 14:02:33 +0000 Subject: Fix : quand on tuait un agent dont le voyant \ufffdtait rouge, celui restait rouge au lieu de passer noir. --- src/Agent.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Agent.pm b/src/Agent.pm index 9e2e6c8..44c72ff 100644 --- a/src/Agent.pm +++ b/src/Agent.pm @@ -190,21 +190,33 @@ sub on { sub off { my $self = shift; $self->{status} = 0; + $self->stopPbAnim; $self->{led}->configure(-image => $off_img); } # end off # graphical effect when a know agent has a ping problem (latency) + +sub stopPbAnim { + + my $self = shift; + if ($self->{afterid}) { + $mw->afterCancel($self->{afterid}); + undef $self->{afterid}; + } + +} + sub pb { my $self = shift; $self->{status} = 2; $self->{led}->configure(-image => $pb_img); my $i = 0; my $id; - $id = $mw->repeat(100, sub { + $self->{afterid} = $mw->repeat(100, sub { if ($i == 4) { - $mw->afterCancel($id); + $self->stopPbAnim; } elsif ($i % 2 == 0) { $self->{led}->configure(-image => $on_img); } else { @@ -364,6 +376,7 @@ sub _cbOnPress { $self->{label}->configure(-foreground => $hlbg); if ($self->{status} > 0) { IvyIO::kill($self->{appname}); + $self->StopPbAnim; $mw->after(400, sub {$self->{label}->configure(-foreground => $fg);}); } elsif ($self->{command}) { my ($x, $y) = ($self->{label}->rootx, $self->{label}->rooty); -- cgit v1.1