Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a3da152

Browse filesBrowse files
timhoffmMeeseeksDev[bot]
authored andcommitted
Backport PR #14319: Don't set missing history buttons.
1 parent 7cf6bf0 commit a3da152
Copy full SHA for a3da152

File tree

Expand file treeCollapse file tree

3 files changed

+12
-6
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+12
-6
lines changed

‎lib/matplotlib/backends/backend_gtk3.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,10 @@ def _get_canvas(self, fig):
611611
def set_history_buttons(self):
612612
can_backward = self._nav_stack._pos > 0
613613
can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
614-
self._gtk_ids['Back'].set_sensitive(can_backward)
615-
self._gtk_ids['Forward'].set_sensitive(can_forward)
614+
if 'Back' in self._gtk_ids:
615+
self._gtk_ids['Back'].set_sensitive(can_backward)
616+
if 'Forward' in self._gtk_ids:
617+
self._gtk_ids['Forward'].set_sensitive(can_forward)
616618

617619

618620
@cbook.deprecated("3.1")

‎lib/matplotlib/backends/backend_qt5.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_qt5.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,10 @@ def save_figure(self, *args):
851851
def set_history_buttons(self):
852852
can_backward = self._nav_stack._pos > 0
853853
can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
854-
self._actions['back'].setEnabled(can_backward)
855-
self._actions['forward'].setEnabled(can_forward)
854+
if 'back' in self._actions:
855+
self._actions['back'].setEnabled(can_backward)
856+
if 'forward' in self._actions:
857+
self._actions['forward'].setEnabled(can_forward)
856858

857859

858860
class SubplotToolQt(UiSubplotTool):

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,8 +1567,10 @@ def set_message(self, s):
15671567
def set_history_buttons(self):
15681568
can_backward = self._nav_stack._pos > 0
15691569
can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
1570-
self.EnableTool(self.wx_ids['Back'], can_backward)
1571-
self.EnableTool(self.wx_ids['Forward'], can_forward)
1570+
if 'Back' in self.wx_ids:
1571+
self.EnableTool(self.wx_ids['Back'], can_backward)
1572+
if 'Forward' in self.wx_ids:
1573+
self.EnableTool(self.wx_ids['Forward'], can_forward)
15721574

15731575

15741576
class StatusBarWx(wx.StatusBar):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.