summaryrefslogtreecommitdiff
path: root/portato/plugins
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
parenta6a5cace4864c37b7a820c89540f85069d842521 (diff)
downloadportato-ade10e0b8e5571e45cdd4800927c24597e2f7315.tar.gz
portato-ade10e0b8e5571e45cdd4800927c24597e2f7315.tar.bz2
portato-ade10e0b8e5571e45cdd4800927c24597e2f7315.zip
added listener/notify
Diffstat (limited to 'portato/plugins')
-rw-r--r--portato/plugins/etc_proposals.py3
-rw-r--r--portato/plugins/noroot.py15
-rw-r--r--portato/plugins/notify.py23
3 files changed, 25 insertions, 16 deletions
diff --git a/portato/plugins/etc_proposals.py b/portato/plugins/etc_proposals.py
index 81370e0..f094599 100644
--- a/portato/plugins/etc_proposals.py
+++ b/portato/plugins/etc_proposals.py
@@ -13,6 +13,7 @@
from portato.helper import *
from portato.backend import system
+import os
from subprocess import Popen
from gettext import lgettext as _
from etcproposals.etcproposals_lib import EtcProposals, __version__
@@ -64,7 +65,7 @@ def etc_prop (*args, **kwargs):
error(_("Cannot start etc-proposals. No graphical frontend installed!"))
def etc_prop_menu (*args, **kwargs):
- if am_i_root():
+ if os.getuid() == 0:
if float(__version__) < 1.1:
Popen(PROG)
else:
diff --git a/portato/plugins/noroot.py b/portato/plugins/noroot.py
deleted file mode 100644
index a28ef85..0000000
--- a/portato/plugins/noroot.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# File: portato/plugins/noroot.py
-# This file is part of the Portato-Project, a graphical portage-frontend.
-#
-# Copyright (C) 2007 René 'Necoro' Neumann
-# This is free software. You may redistribute copies of it under the terms of
-# the GNU General Public License version 2.
-# There is NO WARRANTY, to the extent permitted by law.
-#
-# Written by René 'Necoro' Neumann <necoro@necoro.net>
-
-def i_am_root (*args):
- """Pretend we are root."""
- return True
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)
insertions'>+477 2008-01-14 r605@Devoty: necoro | 2008-01-14 11:43:34 +0100Necoro2-26/+129 2008-01-14 r603@Devoty: necoro | 2008-01-14 11:30:26 +0100Necoro4-26/+38 2008-01-11 r598@Devoty: necoro | 2008-01-10 16:36:29 +0100Necoro4-10/+50 2008-01-11 r597@Devoty: necoro | 2008-01-10 14:12:35 +0100Necoro1-3/+3 2008-01-10 r595@Devoty: necoro | 2008-01-10 04:04:15 +0100Necoro1-52/+3 2008-01-09 r586@Devoty: necoro | 2008-01-09 14:54:18 +0100Necoro1-1/+1 2007-12-06 r577@Devoty: necoro | 2007-12-06 20:37:36 +0100Necoro1-1/+1 2007-12-06 r572@Devoty: necoro | 2007-11-28 08:48:15 +0100Necoro1-0/+1 2007-11-27 r570@Devoty: necoro | 2007-11-27 02:08:21 +0100Necoro3-84/+108