[Help] How to get WBs, Toolbars, Tools

Need help, or want to share a macro? Post here!
User avatar
HakanSeven12
Posts: 1065
Joined: Wed Feb 06, 2019 10:30 pm

[Help] How to get WBs, Toolbars, Tools

Postby HakanSeven12 » Thu Apr 02, 2020 7:24 am

I can get WBs with that code

Code: Select all

wbList = Gui.listWorkbenches()
How can I know which workbench contains which toolbar and which toolbar contains which tool. I'm trying to create a ribbon for freecad. so I need a hierarchical structure of them.


ribbon.png
ribbon.png (108.84 KiB) Viewed 583 times

How can I access this list?


panel.png
panel.png (99.7 KiB) Viewed 387 times
Last edited by HakanSeven12 on Fri Apr 03, 2020 3:36 pm, edited 6 times in total.
mario52
Posts: 3296
Joined: Wed May 16, 2012 2:13 pm

Re: How to get WBs, Toolbars, Tools

Postby mario52 » Thu Apr 02, 2020 8:43 am

hi

is there a shortcut for 'Preference' panel?

Code: Select all

Gui.listCommands()	# liste les commandes

Gui.runCommand("Std_DlgPreferences") # execute la commande

Gui.runCommand("Part_Box")  # execute la commande

list the button (link forum ?)

Code: Select all

#liste aussi les boutons
import PySide2
from PySide2 import QtGui ,QtCore, QtWidgets
from PySide2.QtGui import *
from PySide2.QtCore import *

mw=Gui.getMainWindow()
dw=mw.findChildren(QtWidgets.QWidget)

# show the names of all dock windows
print(dw)

#list the button name
for i in dw:
  i.objectName()
  print(i.objectName())


mario
Last edited by mario52 on Thu Apr 02, 2020 9:37 am, edited 1 time in total.
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
User avatar
HakanSeven12
Posts: 1065
Joined: Wed Feb 06, 2019 10:30 pm

Re: How to get WBs, Toolbars, Tools

Postby HakanSeven12 » Thu Apr 02, 2020 9:37 am

mario52 wrote: ↑
Thu Apr 02, 2020 8:43 am
hi
mario
hi mario. listCommands() get all of them. I want to know which workbench contains which toolbar and which toolbar contains which tool. I'm trying to create a ribbon for freecad. so I need a hierarchical structure of them.


ribbon.png
ribbon.png (108.84 KiB) Viewed 582 times
User avatar
HakanSeven12
Posts: 1065
Joined: Wed Feb 06, 2019 10:30 pm

Re: [Help] How to get WBs, Toolbars, Tools

Postby HakanSeven12 » Thu Apr 02, 2020 7:28 pm

Bump
User avatar
johnwang
Posts: 578
Joined: Sun Jan 27, 2019 12:41 am

Re: [Help] How to get WBs, Toolbars, Tools

Postby johnwang » Fri Apr 03, 2020 12:24 am

Looking foward For this ribbon. Great.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
HakanSeven12
Posts: 1065
Joined: Wed Feb 06, 2019 10:30 pm

Re: [Help] How to get WBs, Toolbars, Tools

Postby HakanSeven12 » Fri Apr 03, 2020 5:49 am

johnwang wrote: ↑
Fri Apr 03, 2020 12:24 am
Looking foward For this ribbon. Great.
Thanks πŸ™‚ I hope I can find a way for binding.
User avatar
Kunda1
Posts: 9209
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Help] How to get WBs, Toolbars, Tools

Postby Kunda1 » Fri Apr 03, 2020 1:33 pm

Isn't there already a horizontal ribbon-like menu ? need to dig through the forum to find it
...
Perhaps @pablogil developed it? It can be seen in this post (in the 2nd, 3rd, and 4th image attachments):
https://forum.freecadweb.org/viewtopic. ... on#p168417
Alone you go faster. Together we go farther
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
HakanSeven12
Posts: 1065
Joined: Wed Feb 06, 2019 10:30 pm

Re: [Help] How to get WBs, Toolbars, Tools

Postby HakanSeven12 » Fri Apr 03, 2020 1:48 pm

Kunda1 wrote: ↑
Fri Apr 03, 2020 1:33 pm
Isn't there already a horizontal ribbon-like menu ? need to dig through the forum to find it
...
Perhaps @pablogil developed it? It can be seen in this post (in the 2nd, 3rd, and 4th image attachments):
https://forum.freecadweb.org/viewtopic. ... on#p168417
That is tabbar its not samething :) There still toolbars and I want to show them as segment like other cad programs.
User avatar
Kunda1
Posts: 9209
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Help] How to get WBs, Toolbars, Tools

Postby Kunda1 » Fri Apr 03, 2020 1:59 pm

HakanSeven12 wrote: ↑
Fri Apr 03, 2020 1:48 pm
That is tabbar its not samething
:oops: sorry
Alone you go faster. Together we go farther
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 9209
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Help] How to get WBs, Toolbars, Tools

Postby Kunda1 » Fri Apr 03, 2020 2:05 pm

What about https://github.com/triplus/SelectorToolbar ?
Perhaps it has some hints in the code that could help with this issue?
Alone you go faster. Together we go farther
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features