summaryrefslogtreecommitdiff
path: root/portato/plugins/notify.py
diff options
context:
space:
mode:
authornecoro <>2007-08-12 04:21:38 +0000
committernecoro <>2007-08-12 04:21:38 +0000
commitade10e0b8e5571e45cdd4800927c24597e2f7315 (patch)
treeff2d39f0366a7238366abd3c77b739996ed8937a /portato/plugins/notify.py
parenta6a5cace4864c37b7a820c89540f85069d842521 (diff)
downloadportato-ade10e0b8e5571e45cdd4800927c24597e2f7315.tar.gz
portato-ade10e0b8e5571e45cdd4800927c24597e2f7315.tar.bz2
portato-ade10e0b8e5571e45cdd4800927c24597e2f7315.zip
added listener/notify
Diffstat (limited to 'portato/plugins/notify.py')
-rw-r--r--portato/plugins/notify.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/portato/plugins/notify.py b/portato/plugins/notify.py
new file mode 100644
index 0000000..5e4a577
--- /dev/null
+++ b/portato/plugins/notify.py
@@ -0,0 +1,23 @@
+from gettext import lgettext as _
+import pynotify
+
+from portato import listener
+
+from portato.helper import warning, error, debug
+from portato.constants import APP_ICON, APP
+
+def notify (retcode, **kwargs):
+ if retcode is None:
+ warning(_("Notify called while process is still running!"))
+ else:
+ icon = APP_ICON
+ if retcode == 0:
+ text = "Emerge finished!"
+ descr = ""
+ urgency = pynotify.URGENCY_NORMAL
+ else:
+ text = "Emerge failed!"
+ descr = "Error Code: %d" % retcode
+ urgency = pynotify.URGENCY_CRITICAL
+
+ listener.send_notify(base = text, descr = descr, icon = icon, urgency = urgency)