-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MEP22 Navigation toolbar coexistence TODELETE #2759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
dda0cdc
10f5dc7
08a6020
c6c0ad3
1fc29fa
979875e
c5c4f0f
97dfda7
6b647ad
99667aa
6c19579
0495aac
fb46fc1
d49c431
5ba6210
7ca8626
dcc0f16
bc703e0
68dc711
bb9f1c7
2c2e649
a99367f
3d1be34
afdd34c
5b49c7a
773db88
2ca6926
661417d
90ab64f
55dd149
15ac091
8cd241c
39f5b74
b20dade
ff94301
2cb4501
9d3c977
6e0b7e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,31 +72,14 @@ class ToolBase(object): | |
`name` is used as label in the toolbar button | ||
""" | ||
|
||
toggle = False # Change the status (take control of the events) | ||
"""Is toggleable tool | ||
|
||
**bool**: | ||
|
||
* **True**: The tool is a toogleable tool | ||
* **False**: The tool is not toggleable | ||
|
||
""" | ||
|
||
persistent = False | ||
"""Is persistent tool | ||
|
||
**bool**: | ||
* `True`: The tool is persistent | ||
* `False`: The tool is not persistent | ||
""" | ||
|
||
cursor = None | ||
"""Cursor to use when the tool is active | ||
""" | ||
|
||
def __init__(self, figure, event=None): | ||
self.figure = figure | ||
self.navigation = figure.canvas.manager.navigation | ||
self.figure = None | ||
self.navigation = None | ||
self.set_figure(figure) | ||
self.trigger(event) | ||
|
||
def trigger(self, event): | ||
|
@@ -109,6 +92,18 @@ def trigger(self, event): | |
""" | ||
pass | ||
|
||
def set_figure(self, figure): | ||
"""Set the figure and navigation | ||
|
||
Set the figure to be affected by this tool | ||
|
||
Parameters | ||
---------- | ||
figure : `Figure` | ||
""" | ||
self.figure = figure | ||
self.navigation = figure.canvas.manager.navigation | ||
|
||
|
||
class ToolPersistentBase(ToolBase): | ||
"""Persisten tool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You missed of a |
||
|
@@ -121,12 +116,13 @@ class ToolPersistentBase(ToolBase): | |
The difference with `ToolBase` is that `trigger` method | ||
is not called automatically at initialization | ||
""" | ||
persistent = True | ||
|
||
def __init__(self, figure, event=None): | ||
self.figure = figure | ||
self.navigation = figure.canvas.manager.navigation | ||
self.figure = None | ||
C1C8 | self.navigation = None | |
self.set_figure(figure) | ||
#persistent tools don't call trigger a at instantiation | ||
#it will be called by Navigation | ||
|
||
def unregister(self, *args): | ||
"""Unregister the tool from the instances of Navigation | ||
|
@@ -145,7 +141,6 @@ class ToolToggleBase(ToolPersistentBase): | |
Every time it is triggered, it switches between enable and disable | ||
|
||
""" | ||
toggle = True | ||
_toggled = False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this here as a class-level attribute? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you are right, I forgot that one. |
||
|
||
def trigger(self, event): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More grammar changes for the above attributes: