Skip to content

Commit a8b309e

Browse files
committed
Added support for PySide6 in PyLuxCoreTools (Windows only)
1 parent d8ef9e4 commit a8b309e

7 files changed

Lines changed: 55 additions & 23 deletions

File tree

cmake/Dependencies.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if(NOT APPLE)
5050
endif()
5151
endif()
5252

53-
find_program(PYSIDE_UIC NAMES pyside-uic pyside2-uic
53+
find_program(PYSIDE_UIC NAMES pyside-uic pyside2-uic pyside6-uic
5454
HINTS "${PYTHON_INCLUDE_DIRS}/../Scripts"
5555
PATHS "c:/Program Files/Python${PYTHON_V}/Scripts")
5656

samples/pyluxcoretool/pyluxcoretool.win.spec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ def pyside_imports():
2323
import PySide.QtCore as QtCore
2424
result = ['PySide.QtCore','PySide.QtGui']
2525
except ImportError:
26-
from PySide2 import QtCore
27-
result = ['PySide2.QtCore','PySide2.QtGui', 'PySide2.QtWidgets']
26+
try:
27+
from PySide2 import QtCore
28+
result = ['PySide2.QtCore','PySide2.QtGui', 'PySide2.QtWidgets']
29+
except ImportError:
30+
from PySide6 import QtCore
31+
result = ['PySide6.QtCore','PySide6.QtGui', 'PySide6.QtWidgets']
2832
return result
2933

3034
a = Analysis(['pyluxcoretool.py'],

src/pyluxcoretools/pyluxcoretools/pyluxcoremenu/cmd.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@
2525
import PySide.QtCore as QtCore
2626
import PySide.QtGui as QtGui
2727
import PySide.QtGui as QtWidgets
28-
PYSIDE2 = False
28+
PYSIDE_V = int(QtCore.qVersion()[:1])
2929
except ImportError:
30-
from PySide2 import QtGui, QtCore, QtWidgets
31-
PYSIDE2 = True
30+
try:
31+
from PySide2 import QtGui, QtCore, QtWidgets
32+
PYSIDE_V = int(QtCore.qVersion()[:1])
33+
except ImportError:
34+
from PySide6 import QtGui, QtCore, QtWidgets
35+
PYSIDE_V = int(QtCore.qVersion()[:1])
3236

3337
import pyluxcoretools.utils.loghandler as loghandler
3438
import pyluxcoretools.pyluxcoremenu.menuwindow as menuwindow
@@ -43,7 +47,7 @@ def __init__(self, parent=None):
4347

4448
super(MenuApp, self).__init__(parent)
4549
self.setupUi(self)
46-
if not PYSIDE2:
50+
if PYSIDE_V < 5:
4751
self.move(QtWidgets.QApplication.desktop().screen().rect().center()- self.rect().center())
4852

4953
def clickedNetNode(self):

src/pyluxcoretools/pyluxcoretools/pyluxcorenetconsole/ui.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@
3232
import PySide.QtCore as QtCore
3333
import PySide.QtGui as QtGui
3434
import PySide.QtGui as QtWidgets
35-
PYSIDE2 = False
35+
PYSIDE_V = int(QtCore.qVersion()[:1])
3636
except ImportError:
37-
from PySide2 import QtGui, QtCore, QtWidgets
38-
PYSIDE2 = True
37+
try:
38+
from PySide2 import QtGui, QtCore, QtWidgets
39+
PYSIDE_V = int(QtCore.qVersion()[:1])
40+
except ImportError:
41+
from PySide6 import QtGui, QtCore, QtWidgets
42+
PYSIDE_V = int(QtCore.qVersion()[:1])
3943

4044
import pyluxcoretools.renderfarm.renderfarm as renderfarm
4145
import pyluxcoretools.renderfarm.renderfarmjobsingleimage as jobsingleimage
@@ -154,12 +158,17 @@ def __init__(self, parent = None):
154158
super(AddNodeDialog, self).__init__(parent)
155159
self.setupUi(self)
156160

157-
ipRegExp = QtCore.QRegExp("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
158-
self.lineEditIPAddress.setValidator(QtGui.QRegExpValidator(ipRegExp))
161+
if PYSIDE_V >= 6:
162+
ipRegExp = QtCore.QRegularExpression("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
163+
ipRegExpVal = QtGui.QRegularExpressionValidator(ipRegExp)
164+
else:
165+
ipRegExp = QtCore.QRegExp("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
166+
ipRegExpVal = QtGui.QRegExpValidator(ipRegExp)
167+
self.lineEditIPAddress.setValidator(ipRegExpVal)
159168
self.lineEditPort.setValidator(QtGui.QIntValidator(0, 65535))
160169
self.lineEditPort.setText(str(renderfarm.DEFAULT_PORT))
161170

162-
if not PYSIDE2:
171+
if PYSIDE_V < 5:
163172
self.move(QtWidgets.QApplication.desktop().screen().rect().center()- self.rect().center())
164173

165174
def GetIPAddress(self):
@@ -174,7 +183,7 @@ def __init__(self, parent=None):
174183
super(MainApp, self).__init__(parent)
175184
self.setupUi(self)
176185

177-
if not PYSIDE2:
186+
if PYSIDE_V < 5:
178187
self.move(QtWidgets.QApplication.desktop().screen().rect().center()- self.rect().center())
179188

180189
uiloghandler.AddUILogHandler(loghandler.loggerName, self)

src/pyluxcoretools/pyluxcoretools/pyluxcorenetnode/ui.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@
2929
import PySide.QtCore as QtCore
3030
import PySide.QtGui as QtGui
3131
import PySide.QtGui as QtWidgets
32-
PYSIDE2 = False
32+
PYSIDE_V = int(QtCore.qVersion()[:1])
3333
except ImportError:
34-
from PySide2 import QtGui, QtCore, QtWidgets
35-
PYSIDE2 = True
34+
try:
35+
from PySide2 import QtGui, QtCore, QtWidgets
36+
PYSIDE_V = int(QtCore.qVersion()[:1])
37+
except ImportError:
38+
from PySide6 import QtGui, QtCore, QtWidgets
39+
PYSIDE_V = int(QtCore.qVersion()[:1])
3640

3741
import pyluxcoretools.renderfarm.renderfarm as renderfarm
3842
import pyluxcoretools.renderfarm.renderfarmnode as renderfarmnode
@@ -48,15 +52,20 @@ def __init__(self, parent=None):
4852
super(MainApp, self).__init__(parent)
4953
self.setupUi(self)
5054

51-
if not PYSIDE2:
55+
if PYSIDE_V < 5:
5256
self.move(QtWidgets.QApplication.desktop().screen().rect().center()- self.rect().center())
5357

5458
uiloghandler.AddUILogHandler(loghandler.loggerName, self)
5559

56-
ipRegExp = QtCore.QRegExp("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
57-
self.lineEditIPAddress.setValidator(QtGui.QRegExpValidator(ipRegExp))
60+
if PYSIDE_V >= 6:
61+
ipRegExp = QtCore.QRegularExpression("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
62+
ipRegExpVal = QtGui.QRegularExpressionValidator(ipRegExp)
63+
else:
64+
ipRegExp = QtCore.QRegExp("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
65+
ipRegExpVal = QtGui.QRegExpValidator(ipRegExp)
66+
self.lineEditIPAddress.setValidator(ipRegExpVal)
5867
self.lineEditPort.setValidator(QtGui.QIntValidator(0, 65535))
59-
self.lineEditBroadcastAddress.setValidator(QtGui.QRegExpValidator(ipRegExp))
68+
self.lineEditBroadcastAddress.setValidator(ipRegExpVal)
6069

6170
self.__ResetConfigUI()
6271

src/pyluxcoretools/pyluxcoretools/utils/logevent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
import PySide.QtGui as QtGui
2323
import PySide.QtGui as QtWidgets
2424
except ImportError:
25-
from PySide2 import QtGui, QtCore, QtWidgets
25+
try:
26+
from PySide2 import QtGui, QtCore, QtWidgets
27+
except ImportError:
28+
from PySide6 import QtGui, QtCore, QtWidgets
2629

2730
class LogEvent(QtCore.QEvent):
2831
EVENT_TYPE = QtCore.QEvent.Type(QtCore.QEvent.registerEventType())

src/pyluxcoretools/pyluxcoretools/utils/uiloghandler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
import PySide.QtGui as QtGui
2525
import PySide.QtGui as QtWidgets
2626
except ImportError:
27-
from PySide2 import QtGui, QtCore, QtWidgets
27+
try:
28+
from PySide2 import QtGui, QtCore, QtWidgets
29+
except ImportError:
30+
from PySide6 import QtGui, QtCore, QtWidgets
2831

2932
class UILogHandler(logging.Handler):
3033
def __init__(self, app):

0 commit comments

Comments
 (0)