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

support exporting a plot from an unopened/inactive plugin #2934

Merged
merged 4 commits into from
Jul 11, 2024

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Jul 2, 2024

Description

This pull request fixes the case of exporting the stretch histogram from the export plugin before the plot options plugin has ever been opened. It does so by implementing an optional callback on the Plot object itself to call a plugin method to update itself, which will be called if the "parent" plugin is not considered active. In cases where no widget exists because the parent plugin has never been opened, it also renders the widget offscreen in the export plugin.

I'm not really sure the best way to test this since the previous behavior didn't result in errors, just a blank image - but open to any suggestions!

Change log entry

  • Is a change log needed? If yes, is it added to CHANGES.rst? If you want to avoid merge conflicts,
    list the proposed change log here for review and add to CHANGES.rst before merge. If no, maintainer
    should add a no-changelog-entry-needed label.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@kecnry kecnry added this to the 3.10.3 milestone Jul 2, 2024
@github-actions github-actions bot added the plugin Label for plugins common to multiple configurations label Jul 2, 2024
@kecnry kecnry added the bug Something isn't working label Jul 2, 2024
@kecnry kecnry force-pushed the export-plot-inactive-plugin branch from 64c23be to d1f0915 Compare July 2, 2024 12:32
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.79%. Comparing base (0d7684a) to head (b89689a).
Report is 158 commits behind head on main.

Files with missing lines Patch % Lines
jdaviz/core/template_mixin.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2934   +/-   ##
=======================================
  Coverage   88.79%   88.79%           
=======================================
  Files         111      111           
  Lines       17236    17245    +9     
=======================================
+ Hits        15305    15313    +8     
- Misses       1931     1932    +1     

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

@kecnry kecnry marked this pull request as ready for review July 2, 2024 12:56
@kecnry kecnry mentioned this pull request Jul 2, 2024
12 tasks
@kecnry kecnry marked this pull request as draft July 2, 2024 15:10
@kecnry kecnry marked this pull request as ready for review July 2, 2024 16:52
@kecnry kecnry added the 💤backport-v3.10.x on-merge: backport to v3.10.x label Jul 3, 2024
Copy link
Contributor

@gibsongreen gibsongreen left a comment

Choose a reason for hiding this comment

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

Great work, everything looks good to me and this is working really well!

@rosteen
Copy link
Collaborator

rosteen commented Jul 8, 2024

Hmm, it looks like this saved something for the histogram, but I don't think the saved plot is correct. It saved out this image:

[Deleted the images]

Edit: Actually, I tried again and it worked the second time - maybe I hadn't restarted the kernel properly after checking out this branch. Now the only surprise to me is that it didn't give me an Overwrite warning the second time I ran it 🤔

Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

This improves the current behavior, so I'm approving. I did notice that the plot as rendered by this PR doesn't have the line indicating the stretch scaling, but I don't know how big a deal that is - we may want to address it later, but if you want to address it now I can re-review.

* when the plot was being updated, a plot update message was being sent when clearing the old data, briefly resetting the choices to an empty list, which cleared the selection.  The broadcast now is not duplicated and so the choices remains intact
@kecnry
Copy link
Member Author

kecnry commented Jul 9, 2024

Now the only surprise to me is that it didn't give me an Overwrite warning the second time I ran it

This is a separate ticket 🐱

I did notice that the plot as rendered by this PR doesn't have the line indicating the stretch scaling

Is it possible that they're just outside the default x-limits?

@kecnry kecnry force-pushed the export-plot-inactive-plugin branch from 6e8d435 to b89689a Compare July 9, 2024 12:14
@kecnry
Copy link
Member Author

kecnry commented Jul 9, 2024

It also seems that sometimes on first attempt, this is still failing and clearing the selection - I'm looking into seeing if that is an easy fix now

@kecnry kecnry marked this pull request as draft July 9, 2024 16:45
@kecnry kecnry marked this pull request as ready for review July 11, 2024 13:36
@kecnry
Copy link
Member Author

kecnry commented Jul 11, 2024

I'm going to go ahead and merge this as-is since it fixes the reported bug and should get in. If we keep running into the "selection clearing" bug (which definitely happens less with this PR than without it), that can be investigated and fixed as a follow-up.

@kecnry kecnry merged commit 18bb83e into spacetelescope:main Jul 11, 2024
19 checks passed
Copy link

lumberbot-app bot commented Jul 11, 2024

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.10.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 18bb83ea78efff030e77f58bb99d5beba7f400ce
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #2934: support exporting a plot from an unopened/inactive plugin'
  1. Push to a named branch:
git push YOURFORK v3.10.x:auto-backport-of-pr-2934-on-v3.10.x
  1. Create a PR against branch v3.10.x, I would have named this PR:

"Backport PR #2934 on branch v3.10.x (support exporting a plot from an unopened/inactive plugin)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@kecnry kecnry deleted the export-plot-inactive-plugin branch July 11, 2024 13:36
kecnry added a commit to kecnry/jdaviz that referenced this pull request Jul 11, 2024
…cope#2934)

* support exporting a plot from an unopened/inactive plugin
* prevent clearing plot selection (under most conditions)
@kecnry kecnry mentioned this pull request Jul 11, 2024
kecnry added a commit that referenced this pull request Jul 11, 2024
)

* support exporting a plot from an unopened/inactive plugin
* prevent clearing plot selection (under most conditions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin Label for plugins common to multiple configurations Ready for final review 💤backport-v3.10.x on-merge: backport to v3.10.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants