From acee1a0ecfdb086b0b99f70050c36ffdf20f3b39 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Tue, 19 Jan 2021 10:40:57 +0000 Subject: [PATCH 1/2] Remove support for PySide (but not PySide2). --- README.rst | 2 +- etstool.py | 8 +++----- pyface/__init__.py | 1 - pyface/qt/QtCore.py | 9 +-------- pyface/qt/QtGui.py | 5 +---- pyface/qt/QtNetwork.py | 5 +---- pyface/qt/QtOpenGL.py | 5 +---- pyface/qt/QtScript.py | 10 +--------- pyface/qt/QtSvg.py | 5 +---- pyface/qt/QtTest.py | 5 +---- pyface/qt/QtWebKit.py | 5 +---- pyface/qt/__init__.py | 7 +++---- 12 files changed, 15 insertions(+), 52 deletions(-) diff --git a/README.rst b/README.rst index 476d88088..2fc6ffb45 100644 --- a/README.rst +++ b/README.rst @@ -54,7 +54,7 @@ Prerequisites Pyface depends on: -* a GUI toolkit: one of PySide, PyQt or WxPython +* a GUI toolkit: one of PySide2, PyQt4, PyQt5 or WxPython * `Traits `_ diff --git a/etstool.py b/etstool.py index 753511141..310c351b7 100644 --- a/etstool.py +++ b/etstool.py @@ -51,7 +51,7 @@ python etstool.py test-all Currently supported runtime values include ``3.6``, and currently -supported toolkits are ``null``, ``pyqt``, ``pyside`` and ``wx``. Not all +supported toolkits are ``null``, ``pyqt``, and ``wx``. Not all combinations of toolkits and runtimes will work, but the tasks will fail with a clear error if that is the case. @@ -106,7 +106,6 @@ } extra_dependencies = { - "pyside": {"pyside"}, # XXX once pyside2 is available in EDM, we will want it here "pyside2": set(), "pyqt": {"pyqt<4.12"}, # FIXME: build of 4.12-1 appears to be bad @@ -129,7 +128,6 @@ } environment_vars = { - "pyside": {"ETS_TOOLKIT": "qt4", "QT_API": "pyside"}, "pyside2": {"ETS_TOOLKIT": "qt4", "QT_API": "pyside2"}, "pyqt": {"ETS_TOOLKIT": "qt4", "QT_API": "pyqt"}, "pyqt5": {"ETS_TOOLKIT": "qt4", "QT_API": "pyqt5"}, @@ -279,7 +277,7 @@ def test(edm, runtime, toolkit, environment, no_environment_vars=False): parameters = get_parameters(edm, runtime, toolkit, environment) if toolkit == "wx": parameters["exclude"] = "qt" - elif toolkit in {"pyqt", "pyqt5", "pyside", "pyside2"}: + elif toolkit in {"pyqt", "pyqt5", "pyside2"}: parameters["exclude"] = "wx" else: parameters["exclude"] = "(wx|qt)" @@ -292,7 +290,7 @@ def test(edm, runtime, toolkit, environment, no_environment_vars=False): if toolkit == "wx": environ["EXCLUDE_TESTS"] = "qt" - elif toolkit in {"pyqt", "pyqt5", "pyside", "pyside2"}: + elif toolkit in {"pyqt", "pyqt5", "pyside2"}: environ["EXCLUDE_TESTS"] = "wx" else: environ["EXCLUDE_TESTS"] = "(wx|qt)" diff --git a/pyface/__init__.py b/pyface/__init__.py index 10b4e5fd8..9b19aad44 100644 --- a/pyface/__init__.py +++ b/pyface/__init__.py @@ -23,7 +23,6 @@ "wx": ["wxpython>=4", "numpy"], "pyqt": ["pyqt>=4.10", "pygments"], "pyqt5": ["pyqt5", "pygments"], - "pyside": ["pyside>=1.2", "pygments"], "pyside2": ["pyside2", "shiboken2", "pygments"], "test": ["packaging"], } diff --git a/pyface/qt/QtCore.py b/pyface/qt/QtCore.py index e40dff1a5..73a8019f1 100644 --- a/pyface/qt/QtCore.py +++ b/pyface/qt/QtCore.py @@ -33,14 +33,7 @@ __version__ = QT_VERSION_STR __version_info__ = tuple(map(int, QT_VERSION_STR.split("."))) - -elif qt_api == "pyside2": +else: from PySide2.QtCore import * from PySide2 import __version__, __version_info__ -else: - try: - from PySide import __version__, __version_info__ - except ImportError: - pass - from PySide.QtCore import * diff --git a/pyface/qt/QtGui.py b/pyface/qt/QtGui.py index be120974a..191d800c8 100644 --- a/pyface/qt/QtGui.py +++ b/pyface/qt/QtGui.py @@ -30,7 +30,7 @@ QStyleOptionTabV3 = QStyleOptionTab QStyleOptionTabBarBaseV2 = QStyleOptionTabBarBase -elif qt_api == "pyside2": +else: from PySide2.QtGui import * from PySide2.QtWidgets import * from PySide2.QtPrintSupport import * @@ -45,6 +45,3 @@ QStyleOptionTabV2 = QStyleOptionTab QStyleOptionTabV3 = QStyleOptionTab QStyleOptionTabBarBaseV2 = QStyleOptionTabBarBase - -else: - from PySide.QtGui import * diff --git a/pyface/qt/QtNetwork.py b/pyface/qt/QtNetwork.py index 32ece0696..5bdb59376 100644 --- a/pyface/qt/QtNetwork.py +++ b/pyface/qt/QtNetwork.py @@ -15,8 +15,5 @@ elif qt_api == "pyqt5": from PyQt5.QtNetwork import * -elif qt_api == "pyside2": - from PySide2.QtNetwork import * - else: - from PySide.QtNetwork import * + from PySide2.QtNetwork import * diff --git a/pyface/qt/QtOpenGL.py b/pyface/qt/QtOpenGL.py index e3502332c..1522e7ce4 100644 --- a/pyface/qt/QtOpenGL.py +++ b/pyface/qt/QtOpenGL.py @@ -15,8 +15,5 @@ elif qt_api == "pyqt5": from PyQt5.QtOpenGL import * -elif qt_api == "pyside2": - from PySide2.QtOpenGL import * - else: - from PySide.QtOpenGL import * + from PySide2.QtOpenGL import * diff --git a/pyface/qt/QtScript.py b/pyface/qt/QtScript.py index b3217ae9c..059bd1c7c 100644 --- a/pyface/qt/QtScript.py +++ b/pyface/qt/QtScript.py @@ -12,15 +12,7 @@ if qt_api == "pyqt": from PyQt4.QtScript import * -elif qt_api == "pyqt5": - import warnings - - warnings.warn(DeprecationWarning("QtScript is not supported in PyQt5")) - -elif qt_api == "pyside2": +else: import warnings warnings.warn(DeprecationWarning("QtScript is not supported in PyQt5")) - -else: - from PySide.QtScript import * diff --git a/pyface/qt/QtSvg.py b/pyface/qt/QtSvg.py index 7c98a5ecc..426959591 100644 --- a/pyface/qt/QtSvg.py +++ b/pyface/qt/QtSvg.py @@ -15,8 +15,5 @@ elif qt_api == "pyqt5": from PyQt5.QtSvg import * -elif qt_api == "pyside2": - from PySide2.QtSvg import * - else: - from PySide.QtSvg import * + from PySide2.QtSvg import * diff --git a/pyface/qt/QtTest.py b/pyface/qt/QtTest.py index a43ebc7f5..ff89105a5 100644 --- a/pyface/qt/QtTest.py +++ b/pyface/qt/QtTest.py @@ -15,8 +15,5 @@ elif qt_api == "pyqt5": from PyQt5.QtTest import * -elif qt_api == "pyside2": - from PySide2.QtTest import * - else: - from PySide.QtTest import * + from PySide2.QtTest import * diff --git a/pyface/qt/QtWebKit.py b/pyface/qt/QtWebKit.py index 2b28228d4..d565ccf29 100644 --- a/pyface/qt/QtWebKit.py +++ b/pyface/qt/QtWebKit.py @@ -28,7 +28,7 @@ from PyQt5.QtWebKit import * from PyQt5.QtWebKitWidgets import * -elif qt_api == "pyside2": +else: from PySide2.QtWidgets import * # WebKit is currently in flux in PySide2 @@ -43,6 +43,3 @@ except ImportError: from PySide2.QtWebKit import * from PySide2.QtWebKitWidgets import * - -else: - from PySide.QtWebKit import * diff --git a/pyface/qt/__init__.py b/pyface/qt/__init__.py index 24c9328f2..8d90cd3b2 100644 --- a/pyface/qt/__init__.py +++ b/pyface/qt/__init__.py @@ -14,7 +14,6 @@ import sys QtAPIs = [ - ("pyside", "PySide"), ("pyside2", "PySide2"), ("pyqt5", "PyQt5"), ("pyqt", "PyQt4"), @@ -43,16 +42,16 @@ except ImportError: continue else: - raise ImportError("Cannot import PySide, PySide2, PyQt5 or PyQt4") + raise ImportError("Cannot import PySide2, PyQt5 or PyQt4") # otherwise check QT_API value is valid elif qt_api not in {api_name for api_name, module in QtAPIs}: msg = ( "Invalid Qt API %r, valid values are: " - + "'pyside, 'pyside2', 'pyqt' or 'pyqt5'" + + "'pyside2', 'pyqt' or 'pyqt5'" ) % qt_api raise RuntimeError(msg) # useful constants -is_qt4 = qt_api in {"pyqt", "pyside"} +is_qt4 = qt_api in {"pyqt"} is_qt5 = qt_api in {"pyqt5", "pyside2"} From 5af88dbb698b79e0dd9373bb644910845d73ba57 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Tue, 19 Jan 2021 11:48:33 +0000 Subject: [PATCH 2/2] Update pyface/qt/QtScript.py Co-authored-by: Poruri Sai Rahul --- pyface/qt/QtScript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyface/qt/QtScript.py b/pyface/qt/QtScript.py index 059bd1c7c..96ee381ba 100644 --- a/pyface/qt/QtScript.py +++ b/pyface/qt/QtScript.py @@ -15,4 +15,4 @@ else: import warnings - warnings.warn(DeprecationWarning("QtScript is not supported in PyQt5")) + warnings.warn(DeprecationWarning("QtScript is not supported in PyQt5/PySide2"))