remove PySide from _loadUiType()
bug: - QT_LIB == "PYSIDE" should have been QT_LIB == PYSIDE
This commit is contained in:
parent
30a64d5f81
commit
df64be371a
@ -90,14 +90,18 @@ def _loadUiType(uiFile):
|
|||||||
http://stackoverflow.com/a/8717832
|
http://stackoverflow.com/a/8717832
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if QT_LIB == "PYSIDE":
|
pyside2uic = None
|
||||||
import pysideuic
|
if QT_LIB == PYSIDE2:
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
import pyside2uic as pysideuic
|
import pyside2uic
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# later vserions of pyside2 have dropped pysideuic; use the uic binary instead.
|
# later versions of pyside2 have dropped pyside2uic; use the uic binary instead.
|
||||||
pysideuic = None
|
pyside2uic = None
|
||||||
|
|
||||||
|
if pyside2uic is None:
|
||||||
|
pyside2version = tuple(map(int, PySide2.__version__.split(".")))
|
||||||
|
if (5, 14) <= pyside2version < (5, 14, 2, 2):
|
||||||
|
warnings.warn('For UI compilation, it is recommended to upgrade to PySide >= 5.15')
|
||||||
|
|
||||||
# get class names from ui file
|
# get class names from ui file
|
||||||
import xml.etree.ElementTree as xml
|
import xml.etree.ElementTree as xml
|
||||||
@ -106,20 +110,16 @@ def _loadUiType(uiFile):
|
|||||||
form_class = parsed.find('class').text
|
form_class = parsed.find('class').text
|
||||||
|
|
||||||
# convert ui file to python code
|
# convert ui file to python code
|
||||||
if pysideuic is None:
|
if pyside2uic is None:
|
||||||
if QT_LIB == PYSIDE2:
|
|
||||||
pyside2version = tuple(map(int, PySide2.__version__.split(".")))
|
|
||||||
if pyside2version >= (5, 14) and pyside2version < (5, 14, 2, 2):
|
|
||||||
warnings.warn('For UI compilation, it is recommended to upgrade to PySide >= 5.15')
|
|
||||||
uic_executable = QT_LIB.lower() + '-uic'
|
uic_executable = QT_LIB.lower() + '-uic'
|
||||||
uipy = subprocess.check_output([uic_executable, uiFile])
|
uipy = subprocess.check_output([uic_executable, uiFile])
|
||||||
else:
|
else:
|
||||||
o = _StringIO()
|
o = _StringIO()
|
||||||
with open(uiFile, 'r') as f:
|
with open(uiFile, 'r') as f:
|
||||||
pysideuic.compileUi(f, o, indent=0)
|
pyside2uic.compileUi(f, o, indent=0)
|
||||||
uipy = o.getvalue()
|
uipy = o.getvalue()
|
||||||
|
|
||||||
# exceute python code
|
# execute python code
|
||||||
pyc = compile(uipy, '<string>', 'exec')
|
pyc = compile(uipy, '<string>', 'exec')
|
||||||
frame = {}
|
frame = {}
|
||||||
exec(pyc, frame)
|
exec(pyc, frame)
|
||||||
|
Loading…
Reference in New Issue
Block a user