Hello, as in the title, there is a way to specify the position of a menu item:
Using word, I want to place my menu after Macro (or maybe prior of Help).
For Toolbars, I want to place my toolbar prior of "Part tools" (this is the name of one of the Part WB toolbars).
In alternatives, there is some documentation or code to "study" to see how the things are placed.
I want to make this things, in Python.
Regards
Carlo D.
There is way to specify a "position" for a menu item and toolbars ?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
There is way to specify a "position" for a menu item and toolbars ?
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: There is way to specify a "position" for a menu item and toolbars ?
Nobody has some hint?
Regards
Carlo D.
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: There is way to specify a "position" for a menu item and toolbars ?
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: There is way to specify a "position" for a menu item and toolbars ?
mario52 wrote: ↑Sat May 28, 2022 9:32 am Hi
maybe study PersistentToolbars and Remember active workbench by tab
mario
Ok i have seen that the toolbar is:
Code: Select all
tb = mw.findChildren(QtGui.QToolBar)
My main problem is the "menu item" that is placed prior of "File" when the menu is activated.
I could scan the menu with:
Code: Select all
def scan_menubar():
menu = mw.menuWidget()
actions = menu.actions()
a = actions
num_act = len(a)
b = []
sep_pos = None
for ii in range(0, len(a)):
FreeCAD.Console.PrintMessage(f"n: {ii} text: {a[ii].text()} Name: {a[ii].objectName()}\n")
if a[ii].objectName() == "Separator":
sep_pos = ii
else:
b.append(a[ii])
print(f"Separator position: {sep_pos}")
And I can guess that menu.actions() is thing to manipulate, but how to manipulate it seems the problem.
Any hints?
TIA and Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/