Resource UIs not compiled?

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
vocx
Posts: 3250
Joined: Thu Oct 18, 2018 9:18 pm

Resource UIs not compiled?

Post by vocx » Tue Sep 17, 2019 11:33 pm

I'm looking at FEM's source tree. It seems the following files are not included in Fem.qrc. Is there are reason for this?

Code: Select all

Mod/Fem/Resources/ui/ElectrostaticPotential.ui
Mod/Fem/Resources/ui/ElementFluid1D.ui
Mod/Fem/Resources/ui/ElementGeometry1D.ui
Mod/Fem/Resources/ui/ElementGeometry2D.ui
Mod/Fem/Resources/ui/ElementRotation1D.ui
Mod/Fem/Resources/ui/FlowVelocity.ui
Mod/Fem/Resources/ui/InitialFlowVelocity.ui
Mod/Fem/Resources/ui/Material.ui
Mod/Fem/Resources/ui/MaterialReinforcement.ui
Mod/Fem/Resources/ui/MeshBoundaryLayer.ui
Mod/Fem/Resources/ui/MeshGmsh.ui
Mod/Fem/Resources/ui/MeshGroup.ui
Mod/Fem/Resources/ui/MeshGroupXDMFExport.ui
Mod/Fem/Resources/ui/MeshRegion.ui
Mod/Fem/Resources/ui/ResultShow.ui
Mod/Fem/Resources/ui/SolverCalculix.ui
While looking at the freecad-daily package it seems that these user interfaces are manually installed in the Mod/Fem/Resources/ui/ directory. However, this is unnecessary if they are compiled inside the Fem.qrc file, or not?
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
User avatar
bernd
Posts: 9246
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Resource UIs not compiled?

Post by bernd » Wed Sep 18, 2019 4:32 am

simple answer, history reason and missing knowledge here and noone has made it happen. What are the advantages?
vocx
Posts: 3250
Joined: Thu Oct 18, 2018 9:18 pm

Re: Resource UIs not compiled?

Post by vocx » Wed Sep 18, 2019 5:19 am

bernd wrote:
Wed Sep 18, 2019 4:32 am
simple answer, history reason and missing knowledge here and noone has made it happen. What are the advantages?
I think the advantage is that instead of having many resource files, you have a single resource file Fem_rc.py, which includes all the icons, interfaces, translations, etc. At least this is how it's done in Draft, and Arch. A single Draft_rc.py and Arch_rc.py is placed in the installation directory, which the other modules can import to get the icons they need.

For distribution it's also better to have fewer files, rather than many. For example, this thread, Can Not Start Arch in freecad-daily, is due to missing files in the Debian daily package. The Debian package requires a list of files. If there are many files, the list is very long, and it is error prone to check whether a file is missing. But if the resources are compiled into a single file, that saves space. That's how I noticed Fem still distributes some resources, but compiles others (most).

I was thinking that since some parts of Fem are written in C++, those files needed to be distributed like that. Is this not necessary? Can everything be included in Fem.qrc?
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
User avatar
bernd
Posts: 9246
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Resource UIs not compiled?

Post by bernd » Wed Sep 18, 2019 9:21 am

vocx wrote:
Wed Sep 18, 2019 5:19 am
I was thinking that since some parts of Fem are written in C++, those files needed to be distributed like that. Is this not necessary? Can everything be included in Fem.qrc?
the ones your referenced are used from Python only. The ones used by C++ are included in the Gui directory in Fem. AFAIK they are distributed precompiled already.

Would you go for a PR which distributes the ones your referenced as precompiled as well?
vocx
Posts: 3250
Joined: Thu Oct 18, 2018 9:18 pm

Re: Resource UIs not compiled?

Post by vocx » Wed Sep 18, 2019 4:38 pm

bernd wrote:
Wed Sep 18, 2019 9:21 am
...

Would you go for a PR which distributes the ones your referenced as precompiled as well?
Sure, I guess it's just adding the appropriate lines to Fem.qrc.

By the way, inside src/Mod/Fem/Gui/CMakeLists.txt

Code: Select all

# Python modules ui files, they are copied as they are, thus the need not to be added to Fem.qrc
# see https://forum.freecadweb.org/viewtopic.php?f=10&t=25833
SET(FemGuiPythonUI_SRCS
    Resources/ui/ElectrostaticPotential.ui
    Resources/ui/ElementFluid1D.ui
...
You already asked this in the past, lol: ui files of python workbenches.

As Werner says, the only thing is needed is something like this in the main CMakeLists.txt

Code: Select all

PYSIDE_WRAP_RC(Fem_QRC_SRCS Resources/Fem.qrc)
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
User avatar
bernd
Posts: 9246
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Resource UIs not compiled?

Post by bernd » Wed Sep 18, 2019 4:50 pm

:lol: found it in my todo list ... :mrgreen: far, far, far away from the top ...
User avatar
Kunda1
Posts: 7008
Joined: Thu Jan 05, 2017 9:03 pm

Re: Resource UIs not compiled?

Post by Kunda1 » Tue Oct 08, 2019 6:06 pm

Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests