8000 Revert "Make Qt navtoolbar more robust against removal of either pan … · matplotlib/matplotlib@085504f · GitHub
[go: up one dir, main page]

Skip to content

Commit 085504f

Browse files
committed
Revert "Make Qt navtoolbar more robust against removal of either pan or zoom."
This reverts commit 3edda06.
1 parent 430723d commit 085504f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,6 @@ def _icon(self, name, color=None):
678678

679679
def _init_toolbar(self):
680680
self.basedir = str(cbook._get_data_path('images'))
681-
# Ensure that zoom and pan are mutually exclusive.
682-
self._button_group = QtWidgets.QButtonGroup()
683681

684682
background_color = self.palette().color(self.backgroundRole())
685683
foreground_color = self.palette().color(self.foregroundRole())
@@ -695,7 +693,6 @@ def _init_toolbar(self):
695693
self._actions[callback] = a
696694
if callback in ['zoom', 'pan']:
697695
a.setCheckable(True)
698-
self._button_group.addButton(self.widgetForAction(a))
699696
if tooltip_text is not None:
700697
a.setToolTip(tooltip_text)
701698
if text == 'Subplots':
@@ -754,13 +751,18 @@ def edit_parameters(self):
754751
ax = axes[titles.index(item)]
755752
figureoptions.figure_edit(ax, self)
756753

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+
757759
def pan(self, *args):
758760
super().pan(*args)
759-
self._actions['pan'].setChecked(self._active == 'PAN')
761+
self._update_buttons_checked()
760762

761763
def zoom(self, *args):
762764
super().zoom(*args)
763-
self._actions['zoom'].setChecked(self._active == 'ZOOM')
765+
self._update_buttons_checked()
764766

765767
def set_message(self, s):
766768
self.message.emit(s)

0 commit comments

Comments
 (0)
0