https://bugs.kde.org/show_bug.cgi?id=423341
Bug ID: 423341 Summary: Add menu manipulation to Python API Product: krita Version: 4.2.9 Platform: MS Windows OS: Microsoft Windows Status: REPORTED Severity: normal Priority: NOR Component: Scripting Assignee: krita-bugs-n...@kde.org Reporter: adric.wor...@epicgames.com Target Milestone: --- It would be useful to scripters for the Python API to expose methods for manipulating the menuing system. There does not currently appear to be any way to create menus/submenus, limiting scripters' ability to organize registered actions. The method of adding actions listed in the extension documentation uses a string tag to place the item in a menu. This works only as long as the tags correspond to preexisting menus, and provides little direct control over the presentation and order of the resulting menu. Additionally, there appears to be some "special sauce" to how the menus are generated and populated that prevents vanilla PyQt methods from being a sufficient workaround. A new menu can be added to the menubar trivially with the following code: krita.Krita.instance().windows()[0].qwindow().menuBar().addMenu("My Menu") but the log viewer shows a warning "setMouseGrabEnabled: Not setting mouse grab for invisible window QWidgetWindow/'QMenuClassWindow'" when the new menu is clicked, and no menu items appear even when the menu exists before action creation and the action is registered with the appropriate placement tags for the hack-added menu. Also, if a new windows is created after hack-adding the menu, it is only visible on the instance where it was originally added; the new window will not have it. -- You are receiving this mail because: You are watching all bug changes.