Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PyQt4 and PySide support #512

Merged
merged 15 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ services:

env:
global:
- INSTALL_EDM_VERSION=2.0.0
- INSTALL_EDM_VERSION=2.4.1
PYTHONUNBUFFERED="1"

matrix:
include:
- env: RUNTIME=3.6 TOOLKITS="pyqt pyqt5 pyside2 wx"
- env: RUNTIME=3.6 TOOLKITS="pyqt pyside2 wx"
- os: osx
env: RUNTIME=3.6 TOOLKITS="pyqt pyqt5 pyside2 wx"
env: RUNTIME=3.6 TOOLKITS="pyqt pyside2 wx"
fast_finish: true

branches:
Expand Down
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ environment:

global:
PYTHONUNBUFFERED: "1"
INSTALL_EDM_VERSION: "2.0.0"
INSTALL_EDM_VERSION: "2.4.1"

matrix:
- RUNTIME: '3.6'
TOOLKITS: "pyqt wx"
TOOLKITS: "wx"
- RUNTIME: '3.6'
TOOLKITS: "pyside2 pyqt5"
TOOLKITS: "pyside2 pyqt"

matrix:
fast_finish: true
allow_failures:
- RUNTIME: '3.6'
TOOLKITS: "pyside2 pyqt5"
TOOLKITS: "pyside2 pyqt"


branches:
Expand Down
31 changes: 15 additions & 16 deletions etstool.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

python etstool.py test_all

Currently supported runtime values are ``2.7`` and ``3.5``, and currently
Currently supported runtime values are ``3.6``, and currently
supported toolkits are ``null``, ``pyqt``, ``pyside`` 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 @@ -86,18 +86,15 @@
import click

supported_combinations = {
"3.5": {"pyqt", "pyqt5"},
"3.6": {"pyqt", "pyqt5", "pyside2", "wx"},
"3.6": {"pyqt", "pyside2", "wx"},
}

dependencies = {"numpy", "pygments", "mock", "nose", "coverage", "traits"}
dependencies = {"traits", "numpy", "pygments", "coverage", "nose"}

extra_dependencies = {
"pyside": {"pyside"},
# XXX once pyside2 is available in EDM, we will want it here
"pyside2": set(),
"pyqt": {"pyqt<4.12"}, # FIXME: build 1 of.4-12 appears to be bad
"pyqt5": {"pyqt5"},
"pyqt": {"pyqt5"},
# XXX once wxPython 4 is available in EDM, we will want it here
"wx": set(),
"null": set(),
Expand All @@ -115,10 +112,8 @@
}

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"},
"pyqt": {"ETS_TOOLKIT": "qt4", "QT_API": "pyqt5"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit and subjective: I would prefer seeing "pyqt5" in the environment name so that wherever I see "pyqt" in CI logs etc I know it is the old Qt4 being used.

Unrelated drive-by comment: This ETS_TOOLKIT looks sadly inconsistent :( "qt4" does not mean "qt4" anymore, it just means Qt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-mortem: It is painful when an old environment name is reused for a new meaning and then that change has to be reverted later. Let's not do this again.

"wx": {"ETS_TOOLKIT": "wx"},
"null": {"ETS_TOOLKIT": "null"},
}
Expand Down Expand Up @@ -159,7 +154,7 @@ def install(edm, runtime, toolkit, environment):
"{edm} run -e {environment} -- python setup.py clean --all",
"{edm} run -e {environment} -- python setup.py install",
]
# pip install pyqt5 and pyside2, because we don't have them in EDM yet
# pip install pyside2, because we don't have it in EDM yet
if toolkit == "pyside2":
commands.extend(
[
Expand All @@ -168,14 +163,18 @@ def install(edm, runtime, toolkit, environment):
]
)
elif toolkit == "wx":
if sys.platform != "linux":
if sys.platform == "darwin":
commands.append(
"{edm} run -e {environment} -- pip install wxPython"
"{edm} run -e {environment} -- python -m pip install wxPython<4.1"
)
else:
elif sys.platform == "linux":
# XXX this is mainly for TravisCI workers; need a generic solution
commands.append(
"{edm} run -e {environment} -- pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04 wxPython"
"{edm} run -e {environment} -- pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04/ wxPython<4.1"
)
else:
commands.append(
"{edm} run -e {environment} -- python -m pip install wxPython"
)

click.echo("Creating environment '{environment}'".format(**parameters))
Expand All @@ -200,7 +199,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", "pyside2"}:
parameters["exclude"] = "wx"
else:
parameters["exclude"] = "(wx|qt)"
Expand Down
2 changes: 0 additions & 2 deletions pyface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
__requires__ = ["traits>=6"]
__extras_require__ = {
"wx": ["wxpython>=4", "numpy"],
"pyqt": ["pyqt>=4.10", "pygments"],
"pyqt5": ["pyqt>=5", "pygments"],
"pyside": ["pyside>=1.2", "pygments"],
"pyside2": ["pyside2", "shiboken2", "pygments"],
}
23 changes: 2 additions & 21 deletions pyface/qt/QtCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,7 @@
# Thanks for using Enthought open source!
from . import qt_api

if qt_api == "pyqt":
from PyQt4.QtCore import *

from PyQt4.QtCore import pyqtProperty as Property
from PyQt4.QtCore import pyqtSignal as Signal
from PyQt4.QtCore import pyqtSlot as Slot
from PyQt4.Qt import QCoreApplication
from PyQt4.Qt import Qt

__version__ = QT_VERSION_STR
__version_info__ = tuple(map(int, QT_VERSION_STR.split(".")))

elif qt_api == "pyqt5":
if qt_api == "pyqt5":
from PyQt5.QtCore import *

from PyQt5.QtCore import pyqtProperty as Property
Expand All @@ -33,14 +21,7 @@
__version__ = QT_VERSION_STR
__version_info__ = tuple(map(int, QT_VERSION_STR.split(".")))


elif qt_api == "pyside2":
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting an observation: It is not necessary (though would be defensive) to check qt_api is "pyside2" here again because pyface.qt.__init__ already ensures qt_api must be one of "pyside2" and "pyqt5". I also noticed that the order of these if-else branches are consistent with the reverse order of QtAPIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is OK to do this, since Pyside2 is the blessed Python Qt wrapper provided by the Qt Company. If a new wrapper cam along it would likely follow the Pyside conventions more than the PyQt conventions.

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 *
11 changes: 2 additions & 9 deletions pyface/qt/QtGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
# Thanks for using Enthought open source!
from . import qt_api

if qt_api == "pyqt":
from PyQt4.Qt import QKeySequence, QTextCursor
from PyQt4.QtGui import *

elif qt_api == "pyqt5":
if qt_api == "pyqt5":
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtPrintSupport import *
Expand All @@ -30,7 +26,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 +41,3 @@
QStyleOptionTabV2 = QStyleOptionTab
QStyleOptionTabV3 = QStyleOptionTab
QStyleOptionTabBarBaseV2 = QStyleOptionTabBarBase

else:
from PySide.QtGui import *
5 changes: 1 addition & 4 deletions pyface/qt/QtMultimedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,5 @@
if qt_api == "pyqt5":
from PyQt5.QtMultimedia import *

elif qt_api == "pyside2":
from PySide2.QtMultimedia import *

else:
warnings.warn("Qt 4 does not support QtMultimedia", DeprecationWarning)
from PySide2.QtMultimedia import *
7 changes: 1 addition & 6 deletions pyface/qt/QtMultimediaWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,5 @@
if qt_api == "pyqt5":
from PyQt5.QtMultimediaWidgets import *

elif qt_api == "pyside2":
from PySide2.QtMultimediaWidgets import *

else:
warnings.warn(
"Qt 4 does not support QtMultimediaWidgets", DeprecationWarning
)
from PySide2.QtMultimediaWidgets import *
10 changes: 2 additions & 8 deletions pyface/qt/QtNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
# Thanks for using Enthought open source!
from . import qt_api

if qt_api == "pyqt":
from PyQt4.QtNetwork import *

elif qt_api == "pyqt5":
if qt_api == "pyqt5":
from PyQt5.QtNetwork import *

elif qt_api == "pyside2":
from PySide2.QtNetwork import *

else:
from PySide.QtNetwork import *
from PySide2.QtNetwork import *
10 changes: 2 additions & 8 deletions pyface/qt/QtOpenGL.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
# Thanks for using Enthought open source!
from . import qt_api

if qt_api == "pyqt":
from PyQt4.QtOpenGL import *

elif qt_api == "pyqt5":
if qt_api == "pyqt5":
from PyQt5.QtOpenGL import *

elif qt_api == "pyside2":
from PySide2.QtOpenGL import *

else:
from PySide.QtOpenGL import *
from PySide2.QtOpenGL import *
10 changes: 2 additions & 8 deletions pyface/qt/QtSvg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
# Thanks for using Enthought open source!
from . import qt_api

if qt_api == "pyqt":
from PyQt4.QtSvg import *

elif qt_api == "pyqt5":
if qt_api == "pyqt5":
from PyQt5.QtSvg import *

elif qt_api == "pyside2":
from PySide2.QtSvg import *

else:
from PySide.QtSvg import *
from PySide2.QtSvg import *
10 changes: 2 additions & 8 deletions pyface/qt/QtTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
# Thanks for using Enthought open source!
from . import qt_api

if qt_api == "pyqt":
from PyQt4.QtTest import *

elif qt_api == "pyqt5":
if qt_api == "pyqt5":
from PyQt5.QtTest import *

elif qt_api == "pyside2":
from PySide2.QtTest import *

else:
from PySide.QtTest import *
from PySide2.QtTest import *
10 changes: 2 additions & 8 deletions pyface/qt/QtWebKit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
# Thanks for using Enthought open source!
from . import qt_api

if qt_api == "pyqt":
from PyQt4.QtWebKit import *

elif qt_api == "pyqt5":
if qt_api == "pyqt5":
from PyQt5.QtWidgets import *

try:
Expand All @@ -28,7 +25,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 +40,3 @@
except ImportError:
from PySide2.QtWebKit import *
from PySide2.QtWebKitWidgets import *

else:
from PySide.QtWebKit import *
16 changes: 3 additions & 13 deletions pyface/qt/QtScript.py → pyface/qt/QtWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,8 @@
# Thanks for using Enthought open source!
from . import qt_api

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":
import warnings

warnings.warn(DeprecationWarning("QtScript is not supported in PyQt5"))
if qt_api == "pyqt5":
from PyQt5.QtWidgets import *

else:
from PySide.QtScript import *
from PySide2.QtWidgets import *
Loading