• R/O
  • SSH
  • HTTPS

twitturn: Commit


Commit MetaInfo

Revision81 (tree)
Zeit2010-05-19 20:14:08
Autoryoucharmanums

Log Message

ipcOutput.py added.

Ändern Zusammenfassung

Diff

--- trunk/plugins/ipcOutput.py (nonexistent)
+++ trunk/plugins/ipcOutput.py (revision 81)
@@ -0,0 +1,31 @@
1+from PyQt4.QtCore import *
2+from PyQt4.QtGui import *
3+from PyQt4.QtNetwork import *
4+import csv
5+
6+class IpcOutputServer(QObject):
7+ def __init__(self, parent=None):
8+ self.srv = QLocalServer(parent)
9+ self.activeSockets = []
10+ self.srv.newConnection.connect(self.addSocket)
11+ def sendAll(self, str):
12+ for sock in self.activeSockets:
13+ if type(sock) == QLocalSocket:
14+ if sock.isWritable():
15+ sock.write(QString(str).toUtf8())
16+ sock.flush()
17+ def addSocket(self):
18+ sock = self.srv.nextPendingConnection()
19+ sock.disconnected.connect(lambda: self.activeSockets.remove(sock))
20+ self.activeSockets.append(sock)
21+
22+ipcOutputServer = IpcOutputServer(form)
23+ipcOutputServer.srv.removeServer("twitturnIpcOutputServer")
24+ipcOutputServer.srv.listen("twitturnIpcOutputServer")
25+
26+def sendToTheIpcOutPort(message):
27+ if ipcOutputServer.srv.isListening():
28+ ipcOutputServer.sendAll(
29+ message)
30+
31+form.connect(form, QtCore.SIGNAL("notificated"), sendToTheIpcOutPort)
Show on old repository browser