Beispiel #1
0
 def __init__(self, parent, reactor, watcher, socketType):
     QObject.__init__(self, parent)
     self.reactor = reactor
     self.watcher = watcher
     fd = watcher.fileno()
     self.notifier = QSocketNotifier(fd, socketType, parent)
     self.notifier.setEnabled(True)
     if socketType == QSocketNotifier.Read:
         self.fn = self.read
     else:
         self.fn = self.write
     QObject.connect(self.notifier, SIGNAL("activated(int)"), self.fn)
Beispiel #2
0
    def __init__(self):
        self._reads = {}
        self._writes = {}
        self._notifiers = {}
        self._timer = QTimer()
        self._timer.setSingleShot(True)
        QObject.connect(self._timer, SIGNAL("timeout()"), self.iterate)

        if QCoreApplication.instance() is None:
            # Application Object has not been started yet
            self.qApp=QCoreApplication([])
            self._ownApp=True
        else:
            self.qApp = QCoreApplication.instance()
            self._ownApp=False
        self._blockApp = None
        posixbase.PosixReactorBase.__init__(self)

        # Workaround for some bugs in the Twisted POSIXReactorBase class (see
        # docs for _cleanup_reactor).
        self.addSystemEventTrigger('after', 'shutdown', self._cleanup_reactor)
Beispiel #3
0
 def __init__(self, on_ping):
     QObject.__init__(self)
     self._on_ping = on_ping