https://github.com/twisted/qt5reactor
Twisted and PyQt5 eventloop integration. Borrowed from https://github.com/nehbit/aether-public/blob/master/qt5reactor.py
https://github.com/twisted/qt5reactor
Last synced: 7 months ago
JSON representation
Twisted and PyQt5 eventloop integration. Borrowed from https://github.com/nehbit/aether-public/blob/master/qt5reactor.py
- Host: GitHub
- URL: https://github.com/twisted/qt5reactor
- Owner: twisted
- License: other
- Created: 2015-04-04T07:33:36.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-02-02T13:08:23.000Z (over 2 years ago)
- Last Synced: 2025-06-01T20:05:09.081Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 101 KB
- Stars: 47
- Watchers: 17
- Forks: 22
- Open Issues: 18
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Qt5Reactor
==========
|PyPI| |Pythons| |GitHub| |GitHub Actions|
.. |PyPI| image:: https://img.shields.io/pypi/v/qt5reactor.svg
:alt: PyPI version
:target: https://pypi.org/project/qt5reactor/
.. |Pythons| image:: https://img.shields.io/pypi/pyversions/qt5reactor.svg
:alt: supported Python versions
:target: https://pypi.org/project/qt5reactor/
.. |GitHub| image:: https://img.shields.io/github/last-commit/twisted/qt5reactor/master.svg
:alt: source on GitHub
:target: https://github.com/twisted/qt5reactor
.. |GitHub Actions| image:: https://github.com/twisted/qt5reactor/workflows/CI/badge.svg
:alt: GitHub Actions build status
:target: https://github.com/twisted/qt5reactor/actions
Using the Qt5Reactor
--------------------
Qt5Reactor is compatible with both PyQt5 and PySide2.
Install using pip
::
pip install qt5reactor
Before running / importing any other Twisted code, invoke:
::
app = QApplication(sys.argv) # your code to init QtCore
from twisted.application import reactors
reactors.installReactor('qt5')
or
::
app = QApplication(sys.argv) # your code to init QtCore
import qt5reactor
qt5reactor.install()
Testing
~~~~~~~
::
trial --reactor=qt5 [twisted] [twisted.test] [twisted.test.test_internet]
Make sure the plugin directory is in path or in the current directory for
reactor discovery to work.
There is also `pytest-twisted`_ for use with pytest_.
You can specify to use the qt5reactor by adding ``--reactor=qt5reactor``.
.. _pytest-twisted: https://github.com/pytest-dev/pytest-twisted
.. _pytest: https://github.com/pytest-dev/pytest