• R/O
  • SSH
  • HTTPS

twitturn: Commit


Commit MetaInfo

Revision77 (tree)
Zeit2010-02-11 22:20:11
Autoryoucharmanums

Log Message

* Ticker interface initial commit.

Ändern Zusammenfassung

Diff

--- trunk/plugins/extractionTabs.py (revision 76)
+++ trunk/plugins/extractionTabs.py (revision 77)
@@ -58,12 +58,9 @@
5858 def restoreGUISettingsAndExtractionTabs():
5959 restoreGUISettingsOriginal()
6060 restoreExtractionTabs(form)
61+
6162 form.restoreGUISettings = restoreGUISettingsAndExtractionTabs
62-
6363 restoreExtractionTabs(form)
64-
6564 form.connect(
6665 form.tabWidget.actionNewExtractionTab, SIGNAL("triggered()"),
6766 newExtractionTab)
68-
69-
--- trunk/twitturn.py (revision 76)
+++ trunk/twitturn.py (revision 77)
@@ -1,4 +1,5 @@
11 #!/usr/bin/env python
2+
23 import sys, time, locale, os, glob, csv
34 from PyQt4 import QtCore, QtGui, uic
45 from twitturnConfigDialog import TwitturnConfigDialog
@@ -9,7 +10,17 @@
910 from twitturnCore import TwitturnCore
1011 from iconCacheManager import IconChacheManager
1112
13+import signal
14+signal.signal(signal.SIGINT, signal.SIG_DFL)
1215
16+notificationInterface = None
17+try:
18+ import pynotify
19+ if pynotify.init("Twitturn2"):
20+ notificationInterface = pynotify
21+except:
22+ pass
23+
1324 TWITTER_MAX_STRING_LENGTH = 140
1425 class ExtendedQTextEdit(QtGui.QTextEdit):
1526 def setCompleter(self, completer):
@@ -669,14 +680,22 @@
669680 if not self.settings.value("notification/popup/disabled").toBool():
670681 keys = self.systemTrayIconMessageDictionary.keys()
671682 if 0 < len(keys):
672- str = ""
683+ message = ""
673684 keys.sort()
674685 for key in keys:
675- str += self.systemTrayIconMessageDictionary[key] + '\n'
676- self.systemTrayIcon.showMessage(
677- QtCore.QString(),
678- str,
679- self.systemTrayIcon.NoIcon)
686+ message += self.systemTrayIconMessageDictionary[key] + '\n'
687+ if not notificationInterface == None:
688+ print str
689+ n = pynotify.Notification(
690+ "Twitrurn"
691+ , str( message))
692+ n.show()
693+ else:
694+ self.systemTrayIcon.showMessage(
695+ QtCore.QString(),
696+ message,
697+ self.systemTrayIcon.NoIcon)
698+ self.emit(QtCore.SIGNAL("notificated"), message)
680699 self.systemTrayIconMessageDictionary.clear()
681700
682701 self.complList.sort()
--- trunk/ticker.py (nonexistent)
+++ trunk/ticker.py (revision 77)
@@ -0,0 +1,84 @@
1+#!/usr/bin/env python
2+
3+import sys, os
4+
5+from PyQt4.QtCore import *
6+from PyQt4.QtGui import *
7+from PyQt4.QtNetwork import *
8+
9+import signal
10+signal.signal(signal.SIGINT, signal.SIG_DFL)
11+
12+class IpcOutputClient(QObject):
13+ def __init__(self, parent=None):
14+ self.sock = QLocalSocket(parent)
15+ self.sock.readyRead.connect(self.read)
16+ self.sock.connected.connect(self.slotConnected)
17+ self.sock.disconnected.connect(self.slotDisconnected)
18+
19+ timer = QTimer(parent)
20+ timer.setSingleShot(False)
21+ timer.setInterval(500)
22+ timer.timeout.connect(self.connectToTheServer)
23+ timer.start()
24+ def connectToTheServer(self):
25+ if self.sock.state() == QAbstractSocket.UnconnectedState:
26+ self.sock.connectToServer("twitturnIpcOutputServer")
27+ def slotConnected(self):
28+ print 'connected'
29+ def slotDisconnected(self):
30+ print 'disconnected'
31+ def read(self):
32+ print self.sock.readAll()
33+
34+class IpcOutputClientGUI(QWidget, IpcOutputClient):
35+ def __init__(self, parent=None):
36+ QWidget.__init__(self, parent)
37+ IpcOutputClient.__init__(self, self)
38+ self.tweetsQueue = []
39+
40+ scrollTimer = QTimer(self)
41+ scrollTimer.setSingleShot(False)
42+ scrollTimer.setInterval(3000)
43+ scrollTimer.timeout.connect(self.tickerNext)
44+ scrollTimer.start()
45+
46+ self.textLabel = QLabel(self)
47+ self.textLabel.resize(800,20)
48+
49+ self.dragPosition = QPoint()
50+
51+ quitAction = QAction(self.tr("E&xit"), self)
52+ quitAction.setShortcut(self.tr("Ctrl+Q"))
53+ quitAction.triggered.connect(app.quit)
54+ self.addAction(quitAction)
55+
56+ self.setContextMenuPolicy(Qt.ActionsContextMenu)
57+
58+ def mousePressEvent(self, event):
59+ if event.button() == Qt.LeftButton:
60+ self.dragPosition = event.globalPos() - self.frameGeometry().topLeft()
61+ event.accept()
62+ def mouseMoveEvent(self, event):
63+ if event.buttons() & Qt.LeftButton:
64+ self.move(event.globalPos() - self.dragPosition)
65+ event.accept()
66+
67+ def tickerNext(self):
68+ if 0 < len(self.tweetsQueue):
69+ self.textLabel.setText(QString.fromUtf8(self.tweetsQueue.pop(0)))
70+ def read(self):
71+ self.tweetsQueue = self.tweetsQueue + str(self.sock.readAll()).split('\n', )
72+
73+if __name__=="__main__":
74+ app = QApplication(sys.argv)
75+ client = IpcOutputClientGUI()
76+ client.setWindowFlags(
77+ Qt.ToolTip
78+ | Qt.FramelessWindowHint
79+ | Qt.WindowStaysOnTopHint
80+ | Qt.WindowSystemMenuHint
81+ )
82+ client.resize(400,20)
83+ client.show()
84+ sys.exit(app.exec_())
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Show on old repository browser