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

Skip to content

Commit 8dafe09

Browse files
committed
doc and minor code organization
1 parent 48a6971 commit 8dafe09

File tree

6 files changed

+27
-30
lines changed

6 files changed

+27
-30
lines changed

doc/api/backend_managers_api.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
:mod:`matplotlib.backend_managers`
3+
===================================
4+
5+
.. automodule:: matplotlib.backend_managers
6+
:members:
7+
:undoc-members:
8+
:show-inheritance:

doc/api/index_backend_api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ backends
55
.. toctree::
66

77
backend_bases_api.rst
8+
backend_managers_api.rst
89
backend_tools_api.rst
910
backend_gtkagg_api.rst
1011
backend_qt4agg_api.rst

lib/matplotlib/backend_bases.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
The base class for the Show class of each interactive backend;
2525
the 'show' callable is then set to Show.__call__, inherited from
2626
ShowBase.
27+
28+
:class:`ToolContainerBase`
29+
The base class for the Toolbar class of each interactive backend.
30+
31+
:class:`StatusbarBase`
32+
The base class for the messaging area.
2733
"""
2834

2935
from __future__ import (absolute_import, division, print_function,

lib/matplotlib/backend_managers.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
11
"""
2-
:class:`NavigationBase`
3-
The base class for the Navigation class that makes the bridge between
4-
user interaction (key press, toolbar clicks, ..) and the actions in
5-
response to the user inputs.
6-
7-
:class:`ToolContainerBase`
8-
The base class for the Toolbar class of each interactive backend.
9-
10-
:class:`StatusbarBase`
11-
The base class for the messaging area.
2+
`ToolManager`
3+
Class that makes the bridge between user interaction (key press,
4+
toolbar clicks, ..) and the actions in response to the user inputs.
125
"""
136

147
from __future__ import (absolute_import, division, print_function,
158
unicode_literals)
169
import six
1710
import warnings
18-
import sys
1911

2012
import matplotlib.cbook as cbook
2113
import matplotlib.widgets as widgets
2214
from matplotlib.rcsetup import validate_stringlist
2315
import matplotlib.backend_tools as tools
2416

25-
try:
26-
from importlib import import_module
27-
except:
28-
# simple python 2.6 implementation (no relative imports)
29-
def import_module(name):
30-
__import__(name)
31-
return sys.modules[name]
32-
3317

3418
class ToolEvent(object):
3519
"""Event for tool manipulation (add/remove)"""

lib/matplotlib/backend_tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"""
22
Abstract base classes define the primitives for Tools.
3-
These tools are used by `ToolManager`
3+
These tools are used by `matplotlib.backend_managers.ToolManager`
44
55
:class:`ToolBase`
66
Simple stateless tool
77
88
:class:`ToolToggleBase`
99
Tool that has two states, only one Toggle tool can be
10-
active at any given time for the same `ToolManager`
10+
active at any given time for the same
11+
`matplotlib.backend_managers.ToolManager`
1112
"""
1213

1314

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,6 @@ def draw_rubberband(self, x0, y0, x1, y1):
758758
self.ctx.set_source_rgb(0, 0, 0)
759759
self.ctx.stroke()
760760

761-
tools.ToolRubberband = RubberbandGTK3
762-
763761

764762
class ToolbarGTK3(ToolContainerBase, Gtk.Box):
765763
def __init__(self, toolmanager):
@@ -879,15 +877,11 @@ def trigger(self, *args, **kwargs):
879877
except Exception as e:
880878
error_msg_gtk(str(e), parent=self)
881879

882-
tools.ToolSaveFigure = SaveFigureGTK3
883-
884880

885881
class SetCursorGTK3(tools.SetCursorBase):
886882
def set_cursor(self, cursor):
887883
self.figure.canvas.get_property("window").set_cursor(cursord[cursor])
888884

889-
tools.ToolSetCursor = SetCursorGTK3
890-
891885

892886
class ConfigureSubplotsGTK3(tools.ConfigureSubplotsBase, Gtk.Window):
893887
def __init__(self, *args, **kwargs):
@@ -942,9 +936,6 @@ def trigger(self, sender, event, data=None):
942936
self.window.present()
943937

944938

945-
tools.ToolConfigureSubplots = ConfigureSubplotsGTK3
946-
947-
948939
class DialogLineprops:
949940
"""
950941
A GUI dialog for controlling lineprops
@@ -1130,6 +1121,12 @@ def error_msg_gtk(msg, parent=None):
11301121
dialog.run()
11311122
dialog.destroy()
11321123

1124+
1125+
tools.ToolSaveFigure = SaveFigureGTK3
1126+
tools.ToolConfigureSubplots = ConfigureSubplotsGTK3
1127+
tools.ToolSetCursor = SetCursorGTK3
1128+
tools.ToolRubberband = RubberbandGTK3
1129+
11331130
Toolbar = ToolbarGTK3
11341131
FigureCanvas = FigureCanvasGTK3
11351132
FigureManager = FigureManagerGTK3

0 commit comments

Comments
 (0)