Define submenus with their actions, remove submenus.py file#6848
Define submenus with their actions, remove submenus.py file#6848DragaDoncila merged 9 commits intonapari:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6848 +/- ##
==========================================
- Coverage 92.48% 92.43% -0.06%
==========================================
Files 612 611 -1
Lines 55153 55151 -2
==========================================
- Hits 51009 50977 -32
- Misses 4144 4174 +30 ☔ View full report in Codecov by Sentry. |
|
After discussing with @DragaDoncila, we think all the menu bar actions should be defined in one file in _qt - currently the only non-qt actions are some help menu actions that open a URL. Although these actions technically do not require QT as they are defined for the purpose of living in a menu, it should be considered a 'GUI' action. The only non-qt actions are the layer actions, which are not in the menubar. This resolves any previous conflict for this PR as I think submenus can live with their actions, as only one file will exist for each menubar menu. |
DragaDoncila
left a comment
There was a problem hiding this comment.
This looks good to me. If someone wants to add a new action they now should only need to edit one of these files in two spots right? Unless they're adding a brand new menubar menu? @jni do you prefer this?
2 spots only if they want to add a submenu as well. Only one spot if they are just adding an action. Note if the action is a method, you'd add/amend the method in the file where the class is defined and update the action file. But do like that we can see all the actions for a menu in one file, and its useful for checking how items are grouped inside the menu. |
|
The failing test does not seem to be related? I've re-run it.
|
|
merge conflict |
|
merge conflict resolved, cc @Czaki |
# References and relevant issues Closes #6744 Related: #6848 (comment) # Description Move all help actions to `_qt/` and remove lambdas and replace with partials.
|
Merged in main, which included removing the HELP menu actions from |
# Description As menu actions are all one file (see napari#6848 and napari#6883), update the file docstrings to remove mention of 'non-qt' actions.
) # References and relevant issues Towards napari#6516 # Description Remove `_submenus.py` file, in favour of defining them with their actions. I am not 100% happy with this though because some menu actions will have a qt-actions and non-qt-actions file, in which case it would be again confusing for the dev to guess where the submenus are defined. Luckily the 3 menus that do have submenus (layer, file and view) only have one action file. Note I have had to move submenu registration inside `init_qactions`. Not sure what to do here, open to suggestions and happy to close this as well. --------- Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
…416) # References and relevant issues Relates to napari/napari#6848 Depends on napari/napari#6743 # Description Updates the info on where actions live in the napari codebase. --------- Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
References and relevant issues
Towards #6516
Description
Remove
_submenus.pyfile, in favour of defining them with their actions.I am not 100% happy with this though because some menu actions will have a qt-actions and non-qt-actions file, in which case it would be again confusing for the dev to guess where the submenus are defined.
Luckily the 3 menus that do have submenus (layer, file and view) only have one action file.
Note I have had to move submenu registration inside
init_qactions.Not sure what to do here, open to suggestions and happy to close this as well.