Add a Global Toolbal from a Workbench

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
easyw-fc
Veteran
Posts: 3629
Joined: Thu Jul 09, 2015 9:34 am

Add a Global Toolbal from a Workbench

Post by easyw-fc »

Hi,
I have a WB that in fact is simply adding a file type filter (as Idf WB is doing) and launching a macro when this type of file are going to be open...
Till now everything is fine...

What I would like to achieve is to automatically add a Macro Button to i.e. Global Toolbar ...
I noticed that @DeepSOIC Part-o-Magic WB is in fact doing what I would like to achieve... but PoM is also adding a WB in the WB combo box...
In my situation I wouldn't want the WB in the combo, but just the Command in the ToolBar....

Is that achievable?
Could someone gives me some tips?

Thx in advance
Maurice
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Add a Global Toolbal from a Workbench

Post by DeepSOIC »

You betcha it's achievable, part-o-magic is no magic :lol:
In InitGui, you should import a py file that will register your commands, and also modify some parameters to create the toolbar.
See this:
https://forum.freecadweb.org/viewtopic.php?t=21389
and PoM's GlobalToolbar.py:
https://github.com/DeepSOIC/Part-o-magi ... Toolbar.py
User avatar
easyw-fc
Veteran
Posts: 3629
Joined: Thu Jul 09, 2015 9:34 am

Re: Add a Global Toolbal from a Workbench

Post by easyw-fc »

DeepSOIC wrote:In InitGui, you should import a py file that will register your commands
done and a new Global tool bar is created if missing
DeepSOIC wrote:modify some parameters to create the toolbar.
I'm working/struggling on trying to add a single button to launch a macro
I'm not familiar with WB creation and I don't know atm how to add a command...
DeepSOIC wrote:You betcha it's achievable, part-o-magic is no magic :lol:
a bit of magic at least! ;)
Thx
Maurice
Post Reply