diff options
author | caramel | 2007-09-14 13:59:23 +0000 |
---|---|---|
committer | caramel | 2007-09-14 13:59:23 +0000 |
commit | a7bd2b66c38b625a50ab8bf85e8d8ea0be78ac8f (patch) | |
tree | aeb31b885aafb9b377e4b183e4c81cb809f45b0d /src/MTools/Widget/MToggleBouton.pm | |
parent | 6f366f03ad459a1823bc951cf7f2fc4709bc3361 (diff) | |
download | mtc-a7bd2b66c38b625a50ab8bf85e8d8ea0be78ac8f.zip mtc-a7bd2b66c38b625a50ab8bf85e8d8ea0be78ac8f.tar.gz mtc-a7bd2b66c38b625a50ab8bf85e8d8ea0be78ac8f.tar.bz2 mtc-a7bd2b66c38b625a50ab8bf85e8d8ea0be78ac8f.tar.xz |
Modifications sur le MToggleBouton (methode changeCurrentState) + MRadioButton (bugs dus au svg occasionnant des boucles infinies
Diffstat (limited to 'src/MTools/Widget/MToggleBouton.pm')
-rw-r--r-- | src/MTools/Widget/MToggleBouton.pm | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/MTools/Widget/MToggleBouton.pm b/src/MTools/Widget/MToggleBouton.pm index ca5415a..cc014f5 100644 --- a/src/MTools/Widget/MToggleBouton.pm +++ b/src/MTools/Widget/MToggleBouton.pm @@ -98,7 +98,7 @@ sub new { my @gon2_tmp = @gon2; push (@gon2_tmp, $timer); - my $sw = new MTools::MSwitch ( + my $sw = $self->{switch} = new MTools::MSwitch ( $self, 'idle1' => \@gon1, 'idle1_tmp' => \@gon1_tmp, @@ -110,9 +110,6 @@ sub new { 'pressed2' => \@goff2, ); - $self -> recordEvent ( 'GOTO_STATE_1' ); - $self -> recordEvent ( 'GOTO_STATE_2' ); - my $st = $self->{states} = new MTools::MState ( current_state => 'idle1', events => { @@ -121,8 +118,6 @@ sub new { enter => [$self, '<Enter>'], leave => [$self, '<Leave>'], timeout => [$timer, 'TIME_OUT'], - to1 => [$self, 'GOTO_STATE_1'], - to2 => [$self, 'GOTO_STATE_2'], }, transitions => { 'idle1' => { @@ -133,9 +128,6 @@ sub new { to => 'pressed1', notify => $event1On, }, - 'to2' => { - to => 'idle2', - } }, 'idle1_tmp' => { 'press' => { @@ -153,7 +145,7 @@ sub new { }, 'leave' => { to => 'idle1_tmp', - } + }, }, 'pressed1' => { 'release' => { @@ -162,7 +154,7 @@ sub new { }, 'leave' => { to => 'idle1', - } + }, }, 'idle2' => { 'enter' => { @@ -172,9 +164,6 @@ sub new { to => 'pressed2', notify => $event2On, }, - 'to1' => { - to => 'idle1', - } }, 'idle2_tmp' => { 'press' => { @@ -244,11 +233,13 @@ sub new { sub changeCurrentState { my ($self) = @_; - my $currentState = $self->{states}->mget('state'); - if ($currentState eq 'idle1') { - $self->notify('GOTO_STATE_2'); - } elsif ($currentState eq 'idle2') { - $self->notify('GOTO_STATE_1'); + my $currentState = $self->{switch}->mget('state'); + if ($currentState =~ /(.*)1(.*)/ ) { + $self->{states}->mconfigure('state' => 'idle2'); + $self->{switch}->mconfigure('state' => 'idle2'); + } elsif ($currentState =~ /(.*)2(.*)/ ) { + $self->{states}->mconfigure('state' => 'idle1'); + $self->{switch}->mconfigure('state' => 'idle1'); } } |