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

Allow selection after projection has been changed #2262

Merged
merged 3 commits into from
Jan 26, 2022

Conversation

Carifio24
Copy link
Member

Currently, in the scatter viewer, as soon as one changes the projection of the viewer, the selection tools no longer work for that viewer. This effect is independent of both the initial and final projections in the change.

The reason for this is here. When the projection is updated, the axes property of the viewer is updated with the axes for the new projection. However, the toolbar items, and any associated ROI tools, are still referencing the original viewer axes. This stale reference causes the selection tools to no longer work.

This PR fixes the issue by adding remove_toolbar and remove_all_toolbars methods to the Qt DataViewer class, and using these to remove and recreate the toolbar when the scatter projection is changed. I don't believe there are any other viewers that can change axes, but if there are, they will require the same type of update.

The alternative to this would be to update the reference to the axes in each toolbar item/ROI tool as appropriate, but this fix seems more straightforward to me.

…is changed to account for the fact that the axis reference in tools and ROIs has gone stale.
@codecov
Copy link

codecov bot commented Jan 21, 2022

Codecov Report

Merging #2262 (fb13f2b) into main (a89a3dd) will increase coverage by 0.06%.
The diff coverage is 100.00%.

❗ Current head fb13f2b differs from pull request most recent head d56a177. Consider uploading reports for the commit d56a177 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2262      +/-   ##
==========================================
+ Coverage   88.00%   88.07%   +0.06%     
==========================================
  Files         247      247              
  Lines       23165    23165              
==========================================
+ Hits        20386    20402      +16     
+ Misses       2779     2763      -16     
Impacted Files Coverage Δ
glue/viewers/common/qt/data_viewer.py 96.89% <100.00%> (+0.17%) ⬆️
glue/viewers/scatter/viewer.py 97.00% <100.00%> (-1.92%) ⬇️
glue/core/roi.py 91.92% <0.00%> (+0.23%) ⬆️
glue/utils/qt/helpers.py 55.05% <0.00%> (+1.12%) ⬆️
glue/conftest.py 54.54% <0.00%> (+1.51%) ⬆️
glue/utils/qt/app.py 96.00% <0.00%> (+2.00%) ⬆️
glue/dialogs/data_wizard/qt/data_wizard_dialog.py 93.90% <0.00%> (+2.43%) ⬆️
glue/_mpl_backend.py 88.00% <0.00%> (+8.00%) ⬆️
glue/core/roi_pretransforms.py 100.00% <0.00%> (+23.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efe0aac...d56a177. Read the comment docs.

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Looks good! Can you add a changelog entry?

@Carifio24
Copy link
Member Author

Added the changelog entry

@astrofrog astrofrog merged commit f97afec into glue-viz:main Jan 26, 2022
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