Add user-defined Menus#3137
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a dynamic menu registration system allowing plugins to register custom menus and callbacks. It adds a Python-side registry (MeshroomMenuManager) and dynamically instantiates these menus in the QML UI using a new UserMenu component. The review feedback highlights several critical and medium-severity issues: a missing import of importlib.util that will cause a runtime error, a potential IndexError in exception handling, shadowing of the built-in type function, potential duplicate initialization side-effects, test pollution risks due to mutable class-level registries, an incorrect callback instantiation in the docstring example, and a lack of defensive checks for dynamic QML object creation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3137 +/- ##
===========================================
- Coverage 86.07% 86.00% -0.08%
===========================================
Files 78 78
Lines 12111 12130 +19
===========================================
+ Hits 10425 10432 +7
- Misses 1686 1698 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a2743d0 to
c7ddb0b
Compare
3fe422e to
c522c09
Compare
c522c09 to
8dd869f
Compare
fabiencastan
left a comment
There was a problem hiding this comment.
Do not create an API module.
87da141 to
9cccdba
Compare
9cccdba to
fe4eee5
Compare
fe4eee5 to
b2d5c8d
Compare
Description
New feature to add user-defined menus.

Features
MeshroomAppinstance so that we can access the node graphname: namelabel: display label (nameby default)icon: for menu entry and buttonstooltip: display detailed message about the entryshortcut: shortcut to call the entryindex: insert index (by default last one)menu.pyscript in themeshroomfolder of plugins to load menus.How the API looks
Another example with a radio button :
Details
Here's how the code is organized. I ordered every file by logical order so you can review from the first to last file here :
core/core/menu.py: Define the Menu, MenuItem, MeshroomMenuManager, etc. All the objects used in the rest of the code, specific to a menu. Also build the list model for the QML part.core.__init__.py: Add aloadPluginMenufunction to find menus on plugins when launching Meshroom.api/api/menu.pygives a top-level access to a register function. This is what should be used in pluginsapi/__init__.pycreates redirections to every useful class/function to create menus in plugins. That way every import should be :ui/ui/app.py: set the menu manager as a context property to access it in QMLui/qml/Controls/userMenu.qml: define the menu and components for every instanciable widgetui/qml/Application.qml: Add Instantiator using the menu model.