mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-05 17:01:17 -05:00
Fix support to pyside2 and exception when compilers not found
This commit is contained in:
parent
833aa3bbc6
commit
f7b4ac3a21
@ -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
|
||||
@ -16,6 +17,7 @@ Links to understand those tools:
|
||||
- pyrcc4: http://pyqt.sourceforge.net/Docs/PyQt4/resources.html#pyrcc4
|
||||
- pyrcc5: http://pyqt.sourceforge.net/Docs/PyQt5/resources.html#pyrcc5
|
||||
- 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 Qt5: http://doc.qt.io/qt-5/rcc.html
|
||||
|
||||
@ -40,7 +42,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,21 +65,41 @@ 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
|
||||
|
||||
# calling external commands
|
||||
if args.create in ['pyqt', 'pyqtgraph', 'all']:
|
||||
call(['pyrcc4', '-py3', qrc_file, '-o', py_file_pyqt])
|
||||
print("Compiling for PyQt4 ...")
|
||||
try:
|
||||
call(['pyrcc4', '-py3', qrc_file, '-o', py_file_pyqt])
|
||||
except FileNotFoundError:
|
||||
print("You must install pyrcc4")
|
||||
|
||||
if args.create in ['pyqt5', 'qtpy', 'all']:
|
||||
call(['pyrcc5', qrc_file, '-o', py_file_pyqt5])
|
||||
print("Compiling for PyQt5 ...")
|
||||
try:
|
||||
call(['pyrcc5', qrc_file, '-o', py_file_pyqt5])
|
||||
except FileNotFoundError:
|
||||
print("You must install pyrcc5")
|
||||
|
||||
if args.create in ['pyside', 'all']:
|
||||
call(['pyside-rcc', '-py3', qrc_file, '-o', py_file_pyside])
|
||||
print("Compiling for PySide ...")
|
||||
try:
|
||||
call(['pyside-rcc', '-py3', qrc_file, '-o', py_file_pyside])
|
||||
except FileNotFoundError:
|
||||
print("You must install pyside-rcc")
|
||||
|
||||
if args.create in ['pyside2', 'all']:
|
||||
print("Compiling for PySide 2...")
|
||||
try:
|
||||
call(['pyside2-rcc', '-py3', qrc_file, '-o', py_file_pyside2])
|
||||
except FileNotFoundError:
|
||||
print("You must install pyside2-rcc")
|
||||
|
||||
if args.create in ['qtpy', 'all']:
|
||||
print("Compiling for PySide ...")
|
||||
print("Compiling for QtPy ...")
|
||||
# special case - qtpy - syntax is PyQt5
|
||||
with open(py_file_pyqt5, 'r') as file:
|
||||
filedata = file.read()
|
||||
@ -88,6 +110,7 @@ def main(arguments):
|
||||
file.write(filedata)
|
||||
|
||||
if args.create in ['pyqtgraph', 'all']:
|
||||
print("Compiling for PyQtGraph ...")
|
||||
# special case - pyqtgraph - syntax is PyQt4
|
||||
with open(py_file_pyqt, 'r') as file:
|
||||
filedata = file.read()
|
||||
|
@ -9,12 +9,14 @@ 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:
|
||||
|
||||
- pyuic4: http://pyqt.sourceforge.net/Docs/PyQt4/designer.html#pyuic4
|
||||
- pyuic5: http://pyqt.sourceforge.net/Docs/PyQt5/designer.html#pyuic5
|
||||
- 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.",)
|
||||
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,18 +60,34 @@ 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
|
||||
|
||||
# calling external commands
|
||||
if args.create in ['pyqt', 'pyqtgraph', 'all']:
|
||||
call(['pyuic4', '--from-imports', ui_file, '-o', py_file_pyqt])
|
||||
try:
|
||||
call(['pyuic4', '--from-imports', ui_file, '-o', py_file_pyqt])
|
||||
except FileNotFoundError:
|
||||
print("You must install pyuic4")
|
||||
|
||||
if args.create in ['pyqt5', 'qtpy', 'all']:
|
||||
call(['pyuic5', '--from-imports', ui_file, '-o', py_file_pyqt5])
|
||||
try:
|
||||
call(['pyuic5', '--from-imports', ui_file, '-o', py_file_pyqt5])
|
||||
except FileNotFoundError:
|
||||
print("You must install pyuic5")
|
||||
|
||||
if args.create in ['pyside', 'all']:
|
||||
call(['pyside-uic', '--from-imports', ui_file, '-o', py_file_pyside])
|
||||
try:
|
||||
call(['pyside-uic', '--from-imports', ui_file, '-o', py_file_pyside])
|
||||
except FileNotFoundError:
|
||||
print("You must install pyside-uic")
|
||||
|
||||
if args.create in ['pyside2', 'all']:
|
||||
try:
|
||||
call(['pyside2-uic', '--from-imports', ui_file, '-o', py_file_pyside2])
|
||||
except FileNotFoundError:
|
||||
print("You must install pyside2-uic")
|
||||
|
||||
if args.create in ['qtpy', 'all']:
|
||||
print("Compiling for PySide ...")
|
||||
|
Loading…
Reference in New Issue
Block a user