Skip to content

Commit

Permalink
Remove support for PySide (#861)
Browse files Browse the repository at this point in the history
* Remove support for PySide (but not PySide2).

* Update pyface/qt/QtScript.py

Co-authored-by: Poruri Sai Rahul <[email protected]>

Co-authored-by: Poruri Sai Rahul <[email protected]>
  • Loading branch information
corranwebster and Poruri Sai Rahul authored Jan 19, 2021
1 parent b599d7f commit 9419755
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 53 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/enthought/traits>`_

Expand Down
8 changes: 3 additions & 5 deletions etstool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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"},
Expand Down Expand Up @@ -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)"
Expand All @@ -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)"
Expand Down
1 change: 0 additions & 1 deletion pyface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}
Expand Down
9 changes: 1 addition & 8 deletions pyface/qt/QtCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
5 changes: 1 addition & 4 deletions pyface/qt/QtGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand All @@ -45,6 +45,3 @@
QStyleOptionTabV2 = QStyleOptionTab
QStyleOptionTabV3 = QStyleOptionTab
QStyleOptionTabBarBaseV2 = QStyleOptionTabBarBase

else:
from PySide.QtGui import *
5 changes: 1 addition & 4 deletions pyface/qt/QtNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
5 changes: 1 addition & 4 deletions pyface/qt/QtOpenGL.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
12 changes: 2 additions & 10 deletions pyface/qt/QtScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
warnings.warn(DeprecationWarning("QtScript is not supported in PyQt5/PySide2"))
5 changes: 1 addition & 4 deletions pyface/qt/QtSvg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
5 changes: 1 addition & 4 deletions pyface/qt/QtTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
5 changes: 1 addition & 4 deletions pyface/qt/QtWebKit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,6 +43,3 @@
except ImportError:
from PySide2.QtWebKit import *
from PySide2.QtWebKitWidgets import *

else:
from PySide.QtWebKit import *
7 changes: 3 additions & 4 deletions pyface/qt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import sys

QtAPIs = [
("pyside", "PySide"),
("pyside2", "PySide2"),
("pyqt5", "PyQt5"),
("pyqt", "PyQt4"),
Expand Down Expand Up @@ -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"}

0 comments on commit 9419755

Please sign in to comment.