Would some global shim help the transition to Qt5 and PySide2 for module developers?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 227
- Joined: Tue Sep 22, 2015 1:47 pm
- Location: Oxford UK/Shenzhen China
- Contact:
Would some global shim help the transition to Qt5 and PySide2 for module developers?
There are some implementations for code comptatible: PySide, PySide2, PyQt4 and PyQt5
I see there is a qt5_pyside2 build , but what I know, Fem Cfd workbench still using PySide, some of code is not compatible with Qt5
1. qt_compat.py in matplotlib
2. qtpy: https://github.com/mottosso/Qt.py#usage
https://github.com/spyder-ide/qtpy
3. another shim on pypi, I forget the name, it can do `from anypyqt import QtCore`
Module dev, can safely assume,
QtGui, QtWidgets(a alias to QtGui for Qt4) are already there,
Or, we can alias pyside2 into PySide, so we can assume PySide is always there?
I see there is a qt5_pyside2 build , but what I know, Fem Cfd workbench still using PySide, some of code is not compatible with Qt5
1. qt_compat.py in matplotlib
2. qtpy: https://github.com/mottosso/Qt.py#usage
https://github.com/spyder-ide/qtpy
3. another shim on pypi, I forget the name, it can do `from anypyqt import QtCore`
Module dev, can safely assume,
QtGui, QtWidgets(a alias to QtGui for Qt4) are already there,
Or, we can alias pyside2 into PySide, so we can assume PySide is always there?
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
-
- Posts: 227
- Joined: Tue Sep 22, 2015 1:47 pm
- Location: Oxford UK/Shenzhen China
- Contact:
Re: Would some global shim help the transition to Qt5 and PySide2 for module developers?
example code
I believe it will be good for module developers.
Because, we know QtCore and QtGui must be imported by FreeCAD already, current from PySide import XXX can be avoided for mx comptabiility.
Code: Select all
from Qt import QtCore, QtWidgets, QtGui
#from qtpy mport QtCore, QtWidgets, QtGui
from Qt import __binding__
if __binding__ in ('PySide2', 'PyQt5'):
print('Qt5 binding available')
elif __binding__ in ('PySide', 'PyQt4'):
print('Qt4 binding available.')
else:
print('No Qt binding available.')
from QtCore import pyqtSlot #fine
from QtGui import QIcon
from QtWidgets import QApplication, QWidget, QPushButton, QMessageBox
Because, we know QtCore and QtGui must be imported by FreeCAD already, current from PySide import XXX can be avoided for mx comptabiility.
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
Re: Would some global shim help the transition to Qt5 and PySide2 for module developers?
@wmayer has already implemented a small pyside shim.
Re: Would some global shim help the transition to Qt5 and PySide2 for module developers?
I still cannot compile pyside2.. grr... everytime i try there is another error I'm too lazy to go after.
Re: Would some global shim help the transition to Qt5 and PySide2 for module developers?
Yorik,yorik wrote:I still cannot compile pyside2.. grr... everytime i try there is another error I'm too lazy to go after.
On Linux or Windows? If Windows, you might want to checkout @wmayer's post
You also might want to try these versions of pyside2 - this is what we are currently using on macOS with Qt 5.6.2.
shiboken2 download
pyside2 download
In each of the formula, you can also see the build options that we use.
Perhaps you could post the compilation errors.
Re: Would some global shim help the transition to Qt5 and PySide2 for module developers?
I'm on linux. Thanks for the configs bruce, I'll look at what you used and try again
I was using the pyside-setup repo from http://code.qt.io/cgit/pyside/pyside-setup.git/tree/
which automatically pulls and builds both shiboken2 and pyside2... But I see now there are appveyor and travis badges in the readme, and one of them is failing. There might be some temporary error, I'll check again tomorrow
I was using the pyside-setup repo from http://code.qt.io/cgit/pyside/pyside-setup.git/tree/
which automatically pulls and builds both shiboken2 and pyside2... But I see now there are appveyor and travis badges in the readme, and one of them is failing. There might be some temporary error, I'll check again tomorrow
Re: Would some global shim help the transition to Qt5 and PySide2 for module developers?
I was originally trying with pyside-setup and @f3nix suggested that I circumvent it and install shiboken, pyside and pyside-tools directly which I did. In fact, in looking at it closely, using pyside-setup actually installs older versions of each (i.e. the sub-repos are not installed at the HEAD sha).yorik wrote:I'm on linux. Thanks for the configs bruce, I'll look at what you used and try again
I was using the pyside-setup repo from http://code.qt.io/cgit/pyside/pyside-setup.git/tree/
which automatically pulls and builds both shiboken2 and pyside2...
The Travis issue should be solved. We had a namespace clash between the legacy formulae and the newer formulae that we developed for pyside2 so I worked with the Qt 4 maintainer and submitted a PR to rename the legacy formulae. The maintainer merged them today so I had to update the Travis config accordingly which is done so the Travis badge should be greenyorik wrote: But I see now there are appveyor and travis badges in the readme, and one of them is failing. There might be some temporary error, I'll check again tomorrow
@f3nix, I know you are slinging different versions of Qt 5 on Linux so can you give Yorik some pyside2 install tips/hints/instructions?
Re: Would some global shim help the transition to Qt5 and PySide2 for module developers?
Aha, will try that instead. Thanks for the hint!blacey wrote:I was originally trying with pyside-setup and @f3nix suggested that I circumvent it and install shiboken, pyside and pyside-tools directly which I did
Re: Would some global shim help the transition to Qt5 and PySide2 for module developers?
Hi yorik!
Could you please tell us your build config? Qt version/linux version.
Cheers,
Mateusz
Could you please tell us your build config? Qt version/linux version.
Cheers,
Mateusz
Re: Would some global shim help the transition to Qt5 and PySide2 for module developers?
H f3nix,
thanks for the help offer! I am on debian with qt5.7. Took the pyside-setup repo, indeed the pyside2 inside was not up to date... So I cloned the shiboken2 and pyside2 separately, shiboken compiled and installed successfully, then pyside2 (just ran standard cmake with no option, no complaints) then this error when making:
But it looks liek some error inside the code...
Sorry qingfeng.xia we are hijacking your thread!
thanks for the help offer! I am on debian with qt5.7. Took the pyside-setup repo, indeed the pyside2 inside was not up to date... So I cloned the shiboken2 and pyside2 separately, shiboken compiled and installed successfully, then pyside2 (just ran standard cmake with no option, no complaints) then this error when making:
Code: Select all
[ 3%] Building CXX object PySide2/QtCore/CMakeFiles/QtCore.dir/PySide2/QtCore/qxmlstreamentitydeclaration_wrapper.cpp.o
/home/yorik/Sources/pyside2/build/PySide2/QtCore/PySide2/QtCore/qxmlstreamentitydeclaration_wrapper.cpp: In function ‘int Sbk_QXmlStreamEntityDeclaration_Init(PyObject*, PyObject*, PyObject*)’:
/home/yorik/Sources/pyside2/build/PySide2/QtCore/PySide2/QtCore/qxmlstreamentitydeclaration_wrapper.cpp:124:58: error: no match for ‘operator*’ (operand type is ‘QXmlStreamEntityDeclaration’)
cptr = new ::QXmlStreamEntityDeclaration(*cppArg0);
Sorry qingfeng.xia we are hijacking your thread!