Solved: Something happened

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Solved: Something happened

Post by grd »

Hi guys, I have something weird going on. I don't know what it is.

In https://github.com/grd/FreePDM I start the program with "python3 main.py" and it works. Directories work, but when I double click on a FCStd file I see that it runs "EditItem.ui" and it finds the right FCStd file but I don't see the form. I also don't get any error. Can you guys tell me what is wrong?

I can also run "EditItem.ui" file with "python3 src/gui/EditItem.py", but unfortulately the path to one item is hard coded.

Gerard

Edit:

I solved it with translating the ui file to a python file and everything worked.
Last edited by grd on Wed Sep 07, 2022 5:46 pm, edited 1 time in total.
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: A stupid thing is happening

Post by openBrain »

grd wrote: Sun Jul 31, 2022 3:12 pm Hi guys, I have something weird going on. I don't know what it is.
Is that solved or still need help ? (I have this tab open for a long time :lol:)
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: A stupid thing is happening

Post by grd »

openBrain wrote: Mon Aug 22, 2022 9:10 am
grd wrote: Sun Jul 31, 2022 3:12 pm Hi guys, I have something weird going on. I don't know what it is.
Is that solved or still need help ? (I have this tab open for a long time :lol:)
That is solved. But PySide2 is a b*tch that keeps on biting me. I am still not comfortable with it. ;)
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: A stupid thing is happening

Post by grd »

brownharris561 wrote: Wed Sep 07, 2022 12:31 pm
grd wrote: Mon Aug 22, 2022 9:42 am
openBrain wrote: Mon Aug 22, 2022 9:10 am
grd wrote: Sun Jul 31, 2022 3:12 pm Hi guys, I have something weird going on. I don't know what it is.
Is that solved or still need help ? (I have this tab open for a long time :lol:)
That is solved. But PySide2 is a b*tch that keeps on biting me. I am still not comfortable with it. ;)
Can you share the fix ?
I did have problems with the ".ui" files. For some reason I could only use a ".ui" file (dialog and messagebox too) and then the program just ended. So I created the python code from the ".ui" file and after that everything just worked fine. I don't know what the problem created.
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: A stupid thing is happening

Post by onekk »

grd wrote: Wed Sep 07, 2022 12:51 pm I did have problems with the ".ui" files. For some reason I could only use a ".ui" file (dialog and messagebox too) and then the program just ended. So I created the python code from the ".ui" file and after that everything just worked fine. I don't know what the problem created.
I have used ui files one time, and then I've stopped to use them, as it is more easy to made manually the interface, it is not so hard, to code manually the page, and somewhat it is more a work of copy, paste and modify some little thing between each or maybe as I've done for some of my interfaces it could be done creating some automatic form creation code that use info stored in a list to fill the appropriate fields.

Obviously the interface should not be too complicated, but usually if dialogs are or frames are made to input data, the interface should not to be too complicated.


Like this:
GUI-new.png
GUI-new.png (50.88 KiB) Viewed 680 times
that is driven by a creation list (it is a tuple to save some memory space) something like:

Code: Select all

fields = (
    ("ifi_sides", ("mn", "Box Sides", "mm", 3, 10, 1, 4),
        "Number of sides"),
    ("cbo_type",  ("mn", "Box Type", ("Closed", "Open", "Frame", "With Cover")),
        "Box Type"),
    ("ifd_hei", ("mn", "Box Height", "mm", 20, 800, 0.5, 200),
        "Box Height (along Y axis), for polygonal boxes this value is the " +
        "internal diameter, (apothem * 2)"),
    ("ifd_wid", ("mn", "Box Width", "mm", 20, 800, 0.5, 100),
        "Box Width (along X axis)"),
    ("ifd_dep", ("mn", "Box Depth", "mm", 20, 800, 0.5, 50),
        "Box Depth"),
    ("chb_ind", ("mn", "Inner Dims", True),
        "Given dimensions are inner dimensions"),
         ...
The "automatic creation code" is around 300 or 400 lines long. (I have to check exactly)

Just to add something to the discussion.

Sorry for bothering, if applicable. :D

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
mfro
Posts: 664
Joined: Sat Sep 23, 2017 8:15 am

Re: A stupid thing is happening

Post by mfro »

You can do that, but you shouldn't ;).

There is a reason for .ui files: skilled UI designers are (usually) bad coders and skilled coders are (usually) bad UI designers.

If you are a skilled coder, you can give your .ui file to a skilled UI designer and he doesn't need to know anything about coding but could still optimize your bad UI design into a fantastic one (and vice versa).
Cheers,
Markus
grd
Posts: 328
Joined: Wed Apr 13, 2022 5:13 am
Location: Eindhoven, The Netherlands

Re: A stupid thing is happening

Post by grd »

mfro wrote: Wed Sep 07, 2022 3:57 pm You can do that, but you shouldn't ;).

There is a reason for .ui files: skilled UI designers are (usually) bad coders and skilled coders are (usually) bad UI designers.

If you are a skilled coder, you can give your .ui file to a skilled UI designer and he doesn't need to know anything about coding but could still optimize your bad UI design into a fantastic one (and vice versa).
I agree, but it didn't work and now it does. So... But don't ask me why it didn't work because I don't know the answer.
About Nim. Latest Release 2.0.2. Here is Nim in 100 seconds and a Nim package. There are Qt and OCCT packages.
User avatar
mfro
Posts: 664
Joined: Sat Sep 23, 2017 8:15 am

Re: A stupid thing is happening

Post by mfro »

grd wrote: Wed Sep 07, 2022 4:41 pm But don't ask me why it didn't work because I don't know the answer.
Maybe you could try UI design then, instead?

(SCNR)
Cheers,
Markus
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: A stupid thing is happening

Post by onekk »

mfro wrote: Wed Sep 07, 2022 3:57 pm You can do that, but you shouldn't ;).

There is a reason for .ui files: skilled UI designers are (usually) bad coders and skilled coders are (usually) bad UI designers.

If you are a skilled coder, you can give your .ui file to a skilled UI designer and he doesn't need to know anything about coding but could still optimize your bad UI design into a fantastic one (and vice versa).
I see your point.

I've tried to use ui files, but I gave up because it was not so trivial to use them, as in Linux there were no real QtDesigner at least form my distribution due to the strange License that Qt uses these times.

And for some other reasons, like size of the automatic generated UI files even for simple interfaces and difficult to assign a proper ObjectName as the program insist to use strange and complicated names and I'm using the ObjectName to retrieve the instance of the QtObject, using findChild so I prefer some mnemonic ones.

Plus it is not so trivial to find "skilled UI designer" for little money, so I prefer the DIY work. :D

But i don't advise to use my "very personal" way of working, it was a simple experience, that maybe will add some hints to others.

Regards

Carlo D.
Last edited by onekk on Wed Sep 07, 2022 5:18 pm, edited 1 time in total.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
chrisb
Veteran
Posts: 53932
Joined: Tue Mar 17, 2015 9:14 am

Re: A stupid thing is happening

Post by chrisb »

@grd please change the subject of the first post - it's the topic title - to something more descriptive.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply