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
Add NAP-6 - Proposal for contributable menus #77
Conversation
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.
Great work @DragaDoncila! As usual, approving to get this in quickly, so we can iterate via further PRs. I left a few comments, but feel free to address them in a later PR.
Also, not sure why, but I don't see this in the artifact... Maybe some other file needs to be updated?
And a general point about the napari.yaml
: from the small piece you provided, it looks a bit unwieldy even with just 2 menu contributions. Are there plans to make this a bit more ergonomic? For example, a command could just have another field called tags
and we could use those to populate menus accordingly... I feel like I saw discussions about this before, but maybe I'm wrong?
1. `Visualization` - Items in this submenu allow you to generate visualizations from selected layer or layers. | ||
They do not change the layer data. | ||
2. `Measure` - Items in this submenu provide utilities for summarising information about your layer's data. |
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.
What are the expected inputs/outputs for Visualisation
and Measure
?
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 think these menus are the hardest to categorize based on input/output.
For Visualization
I can imagine a widget that adds a new layer that provides a different "view" on the data. Mostly I was thinking of stuff like filtering what data is being shown in the current layer, auto adjustment of brightness/contrast, tools for quickly assigning/swapping preset colormaps... In general I think of it as "changing the way the layer is displayed in the viewer without changing the data of the layer".
Measure
I think would typically contain items that generate text/summary output based on the layer, generate a new layer with information about the data (e.g. @psobolewskiPhD was mentioning he draws lines on Shapes
layers to measure distances in Image
layers or something like that - this would go here) or produce plots/figures about the layer data e.g. histograms, intensity plots, derived features, etc.
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.
For Visualization I can imagine a widget that adds a new layer that provides a different "view" on the data. Mostly I was thinking of stuff like filtering what data is being shown in the current layer, auto adjustment of brightness/contrast, tools for quickly assigning/swapping preset colormaps... In general I think of it as "changing the way the layer is displayed in the viewer without changing the data of the layer".
This feels like a combination of Generate
and Edit
to me, though.
Measure I think would typically contain items that generate text/summary output based on the layer, generate a new layer with information about the data (e.g. @psobolewskiPhD was mentioning he draws lines on Shapes layers to measure distances in Image layers or something like that - this would go here) or produce plots/figures about the layer data e.g. histograms, intensity plots, derived features, etc.
Makes sense!
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 feels like a combination of Generate and Edit to me, though.
Perhaps Generate
if we include adding new layers (which is debatable tbh I don't actually know of any widgets that do this I just could imagine they do) but definitely not Edit
- nothing in the Visualization
submenu should edit the data of your layer, it should always be non-destructive. It should only change how the layer is displayed. For example a widget that filters tracks displayed in a tracks layer based on certain properties shouldn't be deleting tracks from the data - just turning their visibility on and off.
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.
But due to how visualisation and data in napari are still coupled in the Layer
object, to change visualisation you have to edit the layer object. But I see what you mean, Edit
should only affect the data (and maybe features?), and Visualisation
only the rest.
With this in mind,Visualisation
says that it "generates" visualisations, but it sounds like you mean "change visualisation parameters"? But then what about something that creates a plot widget like napari-properties-plotter
? Shoudl that live in Measure
?
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.
But I see what you mean, Edit should only affect the data (and maybe features?), and Visualisation only the rest.
Yes, I do think there's a difference between the Layer
data & features (which I think are intrinsically coupled as fundamental attributes) and other Layer
attributes that determine visualization and other napari
specific features. It's probably worth us defining a clear line for this as we look towards user facing documentation.
With this in mind, Visualisation says that it "generates" visualisations, but it sounds like you mean "change visualisation parameters"
Yes I'd say the second is closer to a correct description of what I have in mind. I will update this. Thank you!
But then what about something that creates a plot widget like napari-properties-plotter? Shoudl that live in Measure?
I would say yes, as this is an auxiliary visualization, not changing the view of the layer itself.
### The `Acquisition` Menu | ||
|
||
In addition to the `Layers` menu, we add `Acquisition` as a top level menu. | ||
|
||
`Acquisition` will contain widgets and utilities for interfacing with microscopes and | ||
other types of cameras. |
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.
Shoudl this be inside I/O
rather than on its own? It feels a bit specific for a top level menu at the same level of as Layers
.
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.
disagree, these plugins are in a class of their own, doesn't feel like it fits in IO - I'm fine with top level
As a case study, we take four plugins offering between 9 and 14 widget contributions and arrange their widgets in these menus: | ||
`empanada-napari`, `napari-stracking`, `napari-mm3` and `napari-clemreg`. Where a plugin's widgets don't | ||
naturally fit into one of the proposed menus, they are left in the plugin's own submenu. | ||
Note that we have arranged these widgets purely based on title and cursory inspection of the documentation, | ||
so this should not be considered a concrete proposal for the structure of these plugins. |
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.
It would be nice to also see how the napari.yaml
would look like for these plugins. For example, it's not clear to me how exactly a plugin would opt for the plugin submenu versus the napari menus.
Also, should/can a plugin put a command in multiple places?
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.
For example, it's not clear to me how exactly a plugin would opt for the plugin submenu versus the napari menus.
This mechanism does not yet exist, nor does the mechanism for a plugin declaring submenus for its widgets menu. I will work with @nclack to see what that might look like and provide an example before we accept the NAP.
Also, should/can a plugin put a command in multiple places?
Plugins can do so currently. I do not personally believe they should - note I did not replicate widget contributions in the plugin's submenu in the example for that reason. I'm open to discussion on this, but I think given the command palette would always allow users to find everything a plugin offers, duplicating commands in menus would be confusing.
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.
Had a quick first pass - love it, thanks for the work here @DragaDoncila ! Minor comments, +1 to merging and iterating in followup
The goal of this NAP, therefore, is to provide a structured set of contributable menus | ||
that is easy to navigate, semantically organized and intuitive for both users and plugin developers. |
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.
❤️
### The `Acquisition` Menu | ||
|
||
In addition to the `Layers` menu, we add `Acquisition` as a top level menu. | ||
|
||
`Acquisition` will contain widgets and utilities for interfacing with microscopes and | ||
other types of cameras. |
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.
disagree, these plugins are in a class of their own, doesn't feel like it fits in IO - I'm fine with top level
├─ Visualization | ||
├─ Edit | ||
│ ├─ Annotation Tools | ||
│ ├─ Filter | ||
│ ├─ Transform | ||
├─ Measure | ||
├─ Generate | ||
│ ├─ Registration | ||
│ ├─ Projection | ||
│ ├─ Segmentation | ||
│ ├─ Tracks | ||
│ ├─ Classification |
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.
some grammatical inconsistencies here
should visualization become visualize? or should 'measure' become 'measurement'? I think I prefer the second
My immediate reaction to this list is that I don't know if I would intuitively look to 'layers -> generate' for registration/projection/segmentation/tracks/classification. Maybe I'm just not used to the mental model but 'measurement' feels at the same level as 'registration' or 'projection' for me
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.
some grammatical inconsistencies here
should visualization become visualize? or should 'measure' become 'measurement'? I think I prefer the second
Yeah I don't like it either lol. I initially had visualize
and then I changed it but I can't really remember why I changed it so it can't have been too compelling. I will change it back I think.
My immediate reaction to this list is that I don't know if I would intuitively look to 'layers -> generate' for registration/projection/segmentation/tracks/classification.
Yep, I can see that. Also I think someone would easily want to "generate" a transform, so the distinction isn't really meaningful. Initially I was thinking of it in terms of making clear to the user whether this will edit existing layer or add a new layer, but as I mention in the description, we can't guarantee that atm anyway with widgets. So I think that distinction should be made per plugin item once we have specific enough contributions to enforce it.
@alisterburt how would you feel about moving these items out to the top level Layers
menu? Would you worry that it is too long?
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 think registration/projection/segmentation/tracks/classification
can all be top level under Layers
. I agree that it wouldn't be super intuitive to find them under Layers -> Generate
.
Co-authored-by: alisterburt <alisterburt@gmail.com>
Thanks for working on this. Two days ago, I finally understood why I feel uncomfortable with deep menus. This pattern in the context of user interface design is the end of the XX century, maybe the first few years of the XXI century. You can look around and see that non of the easy-use and user-friendly software contains deep menus. But the motivation described in this NAP is real, and we cannot keep our eyes closed. So I prefer rather than name it "plugin menu contribution" but "structurize contributions by metadata". Even without such a change, I would like to add the |
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.
Thanks, @DragaDoncila ! Great stuff. I also think we should merge ASAP so we can begin iterating.
So I prefer rather than name it "plugin menu contribution" but "structurize contributions by metadata".
Even without such a change, I would like to add the description field to the manifest (for example, next to the command). Such a field could be used to provide users with better information about contributions and could be really useful with trying to implement a more modern interface. For example, command palette.
I think we can discuss this after merging, but I agree with @Czaki that we should consider if there are ways we can structure this such that the resulting annotations can be re-purposed later to organize other plugin access patterns (e.g., command pallette or other menu system).
Layers | ||
├─ Visualization | ||
├─ Edit | ||
│ ├─ Annotation Tools |
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.
│ ├─ Annotation Tools | |
│ ├─ Annotate |
I think this is more in line with the other Edit
items.
Also, I think we should bring Annotate
out to a top level Layers
menu (or even it's own category). I think annotation is a pretty commun napari use case and thus should be easy to access. Happy to merge now and discuss later though.
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.
Should Annotate
maybe be under the Edit menu vs. the Layer menu?
├─ Visualization | ||
├─ Edit | ||
│ ├─ Annotation Tools | ||
│ ├─ Filter | ||
│ ├─ Transform | ||
├─ Measure | ||
├─ Generate | ||
│ ├─ Registration | ||
│ ├─ Projection | ||
│ ├─ Segmentation | ||
│ ├─ Tracks | ||
│ ├─ Classification |
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 think registration/projection/segmentation/tracks/classification
can all be top level under Layers
. I agree that it wouldn't be super intuitive to find them under Layers -> Generate
.
I forgot to address the questions/decisions at the top:
I would say no, especially to avoid duplicated menus with slightly different names; we can always change that later, but viceversa is going to be hard.
My feeling is that this would hurt usability, cause it's not immediately clear where to find the thing you want, if you have multiple plugins. What would be awesome is if we could have little icons to represent a plugin visually, in order to make it immediately clear that a menu entry is from a specific plugin (but then give the full plugin name when you hover). Plugins could provide their own icon (which btw we could use in all sorts of places), but we could otherwise generate unique ones similarly to how github does with user icons.
I agree that the generate/edit distinction is very important. Do we have any plans to somehow enforce such distinction with widgets as well? Maybe hard to do enforce it, but at least we could ask plugin devs to declare what kind of widget it is?
Is
I'm not sure what it's supposed to be, actually. Literally
I like this!
Yeah, this sounds like what we were trying to avoid for |
Yep I tend to agree here. Replicating per-plugin submenus within these new menus would just replicate the issue we have with the current
I really like this idea! The manifest already has an
Yeah I can't think of a good way to enforce it. Because widgets can take the
I feel like
Basically, yes. A quick analysis of all widget contributions showed me about 10 widgets that perform some sort of tracking, so I gauged that was a significant enough number to warrant its own submenu, but I don't feel super strongly about it. If we don't have a |
But still, we could allow tool menu entries could be only function contributions that do not get But In general, the plugins should be able to get |
Ok, I'll merge so we don't hang on this for too long. As we've seen before, it's easier to discuss/review changes on follow-up PRs! |
Description
This PR proposes a set of contributable menus to expand the places where plugin developers can add
contributions.
The set of menus in this PR were generated based on existing discussion about the Tools menu, an analysis of a few current plugins with multiple widget contributions and some future thinking about new contribution types and napari objects.
There's a couple of things I still have questions about/haven't decided and I've summarized these here. Would appreciate as many eyes on this as we can get @napari/core-devs.
Questions/Decisions
Filter
,Transform
and the analysis options fromGenerate
to top levelLayers
menu. I didn't love this initially because it's not clear to the user whether the menu item edits existing layers or generates new ones. I feel like given we still only havewidget
contributions though, we can't enforce this anyway, so we may just want to move those out to the top level but group them under an "analysis" header or separator or something. Once we have new contribution types we can expose the edit vs. generate behavior a different way?Classification
is way too specific and we need a broader menu for postprocessing/anaylsis but I didn't know what to call it, so plz help.Layers -> New
which would hold both builtin new empty layer actions for each of our layer types and allow plugin developers to contribute actions that generate new layers with specific properties. I don't know how common this is so I left it out, but we may just want it for our own layer types too.Utilities
menu because it feels too broad and like a shortcut to a dumping ground.