-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Move layer editable change from slicing to controls #5546
Conversation
@@ -148,7 +148,7 @@ def _add(self, event): | |||
""" | |||
layer = event.value | |||
controls = create_qt_layer_controls(layer) | |||
controls.ndisplay = 3 |
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.
I have no idea why I set this to 3 specifically in #5491...
@jni : we discussed this in the recent architecture working group meeting, so I assigned you to review. Let me know if you want someone else to take a look instead or in addition. |
Codecov Report
@@ Coverage Diff @@
## main #5546 +/- ##
==========================================
+ Coverage 89.36% 89.37% +0.01%
==========================================
Files 608 608
Lines 51098 51109 +11
==========================================
+ Hits 45663 45679 +16
+ Misses 5435 5430 -5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
This makes a lot of sense to me, thanks @andy-sweet!
Thanks for the quick review! I'll merge this shortly after the weekend unless there are any objections. |
Description
This moves some side-effects of changing the display dimensionality from
Layer._slice_dims
to the layer controls. This means the side-effects typically only occur in the full viewer.Alternatively, we could consider connecting
Dims.ndisplay
to this side-effect inViewerModel
, so that a more standard headless napari would see the same behavior.A further alternative is to not have the side-effect on
Layer.editable
and instead just update the layer control editable buttons' enabled state directly.Motivation
This is partially motivated by the async slicing/loading work (#4795) because it makes
Layer._slice_dims
almost identical toLayer.refresh
, except that_slice_dims
may still sometimes return early. More specifically, it would allow us to simplify the sync default/fallback option when integrating async slicing.One upside is that the tests exercise some public API (even if it's part of napari's Qt/GUI code), rather than calling a private method as their main action.