8000 property for active_toggle · matplotlib/matplotlib@622cb95 · GitHub
[go: up one dir, main page]

Skip to content

Commit 622cb95

Browse files
committed
property for active_toggle
1 parent 1e8af47 commit 622cb95

File tree

1 file changed

+22
-29
lines changed

1 file changed

+22
-29
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3233,17 +3233,10 @@ class NavigationBase(object):
32333233
canvas : `FigureCanvas` instance
32343234
toolbar : `Toolbar` instance that is controlled by this `Navigation`
32353235
keypresslock : `LockDraw` to direct the `canvas` key_press_event
3236-
movelock: `LockDraw` to direct the `canvas` motion_notify_event
3237-
presslock: `LockDraw` to direct the `canvas` button_press_event
3238-
releaselock: `LockDraw` to direct the `canvas` button_release_event
3239-
canvaslock: shortcut to `canvas.widgetlock`
3240-
3241-
Notes
3242-
--------_
3243-
The following methos are for implementation pourposes and not for user use
3244-
For these reason they are defined as **_methodname** (private)
3245-
3246-
.. automethod:: _toolbar_callback
3236+
movelock : `LockDraw` to direct the `canvas` motion_notify_event
3237+
presslock : `LockDraw` to direct the `canvas` button_press_event
3238+
releaselock : `LockDraw` to direct the `canvas` button_release_event
3239+
canvaslock : shortcut to `canvas.widgetlock`
32473240
"""
32483241
_default_cursor = cursors.POINTER
32493242
_default_tools = [tools.ToolToggleGrid,
@@ -3263,6 +3256,7 @@ class NavigationBase(object):
32633256
'SaveFigure']
32643257

32653258
def __init__(self, canvas, toolbar=None):
3259+
""".. automethod:: _toolbar_callback"""
32663260
self.canvas = canvas
32673261
self.toolbar = self._get_toolbar(toolbar, canvas)
32683262

@@ -3312,18 +3306,20 @@ def _get_toolbar(self, toolbar, canvas):
33123306
toolbar = None
33133307
return toolbar
33143308

3315-
def get_active(self):
3316-
"""Get the active tools
3309+
@property
3310+
def active_toggle(self):
3311+
"""Get the tooggled Tool"""
3312+
return self._toggled
3313+
3314+
def get_instances(self):
3315+
"""Get the active tools instgances
33173316
33183317
Returns
33193318
----------
3320-
A dictionary with the following elements
3321-
* `toggled`: The currently toggled Tool or None
3322-
* `instances`: List of the currently active tool instances
3323-
that are registered with Navigation
3324-
3319+
A dictionary with the active instances that are registered with
3320+
Navigation
33253321
"""
3326-
return {'toggled': self._toggled, 'instances': self._instances.keys()}
3322+
return self._instances
33273323

33283324
def get_tool_keymap(self, name):
33293325
"""Get the keymap associated with a tool
@@ -3375,7 +3371,8 @@ def unregister(self, name):
33753371
It is usually called by the `deactivate` method or during
33763372
destroy if it is a graphical Tool.
33773373
3378-
If called, next time the `Tool` is used it will be reinstantiated instead
3374+
If called, next time the `Tool` is used it will be reinstantiated
3375+
instead
33793376
of using the existing instance.
33803377
"""
33813378
if self._toggled == name:
@@ -3686,17 +3683,13 @@ class ToolbarBase(object):
36863683
Attributes
36873684
----------
36883685
manager : `FigureManager` instance that integrates this `Toolbar`
3689-
3690-
Notes
3691-
-----
3692-
The following methos are for implementation pourposes and not for user use.
3693-
For these reason they are defined as **_methodname** (private)
3694-
3695-
.. automethod:: _toggle
3696-
.. automethod:: _add_toolitem
3697-
.. automethod:: _remove_toolitem
36983686
"""
36993687
def __init__(self, manager):
3688+
"""
3689+
.. automethod:: _add_toolitem
3690+
.. automethod:: _remove_toolitem
3691+
.. automethod:: _toggle
3692+
"""
37003693
self.manager = manager
37013694

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

0 commit comments

Comments
 (0)
0