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

clone viewer tool #74

Merged
merged 3 commits into from
Dec 18, 2023
Merged

clone viewer tool #74

merged 3 commits into from
Dec 18, 2023

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Dec 13, 2023

This PR implements a toolbar tool capable of cloning the current viewer (keeping axes limits, data loaded/visible, and plot options - except for bug noted below) in a way that still works seemlessly with the ephemeris plugin.

Screen.Recording.2023-12-12.at.2.03.09.PM.mov
Screen.Recording.2023-12-12.at.2.05.09.PM.mov

NOTE: known bug with layer options reverting when adding to any new viewer (was not introduced here, but this definitely exposes it more readily)

TODO:

  • test coverage
  • custom icon (could be deferred)
  • consider whether this would be moved upstream
  • consider exposing in viewer API (will be easier once/if moved upstream)

Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (a4eaea7) 95.04% compared to head (6f223f4) 95.10%.

Files Patch % Lines
lcviz/tools.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #74      +/-   ##
==========================================
+ Coverage   95.04%   95.10%   +0.06%     
==========================================
  Files          32       32              
  Lines        1393     1431      +38     
==========================================
+ Hits         1324     1361      +37     
- Misses         69       70       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

* NOTE: known bug with layer options reverting when adding to any new viewer (was not introduced here, but this definitely exposes it more readily)
@kecnry kecnry marked this pull request as ready for review December 14, 2023 17:37
@kecnry kecnry requested a review from bmorris3 December 14, 2023 17:37
Copy link
Contributor

@bmorris3 bmorris3 left a comment

Choose a reason for hiding this comment

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

This works great. LGTM.

CHANGES.rst Outdated Show resolved Hide resolved
@@ -308,7 +308,8 @@ def vue_period_double(self, *args):
self.period *= 2

def _check_if_phase_viewer_exists(self, *args):
self.phase_viewer_exists = self.phase_viewer_id in self.app.get_viewer_ids()
viewer_base_refs = [id.split('[')[0] for id in self.app.get_viewer_ids()]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm OK with assuming there aren't other square brackets in the viewer ID. Just leaving a comment here to hopefully remind us both that, going forward, we're assuming that.

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, this is very much assuming we always stick to these syntax rules... but if we ever want viewer renaming, we can always move these things into attributes rather than parsing the viewer name itself, I just don't want to overengineer it until then.

@kecnry kecnry merged commit e2609ff into spacetelescope:main Dec 18, 2023
11 checks passed
@kecnry kecnry deleted the clone-viewer-tool branch December 18, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants