diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/etc_proposals.py | 43 | ||||
-rw-r--r-- | plugins/etc_proposals.xml | 19 | ||||
-rw-r--r-- | plugins/gpytage.py | 27 | ||||
-rw-r--r-- | plugins/gpytage.xml | 13 | ||||
-rw-r--r-- | plugins/notify.py | 45 | ||||
-rw-r--r-- | plugins/notify.xml | 13 |
6 files changed, 115 insertions, 45 deletions
diff --git a/plugins/etc_proposals.py b/plugins/etc_proposals.py new file mode 100644 index 0000000..07f9a80 --- /dev/null +++ b/plugins/etc_proposals.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/etc_proposals.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2007-2008 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> + +from portato.helper import error + +import os +from subprocess import Popen + +class EtcProposals (Plugin): + __author__ = "René 'Necoro' Neumann" + __description__ = "Adds support for <b>etc-proposals</b>, a graphical etc-update replacement." + __dependency__ = ["app-portage/etc-proposals"] + + def __init__ (self): + Plugin.__init__(self) + + self.prog = ["/usr/sbin/etc-proposals"] + self.add_call("after_emerge", self.hook, type = "after") + self.add_menu("Et_c-Proposals", self.menu) + + def launch (self, options = []): + if os.getuid() == 0: + Popen(self.prog+options) + else: + error("ETC_PROPOSALS :: %s",_("Cannot start etc-proposals. Not root!")) + + def hook (self, *args, **kwargs): + """Entry point for this plugin.""" + self.launch(["--fastexit"]) + + def menu (self, *args): + self.launch() + +register(EtcProposals) diff --git a/plugins/etc_proposals.xml b/plugins/etc_proposals.xml deleted file mode 100644 index 2caf341..0000000 --- a/plugins/etc_proposals.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<plugin xmlns="http://portato.sourceforge.net/plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://portato.sourceforge.net/plugin http://portato.sourceforge.net/plugin.xsd"> - - <author>René 'Necoro' Neumann</author> - <name>Etc-proposals</name> - - <import>portato.plugins.etc_proposals</import> - - <hooks> - <hook type = "after_emerge" call = "etc_prop"> - <connect type="after" /> - </hook> - </hooks> - - <menu> - <item call="etc_prop_menu">Et_c-Proposals</item> - </menu> - -</plugin> diff --git a/plugins/gpytage.py b/plugins/gpytage.py new file mode 100644 index 0000000..33509e1 --- /dev/null +++ b/plugins/gpytage.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/gpytage.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2008 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> + +from subprocess import Popen + +class GPytage (Plugin): + __author__ = "René 'Necoro' Neumann" + __description__ = "Adds a menu entry to directly start <b>gpytage</b>, a config editor." + __dependency__ = ["app-portage/gpytage"] + + def __init__ (self): + Plugin.__init__(self) + self.add_menu("Config _Editor", self.menu) + + def menu (self, *args): + Popen(["/usr/bin/gpytage"]) + +register(GPytage) diff --git a/plugins/gpytage.xml b/plugins/gpytage.xml deleted file mode 100644 index b203ae0..0000000 --- a/plugins/gpytage.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<plugin xmlns="http://portato.sourceforge.net/plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://portato.sourceforge.net/plugin http://portato.sourceforge.net/plugin.xsd"> - - <author>René 'Necoro' Neumann</author> - <name>GPytage</name> - - <import>portato.plugins.gpytage</import> - - <menu> - <item call="gpytage">Config _Editor</item> - </menu> - -</plugin> diff --git a/plugins/notify.py b/plugins/notify.py new file mode 100644 index 0000000..bc1b2ea --- /dev/null +++ b/plugins/notify.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/notify.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2007-2008 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> + +import pynotify + +from portato import get_listener + +from portato.helper import warning, error, debug +from portato.constants import APP_ICON, APP + +class Notify (Plugin): + __author__ = "René 'Necoro' Neumann" + __description__ = "Show notifications when an emerge process finishes." + __dependency__ = ["dev-python/notify-python"] + + def __init__ (self): + Plugin.__init__(self) + self.add_call("after_emerge", self.notify) + + def notify (self, retcode, **kwargs): + if retcode is None: + warning("NOTIFY :: %s", _("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 + + get_listener().send_notify(base = text, descr = descr, icon = icon, urgency = urgency) + +register(Notify) diff --git a/plugins/notify.xml b/plugins/notify.xml deleted file mode 100644 index 9a89987..0000000 --- a/plugins/notify.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<plugin xmlns="http://portato.sourceforge.net/plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://portato.sourceforge.net/plugin http://portato.sourceforge.net/plugin.xsd"> - - <author>René 'Necoro' Neumann</author> - <name>Notify</name> - - <import>portato.plugins.notify</import> - - <hooks> - <hook type = "after_emerge" call = "notify" /> - </hooks> - -</plugin> |