-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2387 from Carifio24/move-viewer
Add functionality for moving viewers between tabs
- Loading branch information
Showing
6 changed files
with
95 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import tools # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from glue.config import viewer_tool | ||
from glue.utils.qt import pick_item | ||
from glue.viewers.common.tool import Tool, SimpleToolMenu | ||
|
||
__all__ = ['MoveTabTool', 'WindowTool'] | ||
|
||
|
||
@viewer_tool | ||
class WindowTool(SimpleToolMenu): | ||
""" | ||
A generic "window operations" tool that the Qt app and plugins | ||
can register tools for windowing operations with. | ||
""" | ||
|
||
tool_id = 'window' | ||
icon = 'windows' | ||
tool_tip = 'Modify the viewer window' | ||
|
||
|
||
@viewer_tool | ||
class MoveTabTool(Tool): | ||
|
||
icon = 'windows' | ||
tool_id = 'window:movetab' | ||
action_text = 'Move to another tab' | ||
tool_tip = 'Move viewer to another tab' | ||
|
||
def activate(self): | ||
app = self.viewer.session.application | ||
default = 1 if (app.tab_count > 1 and app.current_tab == app.tab(0)) else 0 | ||
tab = pick_item(range(app.tab_count), app.tab_names, title="Move Viewer", label="Select a tab", default=default) | ||
if tab is not None: | ||
app.move_viewer_to_tab(self.viewer, tab) |