8000 Temporary fix to backends · matplotlib/matplotlib@ffa65d6 · GitHub
[go: up one dir, main page]

Skip to content

Commit ffa65d6

Browse files
OceanWolffariza
authored andcommitted
Temporary fix to backends
1 parent 67257e7 commit ffa65d6

File tree

3 files changed

+9
-13
lines changed
    < 10000 li class="PRIVATE_TreeView-item prc-TreeView-TreeViewItem-ShJr0" tabindex="0" id="lib/matplotlib" role="treeitem" aria-labelledby=":Rtddab:" aria-describedby=":RtddabH1:" aria-level="1" aria-expanded="true" aria-selected="false">
    lib/matplotlib

3 files changed

+9
-13
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,11 +2595,6 @@ def __init__(self, canvas, num):
25952595
25962596
"""
25972597

2598-
self.toolbar = self._get_toolbar()
2599-
self.navigation = self._get_navigation()
2600-
if rcParams['toolbar'] == 'navigation':
2601-
self.navigation.add_tools(tools.tools)
2602-
26032598
def show(self):
26042599
"""
26052600
For GUI backends, show the figure window and redraw.
@@ -2647,11 +2642,6 @@ def set_window_title(self, title):
26472642
"""
26482643
pass
26492644

2650-
def _get_toolbar(self):
2651-
return None
2652-
2653-
def _get_navigation(self):
2654-
return None
26552645

26562646
cursors = tools.cursors
26572647

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def fn_name(): return sys._getframe(1).f_code.co_name
3131
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
3232
FigureManagerBase, FigureCanvasBase, NavigationToolbar2, cursors, TimerBase
3333
from matplotlib.backend_bases import ShowBase, ToolbarBase, NavigationBase
34-
from matplotlib.backend_tools import SaveFigureBase, ConfigureSubplotsBase
34+
from matplotlib.backend_tools import SaveFigureBase, ConfigureSubplotsBase, tools
3535

3636
from matplotlib.cbook import is_string_like, is_writable_file_like
3737
from matplotlib.colors import colorConverter
@@ -416,6 +416,11 @@ def __init__(self, canvas, num):
416416

417417
self.vbox.pack_start(self.canvas, True, True, 0)
418418

419+
self.toolbar = self._get_toolbar()
420+
self.navigation = self._get_navigation()
421+
if matplotlib.rcParams['toolbar'] == 'navigation':
422+
self.navigation.add_tools(tools)
423+
419424
# calculate size for window
420425
w = int (self.canvas.figure.bbox.width)
421426
h = int (self.canvas.figure.bbox.height)

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from matplotlib.backend_bases import FigureManagerBase, FigureCanvasBase
2222
from matplotlib.backend_bases import NavigationToolbar2, cursors, TimerBase
2323
from matplotlib.backend_bases import ShowBase, ToolbarBase, NavigationBase
24-
from matplotlib.backend_tools import SaveFigureBase, ConfigureSubplotsBase
24+
from matplotlib.backend_tools import SaveFigureBase, ConfigureSubplotsBase, tools
2525
from matplotlib._pylab_helpers import Gcf
2626

2727
from matplotlib.figure import Figure
@@ -525,10 +525,11 @@ class FigureManagerTkAgg(FigureManagerBase):
525525
window : The tk.Window
526526
"""
527527
def __init__(self, canvas, num, window):
528-
self.window = window
529528
FigureManagerBase.__init__(self, canvas, num)
529+
self.window = window
530530
self.window.withdraw()
531531
self.set_window_title("Figure %d" % num)
532+
self.canvas = canvas
532533
self._num = num
533534
if matplotlib.rcParams['toolbar']=='toolbar2':
534535
self.toolbar = NavigationToolbar2TkAgg( canvas, self.window )

0 commit comments

Comments
 (0)
0