@@ -678,8 +678,6 @@ def _icon(self, name, color=None):
678
678
679
679
def _init_toolbar (self ):
680
680
self .basedir = str (cbook ._get_data_path ('images' ))
681
- # Ensure that zoom and pan are mutually exclusive.
682
- self ._button_group = QtWidgets .QButtonGroup ()
683
681
684
682
background_color = self .palette ().color (self .backgroundRole ())
685
683
foreground_color = self .palette ().color (self .foregroundRole ())
@@ -695,7 +693,6 @@ def _init_toolbar(self):
695
693
self ._actions [callback ] = a
696
694
if callback in ['zoom' , 'pan' ]:
697
695
a .setCheckable (True )
698
- self ._button_group .addButton (self .widgetForAction (a ))
699
696
if tooltip_text is not None :
700
697
a .setToolTip (tooltip_text )
701
698
if text == 'Subplots' :
@@ -754,13 +751,18 @@ def edit_parameters(self):
754
751
ax = axes [titles .index (item )]
755
752
figureoptions .figure_edit (ax , self )
756
753
754
+ def _update_buttons_checked (self ):
755
+ # sync button checkstates to match active mode
756
+ self ._actions ['pan' ].setChecked (self ._active == 'PAN' )
757
+ self ._actions ['zoom' ].setChecked (self ._active == 'ZOOM' )
758
+
757
759
def pan (self , * args ):
758
760
super ().pan (* args )
759
- self ._actions [ 'pan' ]. setChecked ( self . _active == 'PAN' )
761
+ self ._update_buttons_checked ( )
760
762
761
763
def zoom (self , * args ):
762
764
super ().zoom (* args )
763
- self ._actions [ 'zoom' ]. setChecked ( self . _active == 'ZOOM' )
765
+ self ._update_buttons_checked ( )
764
766
765
767
def set_message (self , s ):
766
768
self .message .emit (s )
0 commit comments