[pitivi/ges: 132/287] pitivi/system.py: implement FreedesktopOrgSystem, a base class for desktops implementing fd.o sp



commit d065728a22798095b750dac1e596c7813247fc46
Author: Stephen Griffiths <scgmk5 gmail com>
Date:   Wed Feb 10 22:57:59 2010 +1100

    pitivi/system.py: implement FreedesktopOrgSystem, a base class for desktops
        implementing fd.o specs

 pitivi/system.py |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/system.py b/pitivi/system.py
index 66f345c..8c2d9cb 100644
--- a/pitivi/system.py
+++ b/pitivi/system.py
@@ -20,6 +20,7 @@
 # Boston, MA 02111-1307, USA.
 
 
+from pitivi.configure import APPNAME
 from pitivi.log.loggable import Loggable
 from pitivi.signalinterface import Signallable
 
@@ -176,3 +177,22 @@ class System(Signallable, Loggable):
     def desktopIsMessageable():
         return False
 
+
+class FreedesktopOrgSystem(System):
+    """provides messaging capabilites for desktops that implement fd.o specs"""
+
+    def __init__(self):
+        System.__init__(self)
+        pynotify.init(APPNAME)
+
+    def desktopIsMesageable(self):
+        return True
+
+    def desktopMessage(self, title, message, icon=None):
+        #call super method for consistent logging
+        System.desktopMessage(title, message, icon)
+        notification = pynotify.Notification(title, message)
+        if icon != None and isinstance(icon, gtk.gdk.Pixbuf):
+            notification.set_icon_from_pixbuf(icon)
+
+        notification.show()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]