-
Notifications
You must be signed in to change notification settings - Fork 153
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
Add functionality for moving viewers between tabs #2387
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9dd2425
Allow moving viewers between tabs.
Carifio24 8272176
Add test for moving viewer between tabs.
Carifio24 34ffdbe
Add moving functionality to UI as a subtool of a new 'window' tool menu.
Carifio24 9c1c4fe
Test that viewer state is preserved when moving between tabs.
Carifio24 d703d7c
If there are multiple tabs, have default move tool choice not be curr…
Carifio24 02289c8
Prevent moved viewers from getting progressively smaller.
Carifio24 fde4e3b
Fix a typo in the tab count check.
Carifio24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you test that viewer state is preserved when moving it between tabs?
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.
@astrofrog I've added in that check