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 585644b

Browse filesBrowse files
QuLogictimhoffm
authored andcommitted
Properly enable forward/backward buttons on GTK3. (#12888)
1 parent f093129 commit 585644b
Copy full SHA for 585644b

File tree

Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed

‎lib/matplotlib/backends/backend_gtk3.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3.py
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,14 +492,15 @@ def _init_toolbar(self):
492492
self.set_style(Gtk.ToolbarStyle.ICONS)
493493
basedir = os.path.join(rcParams['datapath'], 'images')
494494

495+
self._gtk_ids = {}
495496
for text, tooltip_text, image_file, callback in self.toolitems:
496497
if text is None:
497498
self.insert(Gtk.SeparatorToolItem(), -1)
498499
continue
499500
fname = os.path.join(basedir, image_file + '.png')
500501
image = Gtk.Image()
501502
image.set_from_file(fname)
502-
tbutton = Gtk.ToolButton()
503+
self._gtk_ids[text] = tbutton = Gtk.ToolButton()
503504
tbutton.set_label(text)
504505
tbutton.set_icon_widget(image)
505506
self.insert(tbutton, -1)
@@ -572,6 +573,12 @@ def configure_subplots(self, button):
572573
def _get_canvas(self, fig):
573574
return self.canvas.__class__(fig)
574575

576+
def set_history_buttons(self):
577+
can_backward = self._nav_stack._pos > 0
578+
can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
579+
self._gtk_ids['Back'].set_sensitive(can_backward)
580+
self._gtk_ids['Forward'].set_sensitive(can_forward)
581+
575582

576583
class FileChooserDialog(Gtk.FileChooserDialog):
577584
"""GTK+ file selector which remembers the last file/directory

0 commit comments

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