Skip to content

Commit 979875e

Browse files
committed
property for active_toggle
1 parent 1fc29fa commit 979875e

File tree

1 file changed

+22
-29
lines changed

1 file changed

+22
-29
lines changed

lib/matplotlib/backend_bases.py

+22-29
Original file line numberDiff line numberDiff line change
@@ -3191,17 +3191,10 @@ class NavigationBase(object):
31913191
canvas : `FigureCanvas` instance
31923192
toolbar : `Toolbar` instance that is controlled by this `Navigation`
31933193
keypresslock : `LockDraw` to direct the `canvas` key_press_event
3194-
movelock: `LockDraw` to direct the `canvas` motion_notify_event
3195-
presslock: `LockDraw` to direct the `canvas` button_press_event
3196-
releaselock: `LockDraw` to direct the `canvas` button_release_event
3197-
canvaslock: shortcut to `canvas.widgetlock`
3198-
3199-
Notes
3200-
--------_
3201-
The following methos are for implementation pourposes and not for user use
3202-
For these reason they are defined as **_methodname** (private)
3203-
3204-
.. automethod:: _toolbar_callback
3194+
movelock : `LockDraw` to direct the `canvas` motion_notify_event
3195+
presslock : `LockDraw` to direct the `canvas` button_press_event
3196+
releaselock : `LockDraw` to direct the `canvas` button_release_event
3197+
canvaslock : shortcut to `canvas.widgetlock`
32053198
"""
32063199
_default_cursor = cursors.POINTER
32073200
_default_tools = [tools.ToolToggleGrid,
@@ -3221,6 +3214,7 @@ class NavigationBase(object):
32213214
'SaveFigure']
32223215

32233216
def __init__(self, canvas, toolbar=None):
3217+
""".. automethod:: _toolbar_callback"""
32243218
self.canvas = canvas
32253219
self.toolbar = self._get_toolbar(toolbar, canvas)
32263220

@@ -3270,18 +3264,20 @@ def _get_toolbar(self, toolbar, canvas):
32703264
toolbar = None
32713265
return toolbar
32723266

3273-
def get_active(self):
3274-
"""Get the active tools
3267+
@property
3268+
def active_toggle(self):
3269+
"""Get the tooggled Tool"""
3270+
return self._toggled
3271+
3272+
def get_instances(self):
3273+
"""Get the active tools instgances
32753274
32763275
Returns
32773276
----------
3278-
A dictionary with the following elements
3279-
* `toggled`: The currently toggled Tool or None
3280-
* `instances`: List of the currently active tool instances
3281-
that are registered with Navigation
3282-
3277+
A dictionary with the active instances that are registered with
3278+
Navigation
32833279
"""
3284-
return {'toggled': self._toggled, 'instances': self._instances.keys()}
3280+
return self._instances
32853281

32863282
def get_tool_keymap(self, name):
32873283
"""Get the keymap associated with a tool
@@ -3333,7 +3329,8 @@ def unregister(self, name):
33333329
It is usually called by the `deactivate` method or during
33343330
destroy if it is a graphical Tool.
33353331
3336-
If called, next time the `Tool` is used it will be reinstantiated instead
3332+
If called, next time the `Tool` is used it will be reinstantiated
3333+
instead
33373334
of using the existing instance.
33383335
"""
33393336
if self._toggled == name:
@@ -3644,17 +3641,13 @@ class ToolbarBase(object):
36443641
Attributes
36453642
----------
36463643
manager : `FigureManager` instance that integrates this `Toolbar`
3647-
3648-
Notes
3649-
-----
3650-
The following methos are for implementation pourposes and not for user use.
3651-
For these reason they are defined as **_methodname** (private)
3652-
3653-
.. automethod:: _toggle
3654-
.. automethod:: _add_toolitem
3655-
.. automethod:: _remove_toolitem
36563644
"""
36573645
def __init__(self, manager):
3646+
"""
3647+
.. automethod:: _add_toolitem
3648+
.. automethod:: _remove_toolitem
3649+
.. automethod:: _toggle
3650+
"""
36583651
self.manager = manager
36593652

36603653
def _add_toolitem(self, name, description, image_file, position,

0 commit comments

Comments
 (0)