Skip to content

Commit

Permalink
support legacy qtreactor import
Browse files Browse the repository at this point in the history
  • Loading branch information
ghtdak committed Sep 22, 2014
1 parent 68a1660 commit 5084841
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
54 changes: 54 additions & 0 deletions qt4reactor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) 2001-2011 Twisted Matrix Laboratories.

This comment has been minimized.

Copy link
@kmike

kmike Sep 22, 2014

Contributor

This file should be added back to py_modules in setup.py.
Also, maybe its contents could be simply

from qtreactor.pyqt4reactor import *
__all__ = ["install"]

This comment has been minimized.

Copy link
@ghtdak

ghtdak Sep 22, 2014

Author Owner

Much nicer!!!

thx

This comment has been minimized.

Copy link
@kmike

kmike Sep 22, 2014

Contributor

and __all__ is not needed; I've sent a PR just in case: #20

# See LICENSE for details.
"""
See main docstring in module __init__.py
Reactor supporting PyQt4
API Stability: stable
Maintainer: U{Glenn H Tarbox, PhD<mailto:glenn@tarbox.org>}
"""

from __future__ import print_function

from twisted.python import runtime

from qtreactor import qtreactor_config

qtreactor_config.set_qt_name("PyQt4")

from qtreactor import qt4base

class pyqt4reactor(qt4base.QtReactor):
pass

class pyqt4eventreactor(qt4base.QtReactor):
pass

def posixinstall():
"""
Install the Qt reactor.
"""
p = pyqt4reactor()
from twisted.internet.main import installReactor

installReactor(p)


def win32install():
"""
Install the Qt reactor.
"""
p = pyqt4eventreactor()
from twisted.internet.main import installReactor

installReactor(p)

if runtime.platform.getType() == 'win32':
install = win32install
else:
install = posixinstall

__all__ = ["install"]
5 changes: 2 additions & 3 deletions twisted/plugins/qt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

from twisted.application.reactors import Reactor

#support legacy naming
qt4 = Reactor('qt4', 'qtreactor.pyqt4reactor', 'PyQt4 integration reactor')
qt4 = Reactor('qt4', 'qt4reactor', 'PyQt4 integration reactor')
pyqt4 = Reactor('pyqt4', 'qtreactor.pyqt4reactor', 'PyQt4 integration reactor')
pyside4 = Reactor('pyside4', 'qtreactor.pyside4reactor', 'PySide4 integration reactor')
qt4bad = Reactor('qt4bad', 'qt4reactor_bad', 'Qt4 broken reactor')
qt4bad = Reactor('qt4bad', 'qt4reactor_bad', 'Qt4 broken reactor')

0 comments on commit 5084841

Please sign in to comment.