Skip to content
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

Remove back and forward buttons from viewer toolbars #1505

Merged
merged 2 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ v0.13.0 (unreleased)
precision required given the separation of world coordinate values.
[#1500]

* Remove back/forward tools in Matplotlib viewer toolbars to
declutter. [#1505]

* Added a new component manager that makes it possible to rename,
reorder, and remove components, as well as better manage derived
components, including editing previous equations. [#1479]
Expand Down
4 changes: 0 additions & 4 deletions glue/viewers/matplotlib/qt/tests/test_toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ def test_change_mode(self):
assert self.viewer.toolbar.active_tool.tool_id == 'mpl:zoom'
assert self.viewer.toolbar._mpl_nav.mode == 'zoom rect'

self.viewer.toolbar.actions['mpl:back'].trigger()
assert self.viewer.toolbar.active_tool is None
assert self.viewer.toolbar._mpl_nav.mode == ''

self.viewer.toolbar.actions['test'].trigger()
assert self.viewer.toolbar.active_tool.tool_id == 'test'
assert self.viewer.toolbar._mpl_nav.mode == ''
37 changes: 1 addition & 36 deletions glue/viewers/matplotlib/qt/toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
else:
from matplotlib.backends.backend_qt4 import NavigationToolbar2QT

__all__ = ['HomeTool', 'SaveTool', 'BackTool', 'ForwardTool', 'PanTool',
'ZoomTool', 'MatplotlibViewerToolbar']
__all__ = ['HomeTool', 'SaveTool', 'PanTool', 'ZoomTool', 'MatplotlibViewerToolbar']


class HomeTool(Tool):
Expand Down Expand Up @@ -51,34 +50,6 @@ def activate(self):
self.toolbar.save_figure()


class BackTool(Tool):

def __init__(self, viewer, toolbar=None):
super(BackTool, self).__init__(viewer=viewer)
self.tool_id = 'mpl:back'
self.icon = get_icon('glue_back')
self.action_text = 'Back'
self.tool_tip = 'Back to previous view'
self.toolbar = toolbar

def activate(self):
self.toolbar.back()


class ForwardTool(Tool):

def __init__(self, viewer, toolbar=None):
super(ForwardTool, self).__init__(viewer=viewer)
self.tool_id = 'mpl:forward'
self.icon = get_icon('glue_forward')
self.action_text = 'Forward'
self.tool_tip = 'Forward to next view'
self.toolbar = toolbar

def activate(self):
self.toolbar.forward()


class PanTool(CheckableTool):

def __init__(self, viewer, toolbar=None):
Expand Down Expand Up @@ -147,12 +118,6 @@ def setup_default_modes(self):
save_mode = SaveTool(self.parent(), toolbar=self._mpl_nav)
self.add_tool(save_mode)

back_mode = BackTool(self.parent(), toolbar=self._mpl_nav)
self.add_tool(back_mode)

forward_mode = ForwardTool(self.parent(), toolbar=self._mpl_nav)
self.add_tool(forward_mode)

pan_mode = PanTool(self.parent(), toolbar=self._mpl_nav)
self.add_tool(pan_mode)

Expand Down