diff --git a/pyqtgraph/Qt.py b/pyqtgraph/Qt.py index 88c27e27..0941c3c7 100644 --- a/pyqtgraph/Qt.py +++ b/pyqtgraph/Qt.py @@ -100,10 +100,13 @@ def _loadUiType(uiFile): how to make PyQt4 and pyside look the same... http://stackoverflow.com/a/8717832 """ - import pysideuic + + if QT_LIB == "PYSIDE": + import pysideuic + else: + import pyside2uic as pysideuic import xml.etree.ElementTree as xml - #from io import StringIO - + parsed = xml.parse(uiFile) widget_class = parsed.find('widget').get('class') form_class = parsed.find('class').text @@ -216,8 +219,12 @@ elif QT_LIB == PYSIDE2: except ImportError as err: QtTest = FailedImport(err) - isQObjectAlive = _isQObjectAlive - + try: + import shiboken2 + isQObjectAlive = shiboken2.isValid + except ImportError: + # use approximate version + isQObjectAlive = _isQObjectAlive import PySide2 VERSION_INFO = 'PySide2 ' + PySide2.__version__ + ' Qt ' + QtCore.__version__ diff --git a/pyqtgraph/tests/test_qt.py b/pyqtgraph/tests/test_qt.py index bfb98631..c86cd500 100644 --- a/pyqtgraph/tests/test_qt.py +++ b/pyqtgraph/tests/test_qt.py @@ -10,7 +10,6 @@ def test_isQObjectAlive(): o2 = pg.QtCore.QObject() o2.setParent(o1) del o1 - gc.collect() assert not pg.Qt.isQObjectAlive(o2) @pytest.mark.skipif(pg.Qt.QT_LIB == 'PySide', reason='pysideuic does not appear to be '