Skip to content

Commit 67a414f

Browse files
committed
cleaning navigation and toolbar dependencies
1 parent dd66b57 commit 67a414f

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3263,9 +3263,8 @@ class NavigationBase(object):
32633263
messagelock: `LockDraw` to know if the message is available to write
32643264
"""
32653265

3266-
def __init__(self, manager):
3267-
self.manager = manager
3268-
self.canvas = manager.canvas
3266+
def __init__(self, canvas):
3267+
self.canvas = canvas
32693268

32703269
self._key_press_handler_id = self.canvas.mpl_connect(
32713270
'key_press_event', self._key_press)
@@ -3599,9 +3598,8 @@ class ToolbarBase(object):
35993598
this `Toolbar` wants to communicate with
36003599
"""
36013600

3602-
def __init__(self, manager):
3603-
self.manager = manager
3604-
self.navigation = manager.navigation
3601+
def __init__(self, navigation):
3602+
self.navigation = navigation
36053603

36063604
self.navigation.nav_connect('tool_message_event', self._message_cbk)
36073605
self.navigation.nav_connect('tool_added_event', self._add_tool_cbk)

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,15 +483,15 @@ def _get_toolbar(self):
483483
if rcParams['toolbar'] == 'toolbar2':
484484
toolbar = NavigationToolbar2GTK3 (self.canvas, self.window)
485485
elif rcParams['toolbar'] == 'navigation':
486-
toolbar = ToolbarGTK3(self)
486+
toolbar = ToolbarGTK3(self.navigation)
487487
else:
488488
toolbar = None
489489
return toolbar
490490

491491
def _get_navigation(self):
492492
# must be initialised after toolbar has been setted
493493
if rcParams['toolbar'] != 'toolbar2':
494-
navigation = NavigationGTK3(self)
494+
navigation = NavigationGTK3(self.canvas)
495495
else:
496496
navigation = None
497497
return navigation
@@ -756,8 +756,8 @@ def draw_rubberband(self, x0, y0, x1, y1):
756756

757757

758758
class ToolbarGTK3(ToolbarBase, Gtk.Box):
759-
def __init__(self, manager):
760-
ToolbarBase.__init__(self, manager)
759+
def __init__(self, navigation):
760+
ToolbarBase.__init__(self, navigation)
761761
Gtk.Box.__init__(self)
762762
self.set_property("orientation", Gtk.Orientation.VERTICAL)
763763

0 commit comments

Comments
 (0)