Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to pyside6? #4

Open
doragasu opened this issue Feb 18, 2025 · 5 comments
Open

Port to pyside6? #4

doragasu opened this issue Feb 18, 2025 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@doragasu
Copy link

I want to install this on Archlinux, that does not have pyside2 (Qt5) on official repositories, but pyside6 (Qt6). Could it be possible getting a release working with pyside6?

Thanks for the plugin!

@30350n
Copy link
Owner

30350n commented Feb 18, 2025

FreeCAD actually seems to provide a wrapper for PySide which should get whatever version is available, so I've switched to using that now. Not sure if my GUI code is actually PySide6 compatible though, let me know if this works for you.

@30350n 30350n added the enhancement New feature or request label Feb 18, 2025
@30350n 30350n self-assigned this Feb 18, 2025
@doragasu
Copy link
Author

doragasu commented Feb 18, 2025

Maybe I'm just missing something, but since I installed it, FreeCAD shows this on startup:

15:15:01  During initialization the error "No module named 'PySide2'" occurred in /home/jalon/.local/share/FreeCAD/Mod/free2ki_v1-0/free2ki/InitGui.py
15:15:01  Please look into the log file for further information

And I do not have the free2ki workbench.

EDIT: Oh I see you have already performed changes, let me check and report, thanks!

@doragasu
Copy link
Author

The export works great! Unfortunately, the Set Materials throws this exception:

15:29:32  Running the Python command 'Free2KiSetMaterials' failed:
Traceback (most recent call last):
  File "/home/jalon/.local/share/FreeCAD/Mod/free2ki/free2ki/f2k_commands.py", line 72, in Activated
    if not (selected_materials := SelectMaterialDialog(selection).execute()):
  File "/home/jalon/.local/share/FreeCAD/Mod/free2ki/free2ki/f2k_commands.py", line 175, in __init__
    material_selector = MaterialSelector(material)
  File "/home/jalon/.local/share/FreeCAD/Mod/free2ki/free2ki/f2k_commands.py", line 285, in __init__
    width = max((font_metrics.widthChar(c) for c in string.hexdigits)) * 6
  File "/home/jalon/.local/share/FreeCAD/Mod/free2ki/free2ki/f2k_commands.py", line 285, in <genexpr>
    width = max((font_metrics.widthChar(c) for c in string.hexdigits)) * 6

'PySide6.QtGui.QFontMetrics' object has no attribute 'widthChar'

@30350n
Copy link
Owner

30350n commented Feb 20, 2025

That one should be fixed as well now.

@doragasu
Copy link
Author

Thanks.

It somehow works, but not cleanly. I can open the dialog and change materials. But when I hover the mouse over the materials dialog, these ugly logs appear:

Error calling Python override of QWidget::paintEvent(): Traceback (most recent call last):
  File "/home/jalon/.local/share/FreeCAD/Mod/free2ki/free2ki/f2k_commands.py", line 381, in paintEvent
    brush.setColor(self._color)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^
ValueError: 'PySide6.QtGui.QBrush.setColor' called with wrong argument values:
  PySide6.QtGui.QBrush.setColor(None,)
Found signature:
  PySide6.QtGui.QBrush.setColor(Union[PySide6.QtGui.QColor, str, PySide6.QtGui.QRgba64, Any, PySide6.QtCore.Qt.GlobalColor, int], /)
QBackingStore::endPaint() called with active painter; did you forget to destroy it or call QPainter::end() on it?

And when exiting FreeCAD after using this dialog, it segfaults, I suppose it must be related:

Caught signal 11 (Segmentation fault: address not mapped to object at address 0x7100d87c21d8)
==== backtrace (tid:  37066) ====
 0 0x000000000004ca22 ucs_event_set_fd_get()  ???:0
 1 0x000000000004cbed ucs_event_set_fd_get()  ???:0
 2 0x000000000003dcd0 __sigaction()  ???:0
 3 0x00000000002e7cb3 QPainter::end()  ???:0
 4 0x00000000002e7d8f QPainter::~QPainter()  ???:0
 5 0x00000000001bfd3b ???()  /usr/lib/python3.13/site-packages/PySide6/QtGui.cpython-313-x86_64-linux-gnu.so:0
 6 0x00000000000204de Shiboken::listToArgcArgv()  ???:0
 7 0x00000000001aad4d _PyList_FromArraySteal()  ???:0
 8 0x00000000001a9135 _PyEval_CheckExceptTypeValid()  ???:0
 9 0x000000000014ddf4 PyObject_Free()  ???:0
10 0x0000000000151bd3 PyDict_SetItemString()  ???:0
11 0x00000000002ee5f5 PySys_WriteStderr()  ???:0
12 0x00000000002838cb _Py_GetConfigsAsDict()  ???:0
13 0x00000000002643c5 Py_Finalize()  ???:0
14 0x0000000000158239 Base::InterpreterSingleton::finalize()  ???:0
15 0x0000000000557857 App::Application::destruct()  ???:0
16 0x0000000000007e7b std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_cold()  ???:0
17 0x0000000000027488 __libc_init_first()  ???:0
18 0x000000000002754c __libc_start_main()  ???:0
19 0x00000000000081e5 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_cold()  ???:0
=================================
Program received signal SIGSEGV, Segmentation fault.
#0  /usr/lib/libc.so.6(+0x3dcd0) [0x7107dba4bcd0]
#1  0x7107dbee7cb3 in QPainter::end() from /usr/lib/libQt6Gui.so.6+0x143
#2  0x7107dbee7d8f in QPainter::~QPainter() from /usr/lib/libQt6Gui.so.6+0x2f
#3  /usr/lib/python3.13/site-packages/PySide6/QtGui.cpython-313-x86_64-linux-gnu.so(+0x1bfd3b) [0x710782bbfd3b]
#4  /usr/lib/libshiboken6.cpython-313-x86_64-linux-gnu.so.6.8(+0x204de) [0x7107dc51d4de]
#5  /usr/lib/libpython3.13.so.1.0(+0x1aad4d) [0x7107dcfaad4d]
#6  /usr/lib/libpython3.13.so.1.0(+0x1a9135) [0x7107dcfa9135]
#7  /usr/lib/libpython3.13.so.1.0(+0x14ddf4) [0x7107dcf4ddf4]
#8  /usr/lib/libpython3.13.so.1.0(PyDict_SetItemString+0xe3) [0x7107dcf51bd3]
#9  /usr/lib/libpython3.13.so.1.0(+0x2ee5f5) [0x7107dd0ee5f5]
#10  /usr/lib/libpython3.13.so.1.0(+0x2838cb) [0x7107dd0838cb]
#11  /usr/lib/libpython3.13.so.1.0(+0x2643c5) [0x7107dd0643c5]
#12  0x7107dd558239 in Base::InterpreterSingleton::finalize() from /usr/lib/freecad/lib/libFreeCADBase.so+0x29
#13  0x7107ddd57857 in App::Application::destruct() from /usr/lib/freecad/lib/libFreeCADApp.so+0x277
#14  freecad(+0x7e7b) [0x59c848a8fe7b]
#15  /usr/lib/libc.so.6(+0x27488) [0x7107dba35488]
#16  /usr/lib/libc.so.6(__libc_start_main+0x8c) [0x7107dba3554c]
#17  freecad(+0x81e5) [0x59c848a901e5]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants