Skip to content

Add PySide2 support #99

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@ install:
- popd
# PySide
- if [ $TRAVIS_PYTHON_VERSION != '3.5' && $TRAVIS_PYTHON_VERSION != '3.6' ]; then pip install --find-links wheelhouse/ pyside; fi
# PySide2
- if [ $TRAVIS_PYTHON_VERSION != '3.4' ]; then pip install pyside2; fi
# flake8 style checker
- pip install flake8 pep8-naming flake8-debugger flake8-docstrings pytest-timeout flake8-commas
script:
- flake8
- flake8 --select=D1 quamash/*.py
- if [ $TRAVIS_PYTHON_VERSION != '3.5' && $TRAVIS_PYTHON_VERSION != '3.6']; then QUAMASH_QTIMPL=PySide py.test; fi
- if [ $TRAVIS_PYTHON_VERSION != '3.5' && $TRAVIS_PYTHON_VERSION != '3.6' ]; then QUAMASH_QTIMPL=PySide py.test; fi
- if [ $TRAVIS_PYTHON_VERSION != '3.4' ]; then QUAMASH_QTIMPL=PySide2 py.test; fi
- QUAMASH_QTIMPL=PyQt4 py.test
- QUAMASH_QTIMPL=PyQt5 py.test
cache:
Expand Down
22 changes: 8 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Implementation of the `PEP 3156`_ Event-Loop with Qt

Requirements
============
Quamash requires Python 3.4 or Python 3.3 with the backported ``asyncio`` library and either PyQt4, PyQt5 or PySide.
Quamash requires Python >=3.4 with the backported ``asyncio`` library and either PyQt4, PyQt5, PySide or PySide2.

Installation
============
Expand Down Expand Up @@ -115,6 +115,7 @@ Changelog
=========

Version 0.6.1
-------------
* Python 3.7 support (no automated test coverage)

Version 0.6.0
Expand Down Expand Up @@ -216,30 +217,23 @@ Continuous Integration & Supported Platforms
This project uses Travis CI to perform tests on linux (Ubuntu 12.04 LTS "Precise Pangolin") and
Appveyor (Windows Server 2012 R2, similar to Windows 8) to perform continuous integration.

On linux, Python 3.3 and 3.4 with PySide, PyQt4, and PyQt5 are tested. On windows, Python 3.4 with
PySide, PyQt4 and PyQt5 are tested, but Python 3.3 is only tested with PySide since binary installers
for PyQt are not provided for Python 3.3 (at least not the newest versions of PyQt), and compiling
from source probably isn't worth it.

Python 3.5 is now tested on linux with PyQt4 and PyQt5.

Testing Matrix
~~~~~~~~~~~~~~

+----------------------+---------+---------+--------------+----------------+
| | PyQt4 | PyQt5 | PySide (Qt4) | PySide 2 (Qt5) |
+======================+=========+=========+==============+================+
| Linux - Python 3.3 | yes | yes | yes | planned |
| Linux - Python 3.4 | yes | yes | yes | n/a |
+----------------------+---------+---------+--------------+----------------+
| Linux - Python 3.4 | yes | yes | yes | planned |
| Linux - Python 3.5 | yes | yes | n/a | yes |
+----------------------+---------+---------+--------------+----------------+
| Linux - Python 3.5 | yes | yes | n/a | planned |
| Linux - Python 3.6 | yes | yes | n/a | yes |
+----------------------+---------+---------+--------------+----------------+
| Windows - Python 3.3 | no | no | yes | no |
| Windows - Python 3.4 | yes | yes | yes | n/a |
+----------------------+---------+---------+--------------+----------------+
| Windows - Python 3.4 | yes | yes | yes | planned |
| Windows - Python 3.5 | n/a | yes | n/a | yes |
+----------------------+---------+---------+--------------+----------------+
| Windows - Python 3.5 | planned | planned | planned | planned |
| Windows - Python 3.6 | n/a | yes | n/a | yes |
+----------------------+---------+---------+--------------+----------------+

License
Expand Down
19 changes: 15 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,34 @@ environment:
- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"
QTIMPL: "PyQt4"
QTIMPL: "PyQt5"

- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"
QTIMPL: "PySide2"

- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"
QTIMPL: "PyQt4"
QTIMPL: "PyQt5"

- PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "32"
QTIMPL: "PyQt5"

- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"
QTIMPL: "PyQt5"
QTIMPL: "PySide2"

- PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "32"
QTIMPL: "PyQt5"
QTIMPL: "PySide2"
init:
- "ECHO %PATH%"
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH% %QTIMPL%"

install:
Expand Down
5 changes: 4 additions & 1 deletion appveyor/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function InstallPip ($python_home) {

function InstallPackage ($python_home, $pkg) {
$pip_path = $python_home + "\Scripts\pip.exe"
& $pip_path install --only-binary=PySide --only-binary=PyQt4 --only-binary=PyQt5 --find-links .\wheelhouse $pkg
& $pip_path install --only-binary=PySide --only-binary=PySide2 --only-binary=PyQt4 --only-binary=PyQt5 --find-links .\wheelhouse $pkg
}

function main () {
Expand All @@ -35,6 +35,9 @@ function main () {
"PySide" {
InstallPackage $env:Python PySide
}
"PySide2" {
InstallPackage $env:Python PySide2
}
"PyQt4" {
InstallPackage $env:Python PyQt4
}
Expand Down
4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@

@fixture(scope='session')
def application():
from quamash import QApplication
return QApplication([])
from quamash import QCoreApplication
return QCoreApplication([])
14 changes: 4 additions & 10 deletions quamash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
QtModule = importlib.import_module(QtModuleName)

if not QtModule:
for QtModuleName in ('PyQt5', 'PyQt4', 'PySide'):
for QtModuleName in ('PyQt5', 'PySide2', 'PyQt4', 'PySide'):
try:
QtModule = importlib.import_module(QtModuleName)
except ImportError:
Expand All @@ -42,13 +42,7 @@
logger.info('Using Qt Implementation: {}'.format(QtModuleName))

QtCore = importlib.import_module(QtModuleName + '.QtCore', package=QtModuleName)
QtGui = importlib.import_module(QtModuleName + '.QtGui', package=QtModuleName)
if QtModuleName == 'PyQt5':
from PyQt5 import QtWidgets
QApplication = QtWidgets.QApplication
else:
QApplication = QtGui.QApplication

QCoreApplication = QtCore.QCoreApplication

from ._common import with_logger

Expand Down Expand Up @@ -238,8 +232,8 @@ class _QEventLoop:
"""

def __init__(self, app=None):
self.__app = app or QApplication.instance()
assert self.__app is not None, 'No QApplication has been instantiated'
self.__app = app or QCoreApplication.instance()
assert self.__app is not None, 'No QCoreApplication has been instantiated'
self.__is_running = False
self.__debug_enabled = False
self.__default_executor = None
Expand Down