Hi,
I am looking into adding welding symbols to the drawing dimension workbench.
Since there are alot of welding symbols, I was thinking of QActionGroup widget like the drawing workbench uses for the "Drawing_NewPage" command.
I looked code for "Drawing_NewPage" command, which is in c++, and have gotten stuck.
Any ideas on how to create QActionGroup widget for a command using Python?
Can the `Action * PythonCommand::createAction' be overloaded in Python, or something like that ...
Looking at the FreeCAD source for gui/Command.cpp, seems to indicate no (well I am no c++ expert...)
Regards,
Gui Commands with the QActionGroup widget
Re: Gui Commands with the QActionGroup widget
I don't think that is easily possible at the moment... It is of course possible to mimmick how it works in c++ with pyside (find the toolbar and add an actiongroup to it), but, if you plan to add python commands to the existing Drawing WB, I think I would do the same as in PartDesign: simply create your python commands in different files, and import them in InitGui.py. Then, we can modify the C++ workbench to add these commands to a QActionGroup.
If you don't want to create full FreeCAD commands, but just create some qactions, then I would create an additional, pure pyside toolbar, same as I did for the Draft snapping tools (that toolbar is created and managed in Draft/DraftSnap.py, line 1162 show() and line 1068 makeSnapToolBar(). There you can do all the stuff you want, independently of the other toolbars, and not use FreeCAD's command registering stuff.
If you don't want to create full FreeCAD commands, but just create some qactions, then I would create an additional, pure pyside toolbar, same as I did for the Draft snapping tools (that toolbar is created and managed in Draft/DraftSnap.py, line 1162 show() and line 1068 makeSnapToolBar(). There you can do all the stuff you want, independently of the other toolbars, and not use FreeCAD's command registering stuff.
Re: Gui Commands with the QActionGroup widget
Doing this the same way as in Drawing but from Python is currently not possible. But it won't be that difficult to support this. All what we need is a C++ class PythonGroupCommand that works similarly to CmdDrawingNewPage.Any ideas on how to create QActionGroup widget for a command using Python?
Re: Gui Commands with the QActionGroup widget
We could also extend the Gui::PythonWorkbench appendMenu() function, to be able to do something like this:
Code: Select all
appendMenu( [menuItem, subMenuItem], [cmd1, cm2, [groupCmd3, groupCmd4], cmd5] )
Re: Gui Commands with the QActionGroup widget
A PythonGroupCommand would be fantastic.
If the enhancement is added, I would definitely use it.
If the enhancement is added, I would definitely use it.
Re: Gui Commands with the QActionGroup widget
Adding this after the 0.15 release is out would this be OK?hamish wrote:A PythonGroupCommand would be fantastic.
If the enhancement is added, I would definitely use it.
Re: Gui Commands with the QActionGroup widget
Hi wmayer,
The PythonGroupCommand request is not urgent.
So yes, from my side it is okay if the enhancement is added after the 0.15 release is out.
Best regards to you and yorik
The PythonGroupCommand request is not urgent.
So yes, from my side it is okay if the enhancement is added after the 0.15 release is out.
Best regards to you and yorik
Re: Gui Commands with the QActionGroup widget
Just a heads up to anyone who came here for welding symbols, they have been implemented in TechDraw workbench. See https://forum.freecadweb.org/viewtopic.php?f=35&t=38560
This thread is now locked.
This thread is now locked.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs