Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Feature/nested sub menus in action manager - #117

Merged
seb5g merged 12 commits into
PyMoDAQ:5.0.x_devfrom
Ashwolaa:feature/nested_sub_menus_in_action_manager
Oct 28, 2025
Merged

seb5g merged 12 commits into
PyMoDAQ:5.0.x_devfrom
Ashwolaa:feature/nested_sub_menus_in_action_manager

Conversation

@Ashwolaa

Copy link
Copy Markdown
Contributor

Context:
Action manager is very useful and versatile to easily manage QActions and add them to menu/toolbar.
However, it does not necessarily handle well submenus for now making the construction of more complex QMenu quite cumbersome.

In this PR:
We extend Action Manager capabilities by adding the _submenus dict.
This permits to easily store new submenus, attach them to menus and to benefit from the ActionManager methods function.
A little example can be found in examples/action_manager_nested_menu.py

action_manager_menu.mp4

@codecov

codecov Bot commented Oct 28, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.15068% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.26%. Comparing base (c66d469) to head (3f976ae).
⚠️ Report is 24 commits behind head on 5.0.x_dev.

Files with missing lines Patch % Lines
src/pymodaq_gui/managers/action_manager.py 94.44% 4 Missing ⚠️
src/pymodaq_gui/utils/custom_app.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           5.0.x_dev     #117      +/-   ##
=============================================
+ Coverage      63.66%   64.26%   +0.60%     
=============================================
  Files             74       73       -1     
  Lines           9077     9132      +55     
=============================================
+ Hits            5779     5869      +90     
+ Misses          3298     3263      -35     

☔ 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.

@seb5g seb5g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why doing things differently on main menu and submenu can we not just consider on only menu argument/dict...

Also by introducing this I guess the setup_menu in custom_app start to be superfluous?

Comment thread src/pymodaq_gui/managers/action_manager.py Outdated
@Ashwolaa

Copy link
Copy Markdown
Contributor Author

why doing things differently on main menu and submenu can we not just consider on only menu argument/dict...

There was no reason, I did not want first to touch self._menu but using arg/dict is much better and smoother.
I added a similar mechanism for the toolbars.
The "_default" key would be equivalent to the previous implementation and is the one called when using self._menu / self._toolbar.

Also by introducing this I guess the setup_menu in custom_app start to be superfluous?

I agree, in fact I started to look at it by considering that the ConfigManager could inherit from the ActionManager and build its own QMenu. One can think of standardized QActions for examples, New/Edit/Duplicate/Load/Delete/Open Config folder/ ...).
Then the dashboard would just add to his own QMenuBar, the QMenu created by the ConfigManager.
With this approach, we can more easily connect the available actions with their relevant manager.

@Ashwolaa
Ashwolaa requested a review from seb5g October 28, 2025 15:32

@seb5g seb5g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it looks quite nice and neat!

@seb5g
seb5g merged commit b25a9b4 into PyMoDAQ:5.0.x_dev Oct 28, 2025
19 of 28 checks passed
seb5g added a commit that referenced this pull request Oct 28, 2025
apply add_widget also to toolbar specified using str (missing in #117)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants