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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
8cceed4
navigation and toolbar coexistence
fariza Jan 23, 2014
3118a5a
mod keypress in figuremanager
fariza Jan 23, 2014
b4d5fcf
helper methods in toolbar and navigation
fariza Jan 24, 2014
1e8af47
Adding doc to base methods
fariza Jan 24, 2014
622cb95
property for active_toggle
fariza Jan 26, 2014
d1a9de4
simulate click
fariza Jan 27, 2014
3f89d52
activate renamed to trigger
fariza Jan 28, 2014
4f3c10b
toggle tools using enable/disable from its trigger method
fariza Jan 29, 2014
6065daa
simplifying _handle_toggle
fariza Jan 29, 2014
f6a2f19
reducing number of locks
fariza Jan 29, 2014
05db3b6
changing toggle and persistent attributes for issubclass
fariza Feb 4, 2014
c08fe56
bug in combined key press
fariza Feb 4, 2014
b207a72
untoggle zoom and pan from keypress while toggled
fariza Feb 4, 2014
9266447
classmethods for default tools modification
fariza Feb 6, 2014
a53419a
adding zaxis and some pep8
fariza May 1, 2014
704c717
removing legacy method dynamic update
fariza May 6, 2014
5056729
tk backend
fariza May 6, 2014
e6a4e1e
example working with Tk
fariza May 6, 2014
8942c47
duplicate code in keymap tool initialization
fariza Jul 24, 2014
022de6f
grammar corrections
fariza Jul 24, 2014
2c9a195
moving views and positions to tools
fariza Jul 24, 2014
cafe668
The views positions mixin automatically adds the clear as axobserver
fariza Jul 25, 2014
224f745
bug when navigation was not defined
fariza Jul 25, 2014
94c711e
Small refactor so that we first initiate the Navigation (ToolManager)…
OceanWolf Jul 28, 2014
67257e7
Moved default_tool initilisation to FigureManagerBase and cleaned.
OceanWolf Jul 29, 2014
ffa65d6
Temporary fix to backends
OceanWolf Jul 29, 2014
6739ee0
removing persistent tools
fariza Sep 3, 2014
d18206f
removing unregister
fariza Sep 4, 2014
34a52c8
change cursor inmediately after toggle
fariza Sep 5, 2014
c2da483
removing intoolbar
fariza Oct 15, 2014
44a9b0e
events working
fariza Oct 16, 2014
a2ed47f
using pydispatch
fariza Oct 17, 2014
0665890
using navigation as signal handler
fariza Oct 20, 2014
411e6e2
removing view positions singleton
fariza Oct 20, 2014
d484ebd
moving set_cursor completely out of navigation
fariza Oct 27, 2014
75bf97b
removing unused event class
fariza Nov 10, 2014
6cc040b
underscore in tool_trigger-xxx
fariza Nov 10, 2014
0ff5997
adding radio_group for toggle tools
fariza Nov 14, 2014
af6734f
scroll to zoom in zoom/pan tools
fariza Nov 28, 2014
78513d2
remove ToolAddedEvent incorporating the functionality into toolevent
fariza Dec 5, 2014
377ff54
eliminating repeated loop
fariza Jan 5, 2015
7dbbf58
replace draw by draw_idle in tools
fariza Jan 21, 2015
dd66b57
rename mpl_connect
fariza Jan 21, 2015
67a414f
cleaning navigation and toolbar dependencies
fariza Feb 4, 2015
e415d8d
Made NavigationBase.get_tool() more useful.
OceanWolf Feb 11, 2015
1213086
Refactored Toolbar out of NavigationBase
OceanWolf Feb 12, 2015
ba61dec
Some short cuts for adding tools
OceanWolf Feb 16, 2015
9f2ee2b
Lots of fixes
OceanWolf Feb 18, 2015
9da2b13
Rename ToolbarBase -> ToolContainerBase
OceanWolf Feb 18, 2015
110253f
Statusbar
OceanWolf Feb 20, 2015
e2804ea
tool group position
fariza Feb 26, 2015
9a64b7e
docstrings and small corrections by WeatherGod
fariza Mar 23, 2015
64f947f
tkbackend updated
fariza Mar 31, 2015
e8cd5d5
tacaswell comments aprl 1
fariza Apr 1, 2015
4bbcf4e
renaming tool_trigger_event
fariza Apr 1, 2015
73a2661
add_tools moved out of base classes
fariza Apr 1, 2015
1b83628
figure.setter in tools
fariza Apr 1, 2015
e4edd23
rename tools to default_tools to avoid confusion
fariza Apr 1, 2015
d4ac2fb
docstring helper add_tools methods
fariza Apr 1, 2015
a7640ef
rename navigation to toolmanager
fariza Apr 2, 2015
48a6971
tkagg updated for toolmanager and tool groups
fariza Apr 2, 2015
8dafe09
doc and minor code organization
fariza Apr 2, 2015
a0695d0
whats new
fariza Apr 3, 2015
328b169
missing object from class declaration
fariza Apr 3, 2015
aac4744
remove comments and docstrings
fariza Apr 3, 2015
f09b9ef
import with original name backend_tools
fariza Apr 3, 2015
def3a52
rename 2 -> to, example without gtk only code
fariza Apr 7, 2015
9ee7e25
zoom pan buttons order
fariza Apr 7, 2015
5eae4e1
matplotlib.rcParams['toolbar'] == 'None' starts toolmanager but not t…
fariza Apr 7, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
activate renamed to trigger
  • Loading branch information
fariza committed Apr 7, 2015
commit 3f89d528a7f13ad1453dce5559cdc50f5ba9577a
4 changes: 2 additions & 2 deletions examples/user_interfaces/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ListTools(ToolBase):
#Where to put it in the toolbar, -1 = at the end, None = Not in toolbar
position = -1

def activate(self, event):
def trigger(self, event):
#The most important attributes are navigation and figure
self.navigation.list_tools()

Expand All @@ -28,7 +28,7 @@ class CopyTool(ToolBase):
description = 'Copy canvas'
position = -1

def activate(self, event):
def trigger(self, event):
from gi.repository import Gtk, Gdk, GdkPixbuf
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
window = self.figure.canvas.get_window()
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -3472,7 +3472,7 @@ def _tool_activate(self, name, event, from_toolbar):
self._handle_toggle(name, event=event, from_toolbar=from_toolbar)
elif tool.persistent:
instance = self._get_instance(name)
instance.activate(event)
instance.trigger(event)
else:
#Non persistent tools, are
#instantiated and forgotten (reminds me an exgirlfriend?)
Expand Down Expand Up @@ -3521,7 +3521,7 @@ def _handle_toggle(self, name, event=None, from_toolbar=False):

instance = self._get_instance(name)
if self._toggled is None:
instance.activate(None)
instance.trigger(None)
self._toggled = name

elif self._toggled == name:
Expand All @@ -3533,7 +3533,7 @@ def _handle_toggle(self, name, event=None, from_toolbar=False):
self.toolbar._toggle(self._toggled, False)

self._get_instance(self._toggled).deactivate(None)
instance.activate(None)
instance.trigger(None)
self._toggled = name

for a in self.canvas.figure.get_axes():
Expand Down
32 changes: 16 additions & 16 deletions lib/matplotlib/backend_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ class ToolBase(object):
def __init__(self, figure, event=None):
self.figure = figure
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be self._figure, just in case we change our minds about setters later and turn it into a property?

self.navigation = figure.canvas.manager.navigation
self.activate(event)
self.trigger(event)

def activate(self, event):
def trigger(self, event):
"""Called when tool is used

Parameters
Expand All @@ -118,15 +118,15 @@ class ToolPersistentBase(ToolBase):

Notes
-----
The difference with `ToolBase` is that `activate` method
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
#persistent tools don't call activate a at instantiation
#persistent tools don't call trigger a at instantiation

def unregister(self, *args):
"""Unregister the tool from the instances of Navigation
Expand Down Expand Up @@ -196,7 +196,7 @@ class ToolQuit(ToolBase):
description = 'Quit the figure'
keymap = rcParams['keymap.quit']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One problem I have with this approach is that it these keymaps are set upon import of matplotlib. As far as I can tell, there is no way for a user to modify this keymap after importing matplotlib. So, updating the rcParams with a user-specified "style", for example wouldn't update any of this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as @OceanWolf commented, we use the rcParams only for default values, navigation.set_tool_keymap provides a way to modify this at runtime

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as noted somewhere else, changed keymap for default_keymap to avoid confusion


def activate(self, event):
def trigger(self, event):
Gcf.destroy_fig(self.figure)


Expand All @@ -207,7 +207,7 @@ class ToolEnableAllNavigation(ToolBase):
description = 'Enables all axes navigation'
keymap = rcParams['keymap.all_axes']

def activate(self, event):
def trigger(self, event):
if event.inaxes is None:
return

Expand All @@ -225,7 +225,7 @@ class ToolEnableNavigation(ToolBase):
description = 'Enables one axes navigation'
keymap = range(1, 10)

def activate(self, event):
def trigger(self, event):
if event.inaxes is None:
return

Expand All @@ -244,7 +244,7 @@ class ToolToggleGrid(ToolBase):
description = 'Toogle Grid'
keymap = rcParams['keymap.grid']

def activate(self, event):
def trigger(self, event):
if event.inaxes is None:
return
event.inaxes.grid()
Expand All @@ -257,7 +257,7 @@ class ToolToggleFullScreen(ToolBase):
description = 'Toogle Fullscreen mode'
keymap = rcParams['keymap.fullscreen']

def activate(self, event):
def trigger(self, event):
self.figure.canvas.manager.full_screen_toggle()


Expand All @@ -267,7 +267,7 @@ class ToolToggleYScale(ToolBase):
description = 'Toogle Scale Y axis'
keymap = rcParams['keymap.yscale']

def activate(self, event):
def trigger(self, event):
ax = event.inaxes
if ax is None:
return
Expand All @@ -287,7 +287,7 @@ class ToolToggleXScale(ToolBase):
description = 'Toogle Scale X axis'
keymap = rcParams['keymap.xscale']

def activate(self, event):
def trigger(self, event):
ax = event.inaxes
if ax is None:
return
Expand All @@ -309,7 +309,7 @@ class ToolHome(ToolBase):
keymap = rcParams['keymap.home']
position = -1

def activate(self, *args):
def trigger(self, *args):
self.navigation.views.home()
self.navigation.positions.home()
self.navigation.update_view()
Expand All @@ -324,7 +324,7 @@ class ToolBack(ToolBase):
keymap = rcParams['keymap.back']
position = -1

def activate(self, *args):
def trigger(self, *args):
self.navigation.views.back()
self.navigation.positions.back()
# self.set_history_buttons()
Expand All @@ -339,7 +339,7 @@ class ToolForward(ToolBase):
keymap = rcParams['keymap.forward']
position = -1

def activate(self, *args):
def trigger(self, *args):
self.navigation.views.forward()
self.navigation.positions.forward()
# self.set_history_buttons()
Expand Down Expand Up @@ -378,7 +378,7 @@ def __init__(self, *args):
self._button_pressed = None
self._xypress = None

def activate(self, event):
def trigger(self, event):
self.navigation.canvaslock(self)
self.navigation.presslock(self)
self.navigation.releaselock(self)
Expand Down Expand Up @@ -607,7 +607,7 @@ def __init__(self, *args):
self._button_pressed = None
self._xypress = None

def activate(self, event):
def trigger(self, event):
self.navigation.canvaslock(self)
self.navigation.presslock(self)
self.navigation.releaselock(self)
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ def get_filechooser(self):
fc.set_current_name(self.figure.canvas.get_default_filename())
return fc

def activate(self, *args):
def trigger(self, *args):
chooser = self.get_filechooser()
fname, format_ = chooser.get_filename_from_user()
chooser.destroy()
Expand Down Expand Up @@ -920,7 +920,7 @@ def __init__(self, *args, **kwargs):
def _get_canvas(self, fig):
return self.canvas.__class__(fig)

def activate(self, event):
def trigger(self, event):
self.present()


Expand Down