=== modified file 'twisted/internet/qtreactor.py'
|
|
|
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | import sys |
| | 32 | import gc |
| 32 | 33 | from zope.interface import implements |
| 33 | 34 | from twisted.internet.interfaces import IReactorFDSet |
| 34 | 35 | from twisted.python import log |
| 35 | 36 | from twisted.internet import posixbase |
| 36 | 37 | |
| 37 | | try: |
| 38 | | from PySide.QtCore import QSocketNotifier, QObject, SIGNAL, QTimer, QCoreApplication |
| 39 | | from PySide.QtCore import QEventLoop |
| 40 | | except ImportError: |
| 41 | | from PyQt4.QtCore import QSocketNotifier, QObject, SIGNAL, QTimer, QCoreApplication |
| 42 | | from PyQt4.QtCore import QEventLoop |
| | 38 | from PySide.QtCore import QSocketNotifier, QObject, SIGNAL, QTimer, QCoreApplication |
| | 39 | from PySide.QtCore import QEventLoop |
| 43 | 40 | |
| 44 | 41 | |
| 45 | 42 | class TwistedSocketNotifier(QObject): |
| … |
… |
|
| 58 | 55 | self.fn = self.read |
| 59 | 56 | else: |
| 60 | 57 | self.fn = self.write |
| 61 | | QObject.connect(self.notifier, SIGNAL("activated(int)"), self.fn) |
| | 58 | self.connect(self.notifier, SIGNAL("activated(int)"), self.fn) |
| 62 | 59 | |
| 63 | 60 | |
| 64 | 61 | def shutdown(self): |
| … |
… |
|
| 126 | 123 | self._timer = QTimer() |
| 127 | 124 | self._timer.setSingleShot(True) |
| 128 | 125 | QObject.connect(self._timer, SIGNAL("timeout()"), self.iterate) |
| 129 | | |
| 130 | | if QCoreApplication.startingUp(): |
| 131 | | # Application Object has not been started yet |
| | 126 | |
| | 127 | self.qApp = QCoreApplication.instance() |
| | 128 | self._ownApp=False |
| | 129 | if self.qApp is None: |
| 132 | 130 | self.qApp=QCoreApplication([]) |
| 133 | 131 | self._ownApp=True |
| 134 | | else: |
| 135 | | self.qApp = QCoreApplication.instance() |
| 136 | | self._ownApp=False |
| 137 | 132 | self._blockApp = None |
| 138 | 133 | posixbase.PosixReactorBase.__init__(self) |
| 139 | 134 | |
| … |
… |
|
| 259 | 254 | self.reactorInvocation() |
| 260 | 255 | |
| 261 | 256 | |
| 262 | | def stop(self): |
| 263 | | super(QtReactor, self).stop() |
| 264 | | self.iterate(0) |
| | 257 | def crash(self): |
| | 258 | log.msg('crash') |
| | 259 | super(QtReactor, self).crash() |
| | 260 | if self._blockApp: |
| | 261 | self._blockApp.quit() |
| 265 | 262 | |
| 266 | 263 | |
| 267 | 264 | def run(self, installSignalHandlers=True): |