How to migrate from generating Qt dialogs within a script to standalone .ui files?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
Kunda1
Posts: 3237
Joined: Thu Jan 05, 2017 9:03 pm

How to migrate from generating Qt dialogs within a script to standalone .ui files?

Postby Kunda1 » Fri Sep 14, 2018 1:19 pm

Both AddonManager and Manipulator WB generate their dialogs within their respective python script files. In other workbenches i.e. Arch or Draft there are dedicated .ui files. What is the methodology to migrate building the dialogs from within a python file in to their own standalone .ui files?
I'm doing this because it is easier to tinker with .ui files by throwing them in to QtDesigner. It's also easier to to implement translation of a workbench, IMHO.

ref:
https://forum.freecadweb.org/viewtopic. ... 73#p254873
https://forum.freecadweb.org/viewtopic.php?f=10&t=30820
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
wandererfan
Posts: 2023
Joined: Tue Nov 06, 2012 5:42 pm

Re: How to migrate from generating Qt dialogs within a script to standalone .ui files?

Postby wandererfan » Sat Sep 15, 2018 2:14 pm

Kunda1 wrote:
Fri Sep 14, 2018 1:19 pm
What is the methodology to migrate building the dialogs from within a python file in to their own standalone .ui files?
AFAIK, there are two methods:
- use pyside-uic/pyuic4uic to compile your .ui file into a python module, then import that at the beginning of your application module.
- use PySide.QtUiTools.QUiLoader to import your .ui file into an object at runtime.

There might be another method using pyrcc to put the .ui file into the Qt Resource system.

Then you have to connection your widget/signals/slots in your code.

But you better talk to one of the Python whizkids.
User avatar
Kunda1
Posts: 3237
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to migrate from generating Qt dialogs within a script to standalone .ui files?

Postby Kunda1 » Wed Sep 26, 2018 10:54 pm

wandererfan wrote:
Sat Sep 15, 2018 2:14 pm
Kunda1 wrote:
Fri Sep 14, 2018 1:19 pm
What is the methodology to migrate building the dialogs from within a python file in to their own standalone .ui files?
But you better talk to one of the Python whizkids.
@wandererfan thanks :thumbsup:

Any Pythonistas willing to weigh in?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features