Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
4886680
navigation and toolbar coexistence
fariza Jan 23, 2014
268d925
mod keypress in figuremanager
fariza Jan 23, 2014
942cc90
extra files
fariza Jan 23, 2014
814f6ba
helper methods in toolbar and navigation
fariza Jan 24, 2014
11cf64d
Adding doc to base methods
fariza Jan 24, 2014
109f129
property for active_toggle
fariza Jan 26, 2014
2991b86
simulate click
fariza Jan 27, 2014
24ae298
pep8 backend_tools
fariza Jan 27, 2014
bfff069
activate renamed to trigger
fariza Jan 28, 2014
24c733f
toggle tools using enable/disable from its trigger method
fariza Jan 29, 2014
111af35
simplifying _handle_toggle
fariza Jan 29, 2014
69f7e19
reducing number of locks
fariza Jan 29, 2014
890122c
pep8 correction
fariza Jan 29, 2014
fdd6b25
changing toggle and persistent attributes for issubclass
fariza Feb 4, 2014
1b13e51
bug in combined key press
fariza Feb 4, 2014
f7dd1ec
untoggle zoom and pan from keypress while toggled
fariza Feb 4, 2014
f4ea69b
classmethods for default tools modification
fariza Feb 6, 2014
3981f5d
six fixes
fariza Apr 24, 2014
6672a39
adding zaxis and some pep8
fariza May 1, 2014
659099f
removing legacy method dynamic update
fariza May 6, 2014
45c16dd
tk backend
fariza May 6, 2014
217098a
pep8
fariza May 6, 2014
f07dfb2
example working with Tk
fariza May 6, 2014
0009c56
cleanup
fariza May 7, 2014
68ae62d
duplicate code in keymap tool initialization
fariza Jul 24, 2014
2bf3398
grammar corrections
fariza Jul 24, 2014
23f1c58
moving views and positions to tools
fariza Jul 24, 2014
4c91ac9
The views positions mixin automatically adds the clear as axobserver
fariza Jul 25, 2014
f0081c7
bug when navigation was not defined
fariza Jul 25, 2014
84e7a48
Small refactor so that we first initiate the Navigation (ToolManager)…
OceanWolf Jul 28, 2014
107b43f
Update for Sphinx documentation
OceanWolf Jul 28, 2014
53b62af
Moved default_tool initilisation to FigureManagerBase and cleaned.
OceanWolf Jul 29, 2014
0ecd61a
Fix navigation
OceanWolf Jul 29, 2014
7ec5159
Temporary fix to backends
OceanWolf Jul 29, 2014
25656f7
removing persistent tools
fariza Sep 3, 2014
f07b3e1
removing unregister
fariza Sep 4, 2014
f60b26c
change cursor inmediately after toggle
fariza Sep 5, 2014
e482cf8
removing intoolbar
fariza Oct 15, 2014
d883382
events working
fariza Oct 16, 2014
e9e942d
using pydispatch
fariza Oct 17, 2014
fcabd20
using navigation as signal handler
fariza Oct 20, 2014
86e2830
removing view positions singleton
fariza Oct 20, 2014
a084cb5
moving set_cursor completely out of navigation
fariza Oct 27, 2014
f21f185
cleanup doc
fariza Oct 30, 2014
d66d8ca
pep8 error
fariza Oct 30, 2014
18b4fec
unused import
fariza Oct 31, 2014
316d266
removing unused event class
fariza Nov 10, 2014
796d4ed
underscore in tool_trigger-xxx
fariza Nov 10, 2014
30811ba
adding radio_group for toggle tools
fariza Nov 14, 2014
6b8cf3f
scroll to zoom in zoom/pan tools
fariza Nov 28, 2014
d7d58b8
remove print
fariza Nov 28, 2014
c6169ba
remove ToolAddedEvent incorporating the functionality into toolevent
fariza Dec 5, 2014
b0dc0df
Spelling mistakes, and general tidying up of sentences.
OceanWolf Jan 3, 2015
789b48b
eliminating repeated loop
fariza Jan 5, 2015
85bda68
doc bullet list
fariza Jan 5, 2015
0d39c2d
end single quote missing
fariza Jan 5, 2015
d695dd2
replace draw by draw_idle in tools
fariza Jan 21, 2015
7ccb6c2
rename mpl_connect
fariza Jan 21, 2015
c46d6d6
unused attribute example
fariza Jan 28, 2015
aa76457
cleaning navigation and toolbar dependencies
fariza Feb 4, 2015
91d2f51
Made NavigationBase.get_tool() more useful.
OceanWolf Feb 11, 2015
0515bdb
Merge pull request #9 from OceanWolf/navigation-by-events-get-tool
fariza Feb 11, 2015
bf52f50
Moved tooltriggerevents into the tool.
OceanWolf Feb 7, 2015
ea62857
Changed name of event from `tool_state_changed` to `tool_triggered`
OceanWolf Feb 10, 2015
827b006
Moved event firing to source, i.e. to the trigger method. Now one mu…
OceanWolf Feb 10, 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
8 changes: 8 additions & 0 deletions doc/api/backend_tools_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

:mod:`matplotlib.backend_tools`
================================

.. automodule:: matplotlib.backend_tools
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions doc/api/index_backend_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ backends
.. toctree::

backend_bases_api.rst
backend_tools_api.rst
backend_gtkagg_api.rst
backend_qt4agg_api.rst
backend_wxagg_api.rst
Expand Down
63 changes: 63 additions & 0 deletions examples/user_interfaces/navigation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import matplotlib
matplotlib.use('GTK3Cairo')
# matplotlib.use('TkAGG')
matplotlib.rcParams['toolbar'] = 'navigation'
import matplotlib.pyplot as plt
from matplotlib.backend_tools import ToolBase


# Create a simple tool to list all the tools
class ListTools(ToolBase):
# keyboard shortcut
keymap = 'm'
description = 'List Tools'

def trigger(self, *args, **kwargs):
print('_' * 80)
print("{0:12} {1:45} {2}".format('Name (id)',
'Tool description',
'Keymap'))
print('-' * 80)
tools = self.navigation.tools
for name in sorted(tools.keys()):
if not tools[name].description:
continue
keys = ', '.join(sorted(self.navigation.get_tool_keymap(name)))
print("{0:12} {1:45} {2}".format(name,
tools[name].description,
keys))
print('_' * 80)
print("Active Toggle tools")
print("{0:12} {1:45}").format("Group", "Active")
print('-' * 80)
for group, active in self.navigation.active_toggle.items():
print("{0:12} {1:45}").format(group, active)


# A simple example of copy canvas
# ref: at https://github.com/matplotlib/matplotlib/issues/1987
class CopyToolGTK3(ToolBase):
keymap = 'ctrl+c'
description = 'Copy canvas'

def trigger(self, *args, **kwargs):
from gi.repository import Gtk, Gdk
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
window = self.figure.canvas.get_window()
x, y, width, height = window.get_geometry()
pb = Gdk.pixbuf_get_from_window(window, x, y, width, height)
clipboard.set_image(pb)


fig = plt.figure()
plt.plot([1, 2, 3])

# Add the custom tools that we created
fig.canvas.manager.navigation.add_tool('List', ListTools)
if matplotlib.rcParams['backend'] == 'GTK3Cairo':
fig.canvas.manager.navigation.add_tool('copy', CopyToolGTK3)

# Uncomment to remove the forward button
# fig.canvas.manager.navigation.remove_tool('forward')

plt.show()
Loading