From 9981107374a8e6e1b58225f91613ec09b2b491c7 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Wed, 03 Dec 2008 18:15:05 +0000 Subject: Actually add the script that emits the notifications --- diff --git a/purk/scripts/notification.py b/purk/scripts/notification.py new file mode 100644 index 0000000..c4b7c8d --- /dev/null +++ b/purk/scripts/notification.py @@ -0,0 +1,26 @@ +import logging +import os + +import dbus + +from sugar.activity import activity + +session_bus = dbus.SessionBus() + +notifications_object = session_bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications') +notifications_interface = dbus.Interface(notifications_object, 'org.freedesktop.Notifications') + +_notification_id = 0 + +def onText(e): + activity_instance = e.window.get_toplevel() + if activity_instance.is_visible: + return + + if e.network.me in e.text: + global _notification_id + icon_path = os.path.join(activity.get_bundle_path(), 'activity', + 'activity-ircchat.svg') + _notification_id = notifications_interface.Notify('', _notification_id, + '', '', '', [], {'x-sugar-icon-file-name': icon_path}, -1) + -- cgit v0.9.1