mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-16 09:01:59 -05:00
Merge pull request #104 from nimblecollective/master
Add PySide2 Support
This commit is contained in:
commit
d089f12f67
@ -1,5 +1,6 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
- 2.6.0
|
||||||
|
- PySide 2 (Technical Preview) Support
|
||||||
- 2.5.4
|
- 2.5.4
|
||||||
- Fix indicator image of checkable QGroupBox for check/uncheck states, #93
|
- Fix indicator image of checkable QGroupBox for check/uncheck states, #93
|
||||||
- Fix wrong comma position, #95
|
- Fix wrong comma position, #95
|
||||||
|
@ -19,6 +19,8 @@ as shown bellow
|
|||||||
|
|
||||||
# PySide
|
# PySide
|
||||||
dark_stylesheet = qdarkstyle.load_stylesheet_pyside()
|
dark_stylesheet = qdarkstyle.load_stylesheet_pyside()
|
||||||
|
# PySide
|
||||||
|
dark_stylesheet = qdarkstyle.load_stylesheet_pyside2()
|
||||||
# PyQt4
|
# PyQt4
|
||||||
dark_stylesheet = qdarkstyle.load_stylesheet_pyqt()
|
dark_stylesheet = qdarkstyle.load_stylesheet_pyqt()
|
||||||
# PyQt5
|
# PyQt5
|
||||||
@ -48,7 +50,7 @@ import platform
|
|||||||
import os
|
import os
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
__version__ = "2.5.4"
|
__version__ = "2.6.0"
|
||||||
|
|
||||||
PYQTGRAPH_QT_LIB_VALUES = ['PyQt', 'PyQt5', 'PySide', 'PySide2']
|
PYQTGRAPH_QT_LIB_VALUES = ['PyQt', 'PyQt5', 'PySide', 'PySide2']
|
||||||
QT_API_VALUES = ['pyqt', 'pyqt5', 'pyside', 'pyside2']
|
QT_API_VALUES = ['pyqt', 'pyqt5', 'pyside', 'pyside2']
|
||||||
@ -181,8 +183,24 @@ def load_stylesheet(pyside=True):
|
|||||||
FutureWarning
|
FutureWarning
|
||||||
)
|
)
|
||||||
# Smart import of the rc file
|
# Smart import of the rc file
|
||||||
|
|
||||||
|
pyside_ver = None
|
||||||
|
|
||||||
if pyside:
|
if pyside:
|
||||||
|
|
||||||
|
# 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
|
import qdarkstyle.pyside_style_rc
|
||||||
|
else:
|
||||||
|
import qdarkstyle.pyside2_style_rc
|
||||||
else:
|
else:
|
||||||
import qdarkstyle.pyqt_style_rc
|
import qdarkstyle.pyqt_style_rc
|
||||||
|
|
||||||
@ -190,7 +208,10 @@ def load_stylesheet(pyside=True):
|
|||||||
if not pyside:
|
if not pyside:
|
||||||
from PyQt4.QtCore import QFile, QTextStream
|
from PyQt4.QtCore import QFile, QTextStream
|
||||||
else:
|
else:
|
||||||
|
if pyside_ver == 1:
|
||||||
from PySide.QtCore import QFile, QTextStream
|
from PySide.QtCore import QFile, QTextStream
|
||||||
|
else:
|
||||||
|
from PySide2.QtCore import QFile, QTextStream
|
||||||
|
|
||||||
f = QFile(":qdarkstyle/style.qss")
|
f = QFile(":qdarkstyle/style.qss")
|
||||||
if not f.exists():
|
if not f.exists():
|
||||||
@ -241,7 +262,7 @@ def load_stylesheet_pyside2():
|
|||||||
"use load_stylesheet()",
|
"use load_stylesheet()",
|
||||||
PendingDeprecationWarning
|
PendingDeprecationWarning
|
||||||
)
|
)
|
||||||
raise NotImplementedError("PySide 2 is not supported yet.")
|
return load_stylesheet(pyside=True)
|
||||||
|
|
||||||
|
|
||||||
def load_stylesheet_pyqt():
|
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)
|
- pyrcc4 for PyQt4 and PyQtGraph (Python)
|
||||||
- pyrcc5 for PyQt5 and QtPy (Python)
|
- pyrcc5 for PyQt5 and QtPy (Python)
|
||||||
- pyside-rcc for PySide (Python)
|
- pyside-rcc for PySide (Python)
|
||||||
|
- pyside2-rcc for PySide2 (Python)
|
||||||
- rcc for Qt4 and Qt5 (C++)
|
- rcc for Qt4 and Qt5 (C++)
|
||||||
|
|
||||||
Delete the compiled files that you don't want to use manually after
|
Delete the compiled files that you don't want to use manually after
|
||||||
@ -16,6 +17,7 @@ Links to understand those tools:
|
|||||||
- pyrcc4: http://pyqt.sourceforge.net/Docs/PyQt4/resources.html#pyrcc4
|
- pyrcc4: http://pyqt.sourceforge.net/Docs/PyQt4/resources.html#pyrcc4
|
||||||
- pyrcc5: http://pyqt.sourceforge.net/Docs/PyQt5/resources.html#pyrcc5
|
- pyrcc5: http://pyqt.sourceforge.net/Docs/PyQt5/resources.html#pyrcc5
|
||||||
- pyside-rcc: https://www.mankier.com/1/pyside-rcc
|
- pyside-rcc: https://www.mankier.com/1/pyside-rcc
|
||||||
|
- pyside2-rcc: https://doc.qt.io/qtforpython/overviews/resources.html (Documentation Incomplete)
|
||||||
- rcc on Qt4: http://doc.qt.io/archives/qt-4.8/rcc.html
|
- rcc on Qt4: http://doc.qt.io/archives/qt-4.8/rcc.html
|
||||||
- rcc on Qt5: http://doc.qt.io/qt-5/rcc.html
|
- rcc on Qt5: http://doc.qt.io/qt-5/rcc.html
|
||||||
|
|
||||||
@ -40,7 +42,7 @@ def main(arguments):
|
|||||||
help="QRC file directory, relative to current directory.",)
|
help="QRC file directory, relative to current directory.",)
|
||||||
parser.add_argument('--create',
|
parser.add_argument('--create',
|
||||||
default='all',
|
default='all',
|
||||||
choices=['pyqt', 'pyqt5', 'pyside', 'qtpy', 'pyqtgraph', 'qt', 'qt5', 'all'],
|
choices=['pyqt', 'pyqt5', 'pyside', 'pyside2', 'qtpy', 'pyqtgraph', 'qt', 'qt5', 'all'],
|
||||||
type=str,
|
type=str,
|
||||||
help="Choose which one would be generated.")
|
help="Choose which one would be generated.")
|
||||||
|
|
||||||
@ -63,6 +65,7 @@ def main(arguments):
|
|||||||
py_file_pyqt5 = 'pyqt5_' + filename + ext
|
py_file_pyqt5 = 'pyqt5_' + filename + ext
|
||||||
py_file_pyqt = 'pyqt_' + filename + ext
|
py_file_pyqt = 'pyqt_' + filename + ext
|
||||||
py_file_pyside = 'pyside_' + filename + ext
|
py_file_pyside = 'pyside_' + filename + ext
|
||||||
|
py_file_pyside2 = 'pyside2_' + filename + ext
|
||||||
py_file_qtpy = 'qtpy_' + filename + ext
|
py_file_qtpy = 'qtpy_' + filename + ext
|
||||||
py_file_pyqtgraph = 'pyqtgraph_' + filename + ext
|
py_file_pyqtgraph = 'pyqtgraph_' + filename + ext
|
||||||
|
|
||||||
@ -79,6 +82,10 @@ def main(arguments):
|
|||||||
print("Compiling for PySide ...")
|
print("Compiling for PySide ...")
|
||||||
call(['pyside-rcc', '-py3', qrc_file, '-o', py_file_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']:
|
if args.create in ['qtpy', 'all']:
|
||||||
print("Compiling for QtPy ...")
|
print("Compiling for QtPy ...")
|
||||||
# special case - qtpy - syntax is PyQt5
|
# special case - qtpy - syntax is PyQt5
|
||||||
|
@ -9,12 +9,14 @@ To run this script you need to have these tools available on system:
|
|||||||
- pyuic4 for PyQt4 and PyQtGraph
|
- pyuic4 for PyQt4 and PyQtGraph
|
||||||
- pyuic5 for PyQt5 and QtPy
|
- pyuic5 for PyQt5 and QtPy
|
||||||
- pyside-uic for Pyside
|
- pyside-uic for Pyside
|
||||||
|
- pyside2-uic for Pyside2
|
||||||
|
|
||||||
Links to understand those tools:
|
Links to understand those tools:
|
||||||
|
|
||||||
- pyuic4: http://pyqt.sourceforge.net/Docs/PyQt4/designer.html#pyuic4
|
- pyuic4: http://pyqt.sourceforge.net/Docs/PyQt4/designer.html#pyuic4
|
||||||
- pyuic5: http://pyqt.sourceforge.net/Docs/PyQt5/designer.html#pyuic5
|
- pyuic5: http://pyqt.sourceforge.net/Docs/PyQt5/designer.html#pyuic5
|
||||||
- pyside-uic: https://www.mankier.com/1/pyside-uic
|
- pyside-uic: https://www.mankier.com/1/pyside-uic
|
||||||
|
- pyside2-uic: https://wiki.qt.io/Qt_for_Python_UiFiles (Documentation Incomplete)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -37,7 +39,7 @@ def main(arguments):
|
|||||||
help="UI files directory, relative to current directory.",)
|
help="UI files directory, relative to current directory.",)
|
||||||
parser.add_argument('--create',
|
parser.add_argument('--create',
|
||||||
default='all',
|
default='all',
|
||||||
choices=['pyqt', 'pyqt5', 'pyside', 'qtpy', 'pyqtgraph', 'all'],
|
choices=['pyqt', 'pyqt5', 'pyside', 'pyside2', 'qtpy', 'pyqtgraph', 'all'],
|
||||||
type=str,
|
type=str,
|
||||||
help="Choose which one would be generated.")
|
help="Choose which one would be generated.")
|
||||||
|
|
||||||
@ -58,6 +60,7 @@ def main(arguments):
|
|||||||
py_file_pyqt5 = filename + '_pyqt5_ui' + ext
|
py_file_pyqt5 = filename + '_pyqt5_ui' + ext
|
||||||
py_file_pyqt = filename + '_pyqt_ui' + ext
|
py_file_pyqt = filename + '_pyqt_ui' + ext
|
||||||
py_file_pyside = filename + '_pyside_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_qtpy = filename + '_qtpy_ui' + ext
|
||||||
py_file_pyqtgraph = filename + '_pyqtgraph_ui' + ext
|
py_file_pyqtgraph = filename + '_pyqtgraph_ui' + ext
|
||||||
|
|
||||||
@ -71,6 +74,9 @@ def main(arguments):
|
|||||||
if args.create in ['pyside', 'all']:
|
if args.create in ['pyside', 'all']:
|
||||||
call(['pyside-uic', '--from-imports', ui_file, '-o', py_file_pyside])
|
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']:
|
if args.create in ['qtpy', 'all']:
|
||||||
print("Compiling for PySide ...")
|
print("Compiling for PySide ...")
|
||||||
# special case - qtpy - syntax is PyQt5
|
# special case - qtpy - syntax is PyQt5
|
||||||
|
Loading…
Reference in New Issue
Block a user