Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f09b9ef

Browse files
committed
import with original name backend_tools
1 parent aac4744 commit f09b9ef

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def fn_name(): return sys._getframe(1).f_code.co_name
3333
from matplotlib.backend_bases import (ShowBase, ToolContainerBase,
3434
StatusbarBase)
3535
from matplotlib.backend_managers import ToolManager
36-
import matplotlib.backend_tools as tools
36+
from matplotlib import backend_tools
3737

3838
from matplotlib.cbook import is_string_like, is_writable_file_like
3939
from matplotlib.colors import colorConverter
@@ -432,8 +432,8 @@ def add_widget(child, expand, fill, padding):
432432
return size_request.height
433433

434434
if matplotlib.rcParams['toolbar'] == 'toolmanager':
435-
tools.add_tools_2_toolmanager(self.toolmanager)
436-
tools.add_tools_2_container(self.toolbar)
435+
backend_tools.add_tools_2_toolmanager(self.toolmanager)
436+
backend_tools.add_tools_2_container(self.toolbar)
437437
self.statusbar = StatusbarGTK3(self.toolmanager)
438438
h += add_widget(self.statusbar, False, False, 0)
439439
h += add_widget(Gtk.HSeparator(), False, False, 0)
@@ -731,9 +731,9 @@ def get_filename_from_user (self):
731731
return filename, self.ext
732732

733733

734-
class RubberbandGTK3(tools.RubberbandBase):
734+
class RubberbandGTK3(backend_tools.RubberbandBase):
735735
def __init__(self, *args, **kwargs):
736-
tools.RubberbandBase.__init__(self, *args, **kwargs)
736+
backend_tools.RubberbandBase.__init__(self, *args, **kwargs)
737737
self.ctx = None
738738

739739
def draw_rubberband(self, x0, y0, x1, y1):
@@ -846,7 +846,7 @@ def set_message(self, s):
846846
self.push(self._context, s)
847847

848848

849-
class SaveFigureGTK3(tools.SaveFigureBase):
849+
class SaveFigureGTK3(backend_tools.SaveFigureBase):
850850

851851
def get_filechooser(self):
852852
fc = FileChooserDialog(
@@ -878,14 +878,14 @@ def trigger(self, *args, **kwargs):
878878
error_msg_gtk(str(e), parent=self)
879879

880880

881-
class SetCursorGTK3(tools.SetCursorBase):
881+
class SetCursorGTK3(backend_tools.SetCursorBase):
882882
def set_cursor(self, cursor):
883883
self.figure.canvas.get_property("window").set_cursor(cursord[cursor])
884884

885885

886-
class ConfigureSubplotsGTK3(tools.ConfigureSubplotsBase, Gtk.Window):
886+
class ConfigureSubplotsGTK3(backend_tools.ConfigureSubplotsBase, Gtk.Window):
887887
def __init__(self, *args, **kwargs):
888-
tools.ConfigureSubplotsBase.__init__(self, *args, **kwargs)
888+
backend_tools.ConfigureSubplotsBase.__init__(self, *args, **kwargs)
889889
self.window = None
890890

891891
def init_window(self):
@@ -1122,10 +1122,10 @@ def error_msg_gtk(msg, parent=None):
11221122
dialog.destroy()
11231123

11241124

1125-
tools.ToolSaveFigure = SaveFigureGTK3
1126-
tools.ToolConfigureSubplots = ConfigureSubplotsGTK3
1127-
tools.ToolSetCursor = SetCursorGTK3
1128-
tools.ToolRubberband = RubberbandGTK3
1125+
backend_tools.ToolSaveFigure = SaveFigureGTK3
1126+
backend_tools.ToolConfigureSubplots = ConfigureSubplotsGTK3
1127+
backend_tools.ToolSetCursor = SetCursorGTK3
1128+
backend_tools.ToolRubberband = RubberbandGTK3
11291129

11301130
Toolbar = ToolbarGTK3
11311131
FigureCanvas = FigureCanvasGTK3

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from matplotlib.backend_bases import (ShowBase, ToolContainerBase,
2424
StatusbarBase)
2525
from matplotlib.backend_managers import ToolManager
26-
import matplotlib.backend_tools as tools
26+
from matplotlib import backend_tools
2727
from matplotlib._pylab_helpers import Gcf
2828

2929
from matplotlib.figure import Figure
@@ -540,8 +540,8 @@ def __init__(self, canvas, num, window):
540540
self.statusbar = None
541541

542542
if matplotlib.rcParams['toolbar'] == 'toolmanager':
543-
tools.add_tools_2_toolmanager(self.toolmanager)
544-
tools.add_tools_2_container(self.toolbar)
543+
backend_tools.add_tools_2_toolmanager(self.toolmanager)
544+
backend_tools.add_tools_2_container(self.toolbar)
545545
self.statusbar = StatusbarTk(self.window, self.toolmanager)
546546

547547
self._shown = False
@@ -898,9 +898,9 @@ def hidetip(self):
898898
tw.destroy()
899899

900900

901-
class RubberbandTk(tools.RubberbandBase):
901+
class RubberbandTk(backend_tools.RubberbandBase):
902902
def __init__(self, *args, **kwargs):
903-
tools.RubberbandBase.__init__(self, *args, **kwargs)
903+
backend_tools.RubberbandBase.__init__(self, *args, **kwargs)
904904

905905
def draw_rubberband(self, x0, y0, x1, y1):
906906
height = self.figure.canvas.figure.bbox.height
@@ -924,7 +924,7 @@ def remove_rubberband(self):
924924
del self.lastrect
925925

926926

927-
class SetCursorTk(tools.SetCursorBase):
927+
class SetCursorTk(backend_tools.SetCursorBase):
928928
def set_cursor(self, cursor):
929929
self.figure.canvas.manager.window.configure(cursor=cursord[cursor])
930930

@@ -1015,7 +1015,7 @@ def set_message(self, s):
10151015
self._message.set(s)
10161016

10171017

1018-
class SaveFigureTk(tools.SaveFigureBase):
1018+
class SaveFigureTk(backend_tools.SaveFigureBase):
10191019
def trigger(self, *args):
10201020
from six.moves import tkinter_tkfiledialog, tkinter_messagebox
10211021
filetypes = self.figure.canvas.get_supported_filetypes().copy()
@@ -1068,9 +1068,9 @@ def trigger(self, *args):
10681068
tkinter_messagebox.showerror("Error saving file", str(e))
10691069

10701070

1071-
class ConfigureSubplotsTk(tools.ConfigureSubplotsBase):
1071+
class ConfigureSubplotsTk(backend_tools.ConfigureSubplotsBase):
10721072
def __init__(self, *args, **kwargs):
1073-
tools.ConfigureSubplotsBase.__init__(self, *args, **kwargs)
1073+
backend_tools.ConfigureSubplotsBase.__init__(self, *args, **kwargs)
10741074
self.window = None
10751075

10761076
def trigger(self, *args):
@@ -1096,10 +1096,10 @@ def destroy(self, *args, **kwargs):
10961096
self.window = None
10971097

10981098

1099-
tools.ToolSaveFigure = SaveFigureTk
1100-
tools.ToolConfigureSubplots = ConfigureSubplotsTk
1101-
tools.ToolSetCursor = SetCursorTk
1102-
tools.ToolRubberband = RubberbandTk
1099+
backend_tools.ToolSaveFigure = SaveFigureTk
1100+
backend_tools.ToolConfigureSubplots = ConfigureSubplotsTk
1101+
backend_tools.ToolSetCursor = SetCursorTk
1102+
backend_tools.ToolRubberband = RubberbandTk
11031103
Toolbar = ToolbarTk
11041104
FigureCanvas = FigureCanvasTkAgg
11051105
FigureManager = FigureManagerTkAgg

0 commit comments

Comments
 (0)