| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2006 Twisted Matrix Laboratories. | |
| 2 # See LICENSE for details. | |
| 3 | |
| 4 """ | |
| 5 Backwards-compatibility plugin for the Qt reactor. | |
| 6 | |
| 7 This provides a Qt reactor plugin named C{qt} which emits a deprecation | |
| 8 warning and a pointer to the separately distributed Qt reactor plugins. | |
| 9 """ | |
| 10 | |
| 11 import warnings | |
| 12 | |
| 13 from twisted.application.reactors import Reactor, NoSuchReactor | |
| 14 | |
| 15 wikiURL = 'http://twistedmatrix.com/trac/wiki/QTReactor' | |
| 16 errorMessage = ('qtreactor is no longer a part of Twisted due to licensing ' | |
| 17 'issues. Please see %s for details.' % (wikiURL,)) | |
| 18 | |
| 19 class QTStub(Reactor): | |
| 20 """ | |
| 21 Reactor plugin which emits a deprecation warning on the successful | |
| 22 installation of its reactor or a pointer to further information if an | |
| 23 ImportError occurs while attempting to install it. | |
| 24 """ | |
| 25 def __init__(self): | |
| 26 super(QTStub, self).__init__( | |
| 27 'qt', 'qtreactor', 'QT integration reactor') | |
| 28 | |
| 29 | |
| 30 def install(self): | |
| 31 """ | |
| 32 Install the Qt reactor with a deprecation warning or try to point | |
| 33 the user to further information if it cannot be installed. | |
| 34 """ | |
| 35 try: | |
| 36 super(QTStub, self).install() | |
| 37 except (ValueError, ImportError): | |
| 38 raise NoSuchReactor(errorMessage) | |
| 39 else: | |
| 40 warnings.warn( | |
| 41 "Please use -r qt3 to import qtreactor", | |
| 42 category=DeprecationWarning) | |
| 43 | |
| 44 | |
| 45 qt = QTStub() | |
| OLD | NEW |