@@ -13,16 +13,18 @@ Status
13
13
Branches and Pull requests
14
14
==========================
15
15
16
- Previous work
17
- * https://github.com/matplotlib/matplotlib/pull/1849
18
- * https://github.com/matplotlib/matplotlib/pull/2557
19
- * https://github.com/matplotlib/matplotlib/pull/2465
16
+ Previous work:
17
+
18
+ * https://github.com/matplotlib/matplotlib/pull/1849
19
+ * https://github.com/matplotlib/matplotlib/pull/2557
20
+ * https://github.com/matplotlib/matplotlib/pull/2465
20
21
21
22
Pull Requests:
22
- * Removing the NavigationToolbar classes
23
- https://github.com/matplotlib/matplotlib/pull/2740 **CLOSED **
24
- * Keeping the NavigationToolbar classes https://github.com/matplotlib/matplotlib/pull/2759 **CLOSED **
25
- * Navigation by events: https://github.com/matplotlib/matplotlib/pull/3652
23
+
24
+ * Removing the NavigationToolbar classes
25
+ https://github.com/matplotlib/matplotlib/pull/2740 **CLOSED **
26
+ * Keeping the NavigationToolbar classes https://github.com/matplotlib/matplotlib/pull/2759 **CLOSED **
27
+ * Navigation by events: https://github.com/matplotlib/matplotlib/pull/3652
26
28
27
29
Abstract
28
30
========
@@ -39,7 +41,7 @@ reconfiguration.
39
41
40
42
This approach will make easier to create and share tools among
41
43
users. In the far future, we can even foresee a kind of Marketplace
42
- for ``Tool ``\ s where the most popular can be added into the main
44
+ for ``Tool ``\s where the most popular can be added into the main
43
45
distribution.
44
46
45
47
Detailed description
@@ -55,18 +57,18 @@ https://github.com/matplotlib/matplotlib/issues/2699
55
57
56
58
The proposed solution is to take the actions out of the ``Toolbar `` and the
57
59
shortcuts out of the ``Canvas ``. The actions and shortcuts will be in the form
58
- of ``Tool ``\ s.
60
+ of ``Tool ``\s .
59
61
60
62
A new class ``Navigation `` will be the bridge between the events from the
61
63
``Canvas `` and ``Toolbar `` and redirect them to the appropriate ``Tool ``.
62
64
63
65
At the end the user interaction will be divided into three classes:
64
66
65
- * NavigationBase: This class is instantiated for each FigureManager
66
- and connect the all user interactions with the Tools
67
- * ToolbarBase: This existing class is relegated only as a GUI access
68
- to Tools.
69
- * ToolBase: Is the basic definition of Tools.
67
+ * NavigationBase: This class is instantiated for each FigureManager
68
+ and connect the all user interactions with the Tools
69
+ * ToolbarBase: This existing class is relegated only as a GUI access
70
+ to Tools.
71
+ * ToolBase: Is the basic definition of Tools.
70
72
71
73
72
74
Implementation
@@ -80,96 +82,108 @@ present in the Toolbar as ``Quit``.
80
82
81
83
The `.ToolBase ` has the following class attributes for configuration at definition time
82
84
83
- * keymap = None: Key(s) to be used to trigger the tool
84
- * description = '': Small description of the tool
85
- * image = None: Image that is used in the toolbar
85
+ * keymap = None: Key(s) to be used to trigger the tool
86
+ * description = '': Small description of the tool
87
+ * image = None: Image that is used in the toolbar
86
88
87
89
The following instance attributes are set at instantiation:
88
- * name
89
- * navigation
90
-
91
- **Methods **
92
- * trigger(self, event): This is the main method of the Tool, it is called when the Tool is triggered by:
93
- * Toolbar button click
94
- * keypress associated with the Tool Keymap
95
- * Call to navigation.trigger_tool(name)
96
- * set_figure(self, figure): Set the figure and navigation attributes
97
- * ``destroy(self, *args) ``: Destroy the ``Tool `` graphical interface (if
98
- exists)
99
-
100
- **Available Tools **
101
- * ToolQuit
102
- * ToolEnableAllNavigation
103
- * ToolEnableNavigation
104
- * ToolToggleGrid
105
- * ToolToggleFullScreen
106
- * ToolToggleYScale
107
- * ToolToggleXScale
108
- * ToolHome
109
- * ToolBack
110
- * ToolForward
111
- * SaveFigureBase
112
- * ConfigureSubplotsBase
113
90
91
+ * name
92
+ * navigation
93
+
94
+ Methods
95
+ ~~~~~~~
96
+
97
+ * ``trigger(self, event) ``: This is the main method of the Tool, it is called
98
+ when the Tool is triggered by:
99
+
100
+ * Toolbar button click
101
+ * keypress associated with the Tool Keymap
102
+ * Call to navigation.trigger_tool(name)
103
+
104
+ * ``set_figure(self, figure) ``: Set the figure and navigation attributes
105
+ * ``destroy(self, *args) ``: Destroy the ``Tool `` graphical interface (if
106
+ exists)
107
+
108
+ Available Tools
109
+ ~~~~~~~~~~~~~~~
110
+
111
+ * ToolQuit
112
+ * ToolEnableAllNavigation
113
+ * ToolEnableNavigation
114
+ * ToolToggleGrid
115
+ * ToolToggleFullScreen
116
+ * ToolToggleYScale
117
+ * ToolToggleXScale
118
+ * ToolHome
119
+ * ToolBack
120
+ * ToolForward
121
+ * SaveFigureBase
122
+ * ConfigureSubplotsBase
114
123
115
124
ToolToggleBase(ToolBase)
116
125
------------------------
117
126
118
127
The `.ToolToggleBase ` has the following class attributes for
119
128
configuration at definition time
120
129
121
- * radio_group = None: Attribute to group 'radio' like tools (mutually
122
- exclusive)
123
- * cursor = None: Cursor to use when the tool is active
130
+ * radio_group = None: Attribute to group 'radio' like tools (mutually
131
+ exclusive)
132
+ * cursor = None: Cursor to use when the tool is active
124
133
125
134
The **Toggleable ** Tools, can capture keypress, mouse moves, and mouse
126
135
button press
127
136
128
- It defines the following methods
129
- * enable(self, event): Called by `.ToolToggleBase.trigger ` method
130
- * disable(self, event): Called when the tool is untoggled
131
- * toggled : **Property ** True or False
137
+ Methods
138
+ ~~~~~~~
132
139
133
- ** Available Tools **
134
- * ToolZoom
135
- * ToolPan
140
+ * `` enable(self, event) ``: Called by ` .ToolToggleBase.trigger ` method
141
+ * `` disable(self, event) ``: Called when the tool is untoggled
142
+ * `` toggled ``: ** Property ** True or False
136
143
137
- NavigationBase
138
- --------------
144
+ Available Tools
145
+ ~~~~~~~~~~~~~~~
139
146
140
- Defines the following attributes
141
- * canvas:
142
- * keypresslock: Lock to know if the ``canvas `` ``key_press_event `` is
143
- available and process it
144
- * messagelock: Lock to know if the message is available to write
145
-
146
- Public methods for **User use **:
147
- * nav_connect(self, s, func): Connect to navigation for events
148
- * nav_disconnect(self, cid): Disconnect from navigation event
149
- * message_event(self, message, sender=None): Emit a
150
- tool_message_event event
151
- * active_toggle(self): **Property ** The currently toggled tools or
152
- None
153
- * get_tool_keymap(self, name): Return a list of keys that are
154
- associated with the tool
155
- * set_tool_keymap(self, name, ``*keys ``): Set the keys for the given tool
156
- * remove_tool(self, name): Removes tool from the navigation control.
157
- * add_tools(self, tools): Add multiple tools to ``Navigation ``
158
- * add_tool(self, name, tool, group=None, position=None): Add a tool
159
- to the ``Navigation ``
160
- * tool_trigger_event(self, name, sender=None, canvasevent=None,
161
- data=None): Trigger a tool and fire the event
162
-
163
- * tools(self) **Property **: Return a dict with available tools with
164
- corresponding keymaps, descriptions and objects
165
- * get_tool(self, name): Return the tool object
147
+ * ToolZoom
148
+ * ToolPan
166
149
150
+ NavigationBase
151
+ --------------
167
152
153
+ Defines the following attributes:
154
+
155
+ * canvas:
156
+ * keypresslock: Lock to know if the ``canvas `` ``key_press_event `` is
157
+ available and process it
158
+ * messagelock: Lock to know if the message is available to write
159
+
160
+ Methods (intended for the end user)
161
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162
+
163
+ * ``nav_connect(self, s, func) ``: Connect to navigation for events
164
+ * ``nav_disconnect(self, cid) ``: Disconnect from navigation event
165
+ * ``message_event(self, message, sender=None) ``: Emit a
166
+ tool_message_event event
167
+ * ``active_toggle(self) ``: **Property ** The currently toggled tools or
168
+ None
169
+ * ``get_tool_keymap(self, name) ``: Return a list of keys that are
170
+ associated with the tool
171
+ * ``set_tool_keymap(self, name, ``*keys ``)``: Set the keys for the given tool
172
+ * ``remove_tool(self, name) ``: Removes tool from the navigation control.
173
+ * ``add_tools(self, tools) ``: Add multiple tools to ``Navigation ``
174
+ * ``add_tool(self, name, tool, group=None, position=None) ``: Add a tool
175
+ to the ``Navigation ``
176
+ * ``tool_trigger_event(self, name, sender=None, canvasevent=None,
177
+ data=None) ``: Trigger a tool and fire the event
178
+ * ``tools ``: **Property ** A dict with available tools with
179
+ corresponding keymaps, descriptions and objects
180
+ * ``get_tool(self, name) ``: Return the tool object
168
181
169
182
ToolbarBase
170
183
-----------
171
184
172
- Methods for **Backend implementation **
185
+ Methods (for backend implementation)
186
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173
187
174
188
* ``add_toolitem(self, name, group, position, image, description, toggle) ``:
175
189
Add a toolitem to the toolbar. This method is a callback from
0 commit comments