8000 More deduplication of backend_tools. by anntzer · Pull Request #14569 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

More deduplication of backend_tools. #14569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def on_notify_filter(*args):

def configure_subplots(self, button):
toolfig = Figure(figsize=(6, 3))
canvas = self._get_canvas(toolfig)
canvas = type(self.canvas)(toolfig)
toolfig.subplots_adjust(top=0.9)
# Need to keep a reference to the tool.
_tool = SubplotTool(self.canvas.figure, toolfig)
Expand All @@ -601,9 +601,6 @@ def configure_subplots(self, button):
vbox.pack_start(canvas, True, True, 0)
window.show()

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

def set_history_buttons(self):
can_backward = self._nav_stack._pos > 0
can_forward = self._nav_stack._pos < len(self._nav_stack._elements) - 1
Expand Down Expand Up @@ -809,10 +806,19 @@ def set_cursor(self, cursor):


class ConfigureSubplotsGTK3(backend_tools.ConfigureSubplotsBase, Gtk.Window):
def __init__(self, *args, **kwargs):
backend_tools.ConfigureSubplotsBase.__init__(self, *args, **kwargs)
self.window = None

@cbook.deprecated("3.2")
@property
def window(self):
if not hasattr(self, "_window"):
self._window = None
return self._window

@window.setter
@cbook.deprecated("3.2")
def window(self, window):
self._window = window

@cbook.deprecated("3.2")
def init_window(self):
if self.window:
return
Expand Down Expand Up @@ -846,16 +852,17 @@ def init_window(self):
self.vbox.pack_start(canvas, True, True, 0)
self.window.show()

@cbook.deprecated("3.2")
def destroy(self, *args):
self.window.destroy()
self.window = None

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

def trigger(self, sender, event, data=None):
self.init_window()
self.window.present()
def trigger(self, *args):
NavigationToolbar2GTK3.configure_subplots(
self._make_classic_style_pseudo_toolbar(), None)


class HelpGTK3(backend_tools.ToolHelpBase):
Expand Down
0