8000 Fix broken dims order popup and add to 3D by TimMonko · Pull Request #7937 · napari/napari · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix broken dims order popup and add to 3D #7937

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

Merged
merged 4 commits into from
May 18, 2025
Merged

Conversation

TimMonko
Copy link
Contributor
@TimMonko TimMonko commented May 16, 2025

References and relevant issues

Closes #7916
Fixes #7928 (review)
Based on discussion in #7928

Description

  1. Adds dim slider popup to 3D
  2. Properly connects events to new axis list created whens dims are reorder -- this fixes the currently broken behavior
  3. Updates dims button help text to hint at renaming possibility.
  4. Adds tests that fail on main (due to it being broken) that pass properly with this PR

python_NhhdFfnirX

@github-actions github-actions bot added tests Something related to our tests qt Relates to qt labels May 16, 2025
@TimMonko
Copy link
Contributor Author

@psobolewskiPhD yay renaming! yay 3D!❤️
@jni bug fixed! ❤️

Copy link
codecov bot commented May 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.92%. Comparing base (c6c7132) to head (6c93bc3).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7937      +/-   ##
==========================================
+ Coverage   92.90%   92.92%   +0.02%     
==========================================
  Files         643      643              
  Lines       60673    60679       +6     
==========================================
+ Hits        56369    56388      +19     
+ Misses       4304     4291      -13     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -85,3 +87,6 @@ def _dims_order_callback(self, event):
# Regenerate AxisList upon Dims side order changes for easy cleanup
self.axis_list = AxisList.from_dims(self.dims)
Copy link
Member
@psobolewskiPhD psobolewskiPhD May 16, 2025

Choose a reason for hiding this comment

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

Just so I am understanding: when self.axis_list is regenerated here, the callback created in line 74/76 above is destroyed and isn't recreated, right?
So that's why after you change the order it fails to work.
But if you exist out and re-open, we run the init which makes a new self.axis_list and creates the callback.
So basically swapping works for one shot with a given QtDimsSorter currently and this makes it work multiple times per Sorter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bam! You got it. The axis_list is overwritten, so the event is destroyed (or at least stale, I don't actually know enough about the technicals of Python to know if its totally gone, but I would think so). This test addition reveals that (in a non-intuitive way)

https://github.com/TimMonko/napari/blob/6c93bc35bb2d47a4a1590dd86789a28b9dbf93c7/napari/_qt/widgets/_tests/test_qt_dims_sorter.py#L39-L43

On main, the len(... .callbacks) == 1 instead of 2.

I don't also know if this is 'technically' the correct implementation (something feels weird about it), but it does re-add the destroyed event to the new axis_list, which is what we needed

Copy link
Member

Choose a reason for hiding this comment

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

thanks for the explanation.
I did some checking locally and never got more than 2 callbacks so it seems to be behaving as intended.

@psobolewskiPhD
Copy link
Member

I made a docs PR with a tip about the renaming: napari/docs#709

@TimMonko TimMonko added this to the 0.6.1 milestone May 17, 2025
@TimMonko TimMonko added ready to merge Last chance for comments! Will be merged in ~24h bugfix PR with bugfix enhancement labels May 18, 2025
@TimMonko TimMonko merged commit 66fe430 into napari:main May 18, 2025
51 of 52 checks passed
@github-actions github-actions bot removed the ready to merge Last chance for comments! Will be merged in ~24h label May 18, 2025
@TimMonko
Copy link
Contributor Author

For release notes

python_4z6iHUqRrN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix PR with bugfix enhancement qt Relates to qt tests Something related to our tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UI] Tick mark on axis order button shown in 3D, but no menu shows
2 participants
0