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

Fixing the problem #296

Merged
merged 8 commits into from
Jan 18, 2024
Merged

Fixing the problem #296

merged 8 commits into from
Jan 18, 2024

Conversation

Cryaaa
Copy link
Collaborator

@Cryaaa Cryaaa commented Jan 15, 2024

This PR fixes #295. I do a quick check which layers have properties or features attached to them and we select the first one in the layer list.

@haesleinhuepf
Copy link
Member

haesleinhuepf commented Jan 15, 2024

Thanks for the quick fix @Cryaaa ! Would it be possible to select the layer that is currently active in napari instead? That would go in line with the suggestion in #295 and is the same behaviour as in the napari-assistant for example.

@Cryaaa
Copy link
Collaborator Author

Cryaaa commented Jan 15, 2024

Thanks for the quick fix @Cryaaa ! Would it be possible to select the layer that is currently active in napari instead? That would go in line with the suggestion in #295 and is the same behaviour as in the napari-assistant for example.

Sure thats also a nice option and might require less code and avoid those errors popping up

Copy link

codecov bot commented Jan 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (eca8459) 77.30% compared to head (fe55380) 77.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #296      +/-   ##
==========================================
+ Coverage   77.30%   77.32%   +0.02%     
==========================================
  Files          16       16              
  Lines        1899     1901       +2     
==========================================
+ Hits         1468     1470       +2     
  Misses        431      431              

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

@@ -67,6 +67,9 @@ def layer_container_and_selection():
layer_select = create_widget(annotation=Layer, label="layer")
layer_selection_container.layout().addWidget(layer_select.native)

if viewer is not None and viewer.layers.selection.active is not None:
layer_select.value = viewer.layers.selection.active
Copy link
Member

Choose a reason for hiding this comment

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

I'm speculating this crashes when two layers are selected in napari?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tested this and at the moment when you select two layers the selection.active returns none. I’m guessing that might change some time in the future though but I’m not sure

@Cryaaa Cryaaa merged commit a49c6a7 into main Jan 18, 2024
8 checks passed
@Cryaaa Cryaaa deleted the Fixing-Layer-Dropdown-Preselection branch January 23, 2024 14:04
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.

[pre-]selected layer is an image layer with no properties
2 participants