Improve script for process ui

This commit is contained in:
Daniel Pizetta 2018-11-08 15:02:51 -02:00
parent 9d58cb58a3
commit 3271c5974d

View File

@ -68,29 +68,37 @@ def main(arguments):
if args.create in ['pyqt', 'pyqtgraph', 'all']: if args.create in ['pyqt', 'pyqtgraph', 'all']:
try: try:
call(['pyuic4', '--from-imports', ui_file, '-o', py_file_pyqt]) call(['pyuic4', '--from-imports', ui_file, '-o', py_file_pyqt])
except FileNotFoundError: except Exception as er:
print("You must install pyuic4") print("You must install pyuic4 %s" % str(er))
else:
print("Compiling using pyuic4 ...")
if args.create in ['pyqt5', 'qtpy', 'all']: if args.create in ['pyqt5', 'qtpy', 'all']:
try: try:
call(['pyuic5', '--from-imports', ui_file, '-o', py_file_pyqt5]) call(['pyuic5', '--from-imports', ui_file, '-o', py_file_pyqt5])
except FileNotFoundError: except Exception as er:
print("You must install pyuic5") print("You must install pyuic5 %s" % str(er))
else:
print("Compiling using pyuic5 ...")
if args.create in ['pyside', 'all']: if args.create in ['pyside', 'all']:
try: try:
call(['pyside-uic', '--from-imports', ui_file, '-o', py_file_pyside]) call(['pyside-uic', '--from-imports', ui_file, '-o', py_file_pyside])
except FileNotFoundError: except Exception as er:
print("You must install pyside-uic") print("You must install pyside-uic %s" % str(er))
else:
print("Compiling using pyside-uic ...")
if args.create in ['pyside2', 'all']: if args.create in ['pyside2', 'all']:
try: try:
call(['pyside2-uic', '--from-imports', ui_file, '-o', py_file_pyside2]) call(['pyside2-uic', '--from-imports', ui_file, '-o', py_file_pyside2])
except FileNotFoundError: except Exception as er:
print("You must install pyside2-uic") print("You must install pyside2-uic %s" % str(er))
else:
print("Compiling using pyside2-uic ...")
if args.create in ['qtpy', 'all']: if args.create in ['qtpy', 'all']:
print("Compiling for PySide ...") print("Creating also for qtpy ...")
# special case - qtpy - syntax is PyQt5 # special case - qtpy - syntax is PyQt5
with open(py_file_pyqt5, 'r') as file: with open(py_file_pyqt5, 'r') as file:
filedata = file.read() filedata = file.read()
@ -101,6 +109,7 @@ def main(arguments):
file.write(filedata) file.write(filedata)
if args.create in ['pyqtgraph', 'all']: if args.create in ['pyqtgraph', 'all']:
print("Creating also for pyqtgraph ...")
# special case - pyqtgraph - syntax is PyQt4 # special case - pyqtgraph - syntax is PyQt4
with open(py_file_pyqt, 'r') as file: with open(py_file_pyqt, 'r') as file:
filedata = file.read() filedata = file.read()