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 a3825f4

Browse filesBrowse files
authored
Merge pull request #14569 from anntzer/gtkconfig
More deduplication of backend_tools.
2 parents ace52ff + 211bb48 commit a3825f4
Copy full SHA for a3825f4

File tree

Expand file treeCollapse file tree

1 file changed

+18
-11
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-11
lines changed

‎lib/matplotlib/backends/backend_gtk3.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3.py
+18-11Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def on_notify_filter(*args):
575575

576576
def configure_subplots(self, button):
577577
toolfig = Figure(figsize=(6, 3))
578-
canvas = self._get_canvas(toolfig)
578+
canvas = type(self.canvas)(toolfig)
579579
toolfig.subplots_adjust(top=0.9)
580580
# Need to keep a reference to the tool.
581581
_tool = SubplotTool(self.canvas.figure, toolfig)
@@ -601,9 +601,6 @@ def configure_subplots(self, button):
601601
vbox.pack_start(canvas, True, True, 0)
602602
window.show()
603603

604-
def _get_canvas(self, fig):
605-
return self.canvas.__class__(fig)
606-
607604
def set_history_buttons(self):
608605
can_backward = self._nav_stack._pos > 0
609606
can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
@@ -809,10 +806,19 @@ def set_cursor(self, cursor):
809806

810807

811808
class ConfigureSubplotsGTK3(backend_tools.ConfigureSubplotsBase, Gtk.Window):
812-
def __init__(self, *args, **kwargs):
813-
backend_tools.ConfigureSubplotsBase.__init__(self, *args, **kwargs)
814-
self.window = None
815-
809+
@cbook.deprecated("3.2")
810+
@property
811+
def window(self):
812+
if not hasattr(self, "_window"):
813+
self._window = None
814+
return self._window
815+
816+
@window.setter
817+
@cbook.deprecated("3.2")
818+
def window(self, window):
819+
self._window = window
820+
821+
@cbook.deprecated("3.2")
816822
def init_window(self):
817823
if self.window:
818824
return
@@ -846,16 +852,17 @@ def init_window(self):
846852
self.vbox.pack_start(canvas, True, True, 0)
847853
self.window.show()
848854

855+
@cbook.deprecated("3.2")
849856
def destroy(self, *args):
850857
self.window.destroy()
851858
self.window = None
852859

853860
def _get_canvas(self, fig):
854861
return self.canvas.__class__(fig)
855862

856-
def trigger(self, sender, event, data=None):
857-
self.init_window()
858-
self.window.present()
863+
def trigger(self, *args):
864+
NavigationToolbar2GTK3.configure_subplots(
865+
self._make_classic_style_pseudo_toolbar(), None)
859866

860867

861868
class HelpGTK3(backend_tools.ToolHelpBase):

0 commit comments

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