[Solved] Draft Workbench: user.conf error at Startup in freecad-daily

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by vanuan »

vocx wrote: Thu Sep 24, 2020 3:31 pm You added this code. Is there a way to maintain compatibility with Qt4? Essentially an if test to avoid using this pixel ratio; maybe use a fixed value for Qt4.
Do you mean like this?

Code: Select all

import PySide.QtCore

if int(PySide.QtCore.__version__.split('.')[0]) >= 5:
  cur_hot_x = 0.25 * full_icon_size * device_pixel_ratio
  cur_hot_y = 0.25 * full_icon_size * device_pixel_ratio
  new_icon.setDevicePixelRatio(device_pixel_ratio)
else:
  cur_hot_x = 0.25 * full_icon_size
  cur_hot_y = 0.25 * full_icon_size
https://github.com/FreeCAD/FreeCAD/blob ... 1147-L1149

Code: Select all

        for w in mw.findChild(QtGui.QMdiArea).findChildren(QtGui.QWidget):
            if w.metaObject().className() == "SIM::Coin3D::Quarter::QuarterWidget":
              if int(PySide.QtCore.__version__.split('.')[0]) >= 5:
                device_pixel_ratio = w.devicePixelRatio()
              else:
                device_pixel_ratio = 1.0
https://github.com/FreeCAD/FreeCAD/blob ... r.py#L1125
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by vanuan »

joha2 wrote: Thu Sep 24, 2020 1:18 pm

Code: Select all

OS: Linux Mint 18.3 Sylvia (XFCE/xfce)
Mint 18.3 is based on Ubuntu 16.04 which would end support in 6 months. You would need to upgrade anyway so why wait?

As a workaround, you could try the AppImage version.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by vocx »

vanuan wrote: Thu Sep 24, 2020 5:47 pm Do you mean like this?
Yeah. I think you can use PySide.QtCore.qVersion() to get the version number.

Code: Select all

if PySide.QtCore.qVersion() > "4":
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by joha2 »

Hey guys,

Thank you for your fast answers!
vanuan wrote: Thu Sep 24, 2020 5:58 pm Mint 18.3 is based on Ubuntu 16.04 which would end support in 6 months. You would need to upgrade anyway so why wait?

As a workaround, you could try the AppImage version.
Thanks for the hint about the AppImage!
Yeah, maybe I should upgrade at some time. I hate to upgrade the whole OS which means basically to perform a new installation.
vocx wrote: You are using Py3/Qt4, while you should be using Py3/Qt5.
I already tried compiling with Qt5 myself which did not work properly on my OS, maybe also due to its outdated packages.

Anyway, independently from that, one cannot outrule such configurations. Therefore, the best would be to have a fallback which takes care about outdated Qt versions, wouldn't it? :mrgreen:
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by vocx »

joha2 wrote: Fri Sep 25, 2020 6:41 am ...Therefore, the best would be to have a fallback which takes care about outdated Qt versions, wouldn't it? :mrgreen:
In theory FreeCAD is still Py2/Qt4 compatible, although this compatibility may be dropped completely once v0.19 is released as stable.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by vanuan »

joha2 wrote: Fri Sep 25, 2020 6:41 am Anyway, independently from that, one cannot outrule such configurations. Therefore, the best would be to have a fallback which takes care about outdated Qt versions, wouldn't it? :mrgreen:
Well, from a developer perspective, a framework/library is not a configuration option. It's a core part of an application.

It's only the Linux desktop that is such a mess that you can't have multiple versions of a framework/library installed. Of course, Windows has its own DLL hell, but somehow it is manageable. OS X is a best of both worlds from a developer perspective.

From the user perspective it's quite the opposite - Windows and OS X are hungry monsters that require hundreds of gigabytes of disk space, while Linux software seem to require little space.

So yeah, it's choosing where you want to manage the pain. I hope that some day C++ will get a dependency and package manager similar to other language capabilities, and tech like Flatpak, Snappy and AppImage will allow us to move fast and not be dragged down by supporting dozens of distributions.
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by joha2 »

Hey vanuan and vocx,

thanks again for your fast replies!
vanuan wrote: Fri Sep 25, 2020 7:32 am Well, from a developer perspective, a framework/library is not a configuration option. It's a core part of an application.

It's only the Linux desktop that is such a mess that you can't have multiple versions of a framework/library installed. Of course, Windows has its own DLL hell, but somehow it is manageable. OS X is a best of both worlds from a developer perspective.

From the user perspective it's quite the opposite - Windows and OS X are hungry monsters that require hundreds of gigabytes of disk space, while Linux software seem to require little space.
Yeah, in a pure C++ world, where your framework/library is bundled with your app source, I would agree. But FreeCAD also consists of large parts of Python code, where you can also have more than one version. And typically, in Python you may have different versions of packages which are required for the code to work.
vanuan wrote: Fri Sep 25, 2020 7:32 am So yeah, it's choosing where you want to manage the pain. I hope that some day C++ will get a dependency and package manager similar to other language capabilities, and tech like Flatpak, Snappy and AppImage will allow us to move fast and not be dragged down by supporting dozens of distributions.
Yeah, you're right. I often wish that C++ has a dependency manager like pip or conda, such that it is not such a pain to manage your project there.

Anyway, wouldn't it possible to put a try-except block into the device_pixel_ratio() function and return 1 if it throws an AttributeError?

https://github.com/FreeCAD/FreeCAD/blob ... r.py#L1120

With this change you don't have to monitor the version of Qt and don't have to change different parts of the code in a different manner, since your default value is sane. One can also provide a user warning in the console that an update of Qt is recommended.

Best wishes
Johannes
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by vanuan »

joha2 wrote: Tue Sep 29, 2020 7:03 am Anyway, wouldn't it possible to put a try-except block into the device_pixel_ratio() function and return 1 if it throws an AttributeError?

https://github.com/FreeCAD/FreeCAD/blob ... r.py#L1120

With this change you don't have to monitor the version of Qt and don't have to change different parts of the code in a different manner, since your default value is sane. One can also provide a user warning in the console that an update of Qt is recommended.
Let's try:
https://github.com/FreeCAD/FreeCAD/pull/3905
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by joha2 »

vanuan wrote: Tue Sep 29, 2020 7:57 am Let's try:
https://github.com/FreeCAD/FreeCAD/pull/3905
vocx wrote: ping
Hey guys,

I just updated the FC daily and it works like a charm! Thanks for the fast PR and its review (as well as the discussion)!

What stays is: Why was the user.cfg file corrupted in the first place, i.e. why was the string not long enough?

Best regards
Johannes
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Workbench: Error at Startup in freecad-daily

Post by vocx »

joha2 wrote: Fri Oct 02, 2020 9:33 am ...
What stays is: Why was the user.cfg file corrupted in the first place, i.e. why was the string not long enough?
The code is under constant evolution. These Snapping tools have changed a few times in the last year, so maybe at some point one bug was introduced when you used one version, and later you updated and you used another version. Or it could be random events, Martian technology, gamma rays, or neutrino collisions hitting your hard drive and flipping that bit.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Post Reply