mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-26 06:08:42 -05:00
Added PySide2 support
This commit is contained in:
parent
cc761f754c
commit
7bf2495d3f
@ -181,8 +181,24 @@ def load_stylesheet(pyside=True):
|
||||
FutureWarning
|
||||
)
|
||||
# Smart import of the rc file
|
||||
|
||||
pyside_ver = None
|
||||
|
||||
if pyside:
|
||||
import qdarkstyle.pyside_style_rc
|
||||
|
||||
# Detect the PySide version available
|
||||
try:
|
||||
import PySide
|
||||
except ModuleNotFoundError:
|
||||
import PySide2
|
||||
pyside_ver = 2
|
||||
else:
|
||||
pyside_ver = 1
|
||||
|
||||
if pyside_ver == 1:
|
||||
import qdarkstyle.pyside_style_rc
|
||||
else:
|
||||
import qdarkstyle.pyside2_style_rc
|
||||
else:
|
||||
import qdarkstyle.pyqt_style_rc
|
||||
|
||||
@ -190,7 +206,10 @@ def load_stylesheet(pyside=True):
|
||||
if not pyside:
|
||||
from PyQt4.QtCore import QFile, QTextStream
|
||||
else:
|
||||
from PySide.QtCore import QFile, QTextStream
|
||||
if pyside_ver == 1:
|
||||
from PySide.QtCore import QFile, QTextStream
|
||||
else:
|
||||
from PySide2.QtCore import QFile, QTextStream
|
||||
|
||||
f = QFile(":qdarkstyle/style.qss")
|
||||
if not f.exists():
|
||||
@ -241,7 +260,7 @@ def load_stylesheet_pyside2():
|
||||
"use load_stylesheet()",
|
||||
PendingDeprecationWarning
|
||||
)
|
||||
raise NotImplementedError("PySide 2 is not supported yet.")
|
||||
return load_stylesheet(pyside=True)
|
||||
|
||||
|
||||
def load_stylesheet_pyqt():
|
||||
|
2871
qdarkstyle/pyside2_style_rc.py
Normal file
2871
qdarkstyle/pyside2_style_rc.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@ The script will attempt to compile the qrc file using the following tools:
|
||||
- pyrcc4 for PyQt4 and PyQtGraph (Python)
|
||||
- pyrcc5 for PyQt5 and QtPy (Python)
|
||||
- pyside-rcc for PySide (Python)
|
||||
- pyside2-rcc for PySide2 (Python)
|
||||
- rcc for Qt4 and Qt5 (C++)
|
||||
|
||||
Delete the compiled files that you don't want to use manually after
|
||||
@ -40,7 +41,7 @@ def main(arguments):
|
||||
help="QRC file directory, relative to current directory.",)
|
||||
parser.add_argument('--create',
|
||||
default='all',
|
||||
choices=['pyqt', 'pyqt5', 'pyside', 'qtpy', 'pyqtgraph', 'qt', 'qt5', 'all'],
|
||||
choices=['pyqt', 'pyqt5', 'pyside', 'pyside2', 'qtpy', 'pyqtgraph', 'qt', 'qt5', 'all'],
|
||||
type=str,
|
||||
help="Choose which one would be generated.")
|
||||
|
||||
@ -63,6 +64,7 @@ def main(arguments):
|
||||
py_file_pyqt5 = 'pyqt5_' + filename + ext
|
||||
py_file_pyqt = 'pyqt_' + filename + ext
|
||||
py_file_pyside = 'pyside_' + filename + ext
|
||||
py_file_pyside2 = 'pyside2_' + filename + ext
|
||||
py_file_qtpy = 'qtpy_' + filename + ext
|
||||
py_file_pyqtgraph = 'pyqtgraph_' + filename + ext
|
||||
|
||||
@ -79,6 +81,10 @@ def main(arguments):
|
||||
print("Compiling for PySide ...")
|
||||
call(['pyside-rcc', '-py3', qrc_file, '-o', py_file_pyside])
|
||||
|
||||
if args.create in ['pyside2', 'all']:
|
||||
print("Compiling for PySide ...")
|
||||
call(['pyside2-rcc', '-py3', qrc_file, '-o', py_file_pyside2])
|
||||
|
||||
if args.create in ['qtpy', 'all']:
|
||||
print("Compiling for QtPy ...")
|
||||
# special case - qtpy - syntax is PyQt5
|
||||
|
@ -9,6 +9,7 @@ To run this script you need to have these tools available on system:
|
||||
- pyuic4 for PyQt4 and PyQtGraph
|
||||
- pyuic5 for PyQt5 and QtPy
|
||||
- pyside-uic for Pyside
|
||||
- pyside2-uic for Pyside2
|
||||
|
||||
Links to understand those tools:
|
||||
|
||||
@ -37,7 +38,7 @@ def main(arguments):
|
||||
help="UI files directory, relative to current directory.",)
|
||||
parser.add_argument('--create',
|
||||
default='all',
|
||||
choices=['pyqt', 'pyqt5', 'pyside', 'qtpy', 'pyqtgraph', 'all'],
|
||||
choices=['pyqt', 'pyqt5', 'pyside', 'pyside2', 'qtpy', 'pyqtgraph', 'all'],
|
||||
type=str,
|
||||
help="Choose which one would be generated.")
|
||||
|
||||
@ -58,6 +59,7 @@ def main(arguments):
|
||||
py_file_pyqt5 = filename + '_pyqt5_ui' + ext
|
||||
py_file_pyqt = filename + '_pyqt_ui' + ext
|
||||
py_file_pyside = filename + '_pyside_ui' + ext
|
||||
py_file_pyside2 = filename + '_pyside2_ui' + ext
|
||||
py_file_qtpy = filename + '_qtpy_ui' + ext
|
||||
py_file_pyqtgraph = filename + '_pyqtgraph_ui' + ext
|
||||
|
||||
@ -71,6 +73,9 @@ def main(arguments):
|
||||
if args.create in ['pyside', 'all']:
|
||||
call(['pyside-uic', '--from-imports', ui_file, '-o', py_file_pyside])
|
||||
|
||||
if args.create in ['pyside', 'all']:
|
||||
call(['pyside2-uic', '--from-imports', ui_file, '-o', py_file_pyside2])
|
||||
|
||||
if args.create in ['qtpy', 'all']:
|
||||
print("Compiling for PySide ...")
|
||||
# special case - qtpy - syntax is PyQt5
|
||||
|
Loading…
Reference in New Issue
Block a user