Isotropix Forums

PyQt needed even if I prefer PySide.

Clarisse Scripting related topics

PyQt needed even if I prefer PySide.

Unread postby timurhai » Sun Feb 12, 2017 4:14 pm

Hi.
To create a non-blocking Python Qt window, i need:
import pyqt_clarisse
and then:
pyqt_clarisse.exec_(App)

In a pyqt_clarisse.py we call see:
from PyQt4 import QtCore
from PyQt4 import QtGui
So i need to install PyQt4 even if i am going to use PySide only.
( In a studio we use PySide for in-house tools, we have a Python with PySide )
But for now i need to install PyQt just to make custom windows non-blocking.

Later i just replaced some lines in pyqt_clarisse.py to work PyQt or (and) PySide.
And now it works w/o PyQt4 in Python, but just with PySide:
Code: Select all
# from PyQt4 import QtCore
# from PyQt4 import QtGui
# Move import above modules in try block:
try:
    PythonQt = __import__('PySide', globals(), locals(), ['QtCore','QtGui'])
except ImportError:
    PythonQt = __import__('PyQt4', globals(), locals(), ['QtCore','QtGui'])
QtCore = PythonQt.QtCore
QtGui = PythonQt.QtGui


May be you can do something with this issue in feature releases, for example try to import PySide first.
Timur Hairulin
timurhai
 
Posts: 4
Joined: Mon Dec 19, 2016 11:05 am
Location: Korolev

Re: PyQt needed even if I prefer PySide.

Unread postby bvaldes » Mon Feb 13, 2017 3:34 pm

Hi,

Thank you for sharing this with the community !
We've added a feature request waiting for validation (#6471)

Cheers
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 254
Joined: Mon Sep 26, 2016 11:44 am

Re: PyQt needed even if I prefer PySide.

Unread postby arnaud » Wed Oct 11, 2017 3:22 pm

Hello,

This feature has been approved and added on 3.5 roadmap.
Cheers
Arnaud

Isotropix
Chief Process & Innovation Officer
User avatar
arnaud
 
Posts: 188
Joined: Mon Dec 14, 2015 3:48 pm

Re: PyQt needed even if I prefer PySide.

Unread postby Braden99 » Mon Feb 19, 2018 2:00 am

Going forward with QT5, PyQt5 or PySide2 Python bindings might be in the environment instead.
So this should be taken into account in the future.

We use Qt.py shim layer around all Qt Python bindings, to make it easy to work with in multiple environments (PyQt4, PySide, PyQt5, PySide2)
https://github.com/mottosso/Qt.py
Braden99
 
Posts: 2
Joined: Mon Jan 08, 2018 4:05 am

Re: PyQt needed even if I prefer PySide.

Unread postby ruchit » Sat Aug 11, 2018 10:19 am

Hi,
In Clarisse 3.5, PySide2.QtWidgets.QWidget() crashes main QApplication.
So tell me how to use PySide2 in 3.5 and make parent under QMainWindow ??

Thank you
ruchit
 
Posts: 4
Joined: Sat Aug 11, 2018 10:13 am

Re: PyQt needed even if I prefer PySide.

Unread postby bvaldes » Mon Aug 20, 2018 10:55 am

Hi,

This is a normal behavior. In the SDK doc in Clarisse, there is a special section about QT with Clarisse: `file:///YOUR/CLARISSE/iNSTALL/FOLDER/Clarisse/docs/sdk/using_pyqt.html`

Unfortunately, this is only working for PyQt before before 3.6 and for PySide and PyQt since the release of 3.6.
If you want to use PySide2, you have to edit the python file located here: `D:\YOUR/CLARISSE/iNSTALL/FOLDER\Clarisse\python\pyqt_clarisse.py`

You will have to replace the lines that import PyQt4 by PySide2 and maybe some other things (for example, QApplication is not located in QtGui in PySide2 but in QWidgets).

Because it's a feature request, could you please add a new entry in the feature request tracker? https://www.isotropix.com/user/feature

The tricks should allow you to use PySide2 while we discuss about the feature.

Best regards,
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 254
Joined: Mon Sep 26, 2016 11:44 am


Return to Scripting