X-Git-Url: http://git.maemo.org/git/?p=retroconv;a=blobdiff_plain;f=notification_service.py;fp=notification_service.py;h=adbf4538bbef144fb926079ebe5abab99def9a7e;hp=0000000000000000000000000000000000000000;hb=39b7e1e9a1d3e90acae7d9a300b849f5f9a202d8;hpb=e6f144ca963a86ab23ee5337750eba928d898406;ds=sidebyside diff --git a/notification_service.py b/notification_service.py new file mode 100644 index 0000000..adbf453 --- /dev/null +++ b/notification_service.py @@ -0,0 +1,28 @@ +import sys +import dbus +from dbus.mainloop.glib import DBusGMainLoop + +class Notifier: + + def __init__(self): + self.dbus_loop = DBusGMainLoop(set_as_default=True) + self.bus = dbus.SessionBus(mainloop=self.dbus_loop) + self.provider = self.bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications') + self.proxy = dbus.Interface(self.provider, 'org.freedesktop.Notifications') + + def showAlert(self,alertText): + self.proxy.SystemNoteDialog(alertText, 0 ,"ok") + + def requestPatience(self): + text = "Please Wait" + self.proxy.SystemNoteInfoprint(text) + + + def showSuccess(self, num): + text = "Successfuly Imported "+str(num)+" messages" + self.proxy.SystemNoteDialog(text, 0 ,"ok") + + def showFailure(self): + text = "Failed to import messages" + self.proxy.SystemNoteDialog(text, 0 ,"ok") +