summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRALOVICH, Kristof <tade60@freemail.hu>2014-06-28 19:42:33 +0200
committerRALOVICH, Kristof <tade60@freemail.hu>2014-06-28 19:42:33 +0200
commitf9419661e414a06d2d8fd484f2eef4c32163d4ab (patch)
treee32cc2cdaf0a79d514333d32a3ac33326792aa86
parentb74a17176f4c330b555458e331ac173e9045e0a2 (diff)
ui: dbus notification, qt tray iconui
-rw-r--r--src/ui/Makefile3
-rwxr-xr-xsrc/ui/antpm-monitor54
-rw-r--r--src/ui/gant.pngbin0 -> 724 bytes
3 files changed, 57 insertions, 0 deletions
diff --git a/src/ui/Makefile b/src/ui/Makefile
new file mode 100644
index 0000000..d1d61d3
--- /dev/null
+++ b/src/ui/Makefile
@@ -0,0 +1,3 @@
+
+all:
+ ./antpm-monitor
diff --git a/src/ui/antpm-monitor b/src/ui/antpm-monitor
new file mode 100755
index 0000000..a8e8800
--- /dev/null
+++ b/src/ui/antpm-monitor
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# -*- coding: utf-8; mode: python -*-
+import sys
+from PyQt4 import QtGui, QtCore
+import dbus
+
+def sendNotif(titleStr='ANT+minus', bodyStr='ANT+minus exiting', timeoutMs=5000):
+ """Python 2.5 script. Creates a Notification pop-up bubble"""
+ """http://cheesehead-techblog.blogspot.de/2009/02/five-ways-to-make-notification-pop-up.html"""
+ item = "org.freedesktop.Notifications"
+ path = "/org/freedesktop/Notifications"
+ interface = "org.freedesktop.Notifications"
+ app_name = "Test Application"
+ id_num_to_replace = 0
+ #icon = "/usr/share/icons/Tango/32x32/status/sunny.png"
+ icon = "/home/tade/dev/antpm/src/ui/gant.png"
+ title = titleStr
+ text = bodyStr
+ actions_list = ''
+ hint = ''
+ time = timeoutMs
+
+ bus = dbus.SessionBus()
+ notif = bus.get_object(item, path)
+ notify = dbus.Interface(notif, interface)
+ notify.Notify(app_name, id_num_to_replace, icon, title, text, actions_list, hint, time)
+
+class SystemTrayIcon(QtGui.QSystemTrayIcon):
+
+ def __init__(self, icon, parent=None):
+ QtGui.QSystemTrayIcon.__init__(self, icon, parent)
+ menu = QtGui.QMenu(parent)
+ self.exitAction = menu.addAction("Exit")
+ self.setContextMenu(menu)
+ QtCore.QObject.connect(self.exitAction, QtCore.SIGNAL("triggered()"), self.closeMe)
+
+ def closeMe(self):
+ print 'quiting'
+ sendNotif()
+ QtGui.qApp.quit()
+ pass
+
+def main():
+ print 'main...'
+ app = QtGui.QApplication(sys.argv)
+ w = QtGui.QWidget()
+ trayIcon = SystemTrayIcon(QtGui.QIcon("gant.png"), w)
+
+ trayIcon.show()
+ sys.exit(app.exec_())
+
+
+if __name__ == '__main__':
+ main()
diff --git a/src/ui/gant.png b/src/ui/gant.png
new file mode 100644
index 0000000..ae014c1
--- /dev/null
+++ b/src/ui/gant.png
Binary files differ