[Solved] Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by openBrain »

dprojects wrote: Sun Apr 24, 2022 11:56 am I have already installed Ubuntu 22.04 LTS and for native installation (sudo apt-get install freecad) I got error like that:

Code: Select all

Running the Python command 'DEBUGINFO' failed:
Traceback (most recent call last):
  File "/home/user/.FreeCAD/Mod/Woodworking/loadTools.py", line 185, in Activated
    __import__(module, globals(), locals(), [], 0)
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "/home/user/.FreeCAD/Mod/Woodworking/Tools/debugInfo.py", line 25, in <module>
    QtGui.qApp.installEventFilter(ai)

module 'PySide.QtGui' has no attribute 'qApp'
Yes, this is a known issue (that I never investigated the cause) where 'qApp' isn't existing or initialized in PySide.
Hence I use QtWidgets.QApplication.instance() in my version --notice this is PySide2--.
You can also use QtCore.QCoreApplication.instance() --if your macro should work in CLI/headless mode-- or QtGui.QGuiApplication.instance() --if you don't deal with widgets--. ;)
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by dprojects »

openBrain wrote: Mon Apr 25, 2022 7:53 am Yes, this is a known issue (that I never investigated the cause) where 'qApp' isn't existing or initialized in PySide.
Hence I use QtWidgets.QApplication.instance() in my version --notice this is PySide2--.
You can also use QtCore.QCoreApplication.instance() --if your macro should work in CLI/headless mode-- or QtGui.QGuiApplication.instance() --if you don't deal with widgets--. ;)
This error is only at Ubuntu 22.04 LTS natively installed (sudo apt-get install freecad) but for repacked the newest appimage there is no errors and everything works fine.

I am not sure if I should fix this bug for incorrect installations. User would not be able to recognize the installation is invalid. If the error would be only for this macro it could be fixed but there are more errors with freecad working, especially to draft. So maybe it is better to clearly point out that something is wrong.

However, for the native installation I have also problem with setTextures macro. While I am trying to load textures I have bug:

Code: Select all

10:05:50  Traceback (most recent call last):
10:05:50    File "/home/user/.FreeCAD/Mod/Woodworking/Tools/setTextures.py", line 144, in <lambda>
10:05:50      self.step4b.clicked.connect(lambda: self.checkSelected("load", "all"))
10:05:50    File "/home/user/.FreeCAD/Mod/Woodworking/Tools/setTextures.py", line 407, in checkSelected
10:05:50      self.loadStoredTextures(searchObjects)
10:05:50    File "/home/user/.FreeCAD/Mod/Woodworking/Tools/setTextures.py", line 331, in loadStoredTextures
10:05:50      for i in rootnode.getChildren():
10:05:50    File "/usr/lib/python3/dist-packages/pivy/coin.py", line 613, in __iter__
10:05:50      yield self[i]
10:05:50    File "/usr/lib/python3/dist-packages/pivy/coin.py", line 2562, in __getitem__
10:05:50      return _coin.SoNodeList___getitem__(self, i)
10:05:50  SystemError: <built-in function SoNodeList___getitem__> returned a result with an exception set
Also the code for debug info not works but the clipboard from about info works:

Code: Select all

OS: Ubuntu 22.04 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.10.2
Qt version: 5.15.2
Coin version: 4.0.0
OCC version: 7.5.1
Locale: English/United States (en_US)
This is little serious because all people who install Ubuntu 22.04 they get such errors and to get correctly working FreeCAD they have to rebuild the appimage. I am not sure how many users will be able to do that ;-(

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by openBrain »

dprojects wrote: Mon Apr 25, 2022 8:10 am This error is only at Ubuntu 22.04 LTS natively installed
No it's not. I already saw this issue in many former versions. ;)
I am not sure if I should fix this bug for incorrect installations.
Using the singleton-like '.instance()' has proved to be stable (talking only about this specific issue).
This is little serious because all people who install Ubuntu 22.04 they get such errors and to get correctly working FreeCAD they have to rebuild the appimage. I am not sure how many users will be able to do that ;-(
22.04 is brand new and this is generally considered stable only when 22.04.1 will be released.
Also it takes some time for PPA packagers to find and patch issues. Anyway, I should move to 22.04 also in the coming days so we'll see. :)
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by dprojects »

I have already added FreeCAD installation validation screen instead.
This may little stop the flood of reported bugs that probably will be soon.

Image


openBrain wrote: Mon Apr 25, 2022 8:57 am 22.04 is brand new and this is generally considered stable only when 22.04.1 will be released.
Also it takes some time for PPA packagers to find and patch issues. Anyway, I should move to 22.04 also in the coming days so we'll see. :)
For me at Ubuntu 22.04 LTS the mouse cursor slows down sometimes which is very annoying, it was not there before. Apart from that, everything is rather OK. The way to take screenshots is much better. All other things for me are rather acceptable. However, Ubuntu is sometimes very annoying with all those notifications.

I tried installing XUbuntu 22.04 yesterday but it refused to start installation from the USB on my old gaming PC. Unfortunately, the installation from the DVD took forever and I gave it up, finally. Maybe, I will back to it someday and rethink change to xubuntu.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by dprojects »

Just to let you know that in the latest weekly build there is error:

Code: Select all

QtGui.qApp.installEventFilter(ai)
module 'PySide.QtGui' has no attribute 'qApp'

Code: Select all

OS: Ubuntu 22.04.1 LTS (XFCE/xubuntu)
Word size of FreeCAD: 64-bit
Version: 0.21.30486 (Git) AppImage
Build type: Release
Branch: master
Hash: eb546e25d3f952869e3ec87dca02b58653cb3936
Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Woodworking 0.21.30486

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Solved] Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by openBrain »

I already explained it to you on the top of the page.
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: [Solved] Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by dprojects »

openBrain wrote: Sat Oct 01, 2022 6:56 pm I already explained it to you on the top of the page.
Yes, it is easy to fix single tool but maybe it impacts other macros, workbenches or some FreeCAD functionality. This is why I don't like build anything on weekly builds... there was no such issue at 0.20...

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Solved] Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by openBrain »

It's not specific to weekly. It's here at least since 0.18, and probably has always been here.
It's probably a PySide problem that is very specific to the user environment.
Why I told you in the past that you shouldn't use 'qApp' because users may encounter problem with it. Now you're one of them. :)
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: [Solved] Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by dprojects »

openBrain wrote: Sun Oct 02, 2022 6:45 am It's not specific to weekly. It's here at least since 0.18, and probably has always been here.
It's probably a PySide problem that is very specific to the user environment.
Why I told you in the past that you shouldn't use 'qApp' because users may encounter problem with it. Now you're one of them. :)
I use it intentionally as some kind of test, to check if the installation is valid, see: debugInfo However, I plan to change this tool a little bit to show debugInfo even if there is error and I use your code. But I think it is good to know that something like qApp is not already available.

But look how many code samples use the qApp: Search found 204 matches: qApp all the code is not working now... but for sure working at 0.20.0 ;-) this is what is called stability, but weekly build can't be stable, but good to know abut it? hope you don't mind and don't take it as pointing out bugs ;-)

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: [Solved] Help firing AboutDialog::on_copyButton_clicked() wanted by n00b

Post by dprojects »

Hello again, I was thinking to make python version of AboutInfo and I almost did it. I want to share the result here because I will rather not use it for simple reasons:
  • I can't get Build type: Release
  • I guess it is better to have it as FreeCAD does
For woodworking workbench purposes I've created new debugInfo using @wmayer and @openBrain code but maybe someone find it useful and add missing parts.

btw: I was thinking about psutils and hardware gpu and cpu info? and also I am not sure if the qApp is serious problem or not? I use it as testing...

Image
Attachments
About_info_from_python.py
(2.12 KiB) Downloaded 20 times

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
Post Reply