summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdulla Ibrahim <abood91@users.noreply.github.com>2020-12-03 11:39:33 +0200
committerGitHub <noreply@github.com>2020-12-03 11:39:33 +0200
commit6ea45ad0e6fd12d44f8f29707f3de67c75ec2654 (patch)
tree0ef4379a2cba8c2731d1c38b6c4239277ed70d50
parenta34204e6634f900fae023da8afbc63303fe931ee (diff)
downloadapscheduler-6ea45ad0e6fd12d44f8f29707f3de67c75ec2654.tar.gz
Added PySide2 support (#477)
-rw-r--r--README.rst3
-rw-r--r--apscheduler/schedulers/qt.py7
-rw-r--r--docs/modules/schedulers/qt.rst2
-rw-r--r--examples/schedulers/qt.py5
4 files changed, 12 insertions, 5 deletions
diff --git a/README.rst b/README.rst
index 7f9dd37..7c4bad7 100644
--- a/README.rst
+++ b/README.rst
@@ -41,7 +41,8 @@ APScheduler also integrates with several common Python frameworks, like:
* `Tornado <http://www.tornadoweb.org/>`_
* `Twisted <http://twistedmatrix.com/>`_
* `Qt <http://qt-project.org/>`_ (using either
- `PyQt <http://www.riverbankcomputing.com/software/pyqt/intro>`_ or
+ `PyQt <http://www.riverbankcomputing.com/software/pyqt/intro>`_ ,
+ `PySide2 <https://wiki.qt.io/Qt_for_Python>`_)_ or
`PySide <http://qt-project.org/wiki/PySide>`_)
.. [#f1] The cutoff period for this is also configurable.
diff --git a/apscheduler/schedulers/qt.py b/apscheduler/schedulers/qt.py
index 0329a00..26ee665 100644
--- a/apscheduler/schedulers/qt.py
+++ b/apscheduler/schedulers/qt.py
@@ -9,9 +9,12 @@ except (ImportError, RuntimeError): # pragma: nocover
from PyQt4.QtCore import QObject, QTimer
except ImportError:
try:
- from PySide.QtCore import QObject, QTimer # noqa
+ from PySide2.QtCore import QObject, QTimer # noqa
except ImportError:
- raise ImportError('QtScheduler requires either PyQt5, PyQt4 or PySide installed')
+ try:
+ from PySide.QtCore import QObject, QTimer # noPySide2
+ except ImportError:
+ raise ImportError('QtScheduler requires either PyQt5, PyQt4, PySide2 or PySide installed')
class QtScheduler(BaseScheduler):
diff --git a/docs/modules/schedulers/qt.rst b/docs/modules/schedulers/qt.rst
index 68b788c..ce76948 100644
--- a/docs/modules/schedulers/qt.rst
+++ b/docs/modules/schedulers/qt.rst
@@ -13,7 +13,7 @@ API
Introduction
------------
-QtScheduler lets you integrate APScheduler with your `PySide <https://en.wikipedia.org/wiki/PySide>` or
+QtScheduler lets you integrate APScheduler with your `PySide2 <https://wiki.qt.io/Qt_for_Python>`, `PySide <https://en.wikipedia.org/wiki/PySide>` or
`PyQt <http://www.riverbankcomputing.co.uk/software/pyqt/intro>`_ application.
.. list-table::
diff --git a/examples/schedulers/qt.py b/examples/schedulers/qt.py
index c0ab5b5..af29b5e 100644
--- a/examples/schedulers/qt.py
+++ b/examples/schedulers/qt.py
@@ -15,7 +15,10 @@ except ImportError:
try:
from PyQt4.QtGui import QApplication, QLabel
except ImportError:
- from PySide.QtGui import QApplication, QLabel
+ try:
+ from PySide2.QtWidgets import QApplication, QLabel
+ except ImportError:
+ from PySide.QtGui import QApplication, QLabel
def tick():