From dd83f2011ffee4d8eea7b78f86631c7266cdfdc2 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 3 Jul 2008 23:21:09 +0200 Subject: Ported Notify plugin --- portato/plugins/__init__.py | 7 ++++++- portato/plugins/notify.py | 22 ---------------------- 2 files changed, 6 insertions(+), 23 deletions(-) delete mode 100644 portato/plugins/notify.py (limited to 'portato/plugins') diff --git a/portato/plugins/__init__.py b/portato/plugins/__init__.py index fe95dbc..5080cec 100644 --- a/portato/plugins/__init__.py +++ b/portato/plugins/__init__.py @@ -3,9 +3,14 @@ # File: portato/plugins/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007 René 'Necoro' Neumann +# 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 + +""" +This is a dummy module. The plugins loaded from here are in reality stored +in /usr/share/portato/plugins or alike. +""" diff --git a/portato/plugins/notify.py b/portato/plugins/notify.py deleted file mode 100644 index 78812b3..0000000 --- a/portato/plugins/notify.py +++ /dev/null @@ -1,22 +0,0 @@ -import pynotify - -from portato import get_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 :: %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) -- cgit v1.2.3-54-g00ecf From 1540e5c8fbba5713e0176c8812f7473ea5e91037 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 3 Jul 2008 23:25:24 +0200 Subject: Ported gpytage plugin --- plugins/gpytage.py | 27 +++++++++++++++++++++++++++ plugins/gpytage.xml | 13 ------------- portato/plugins/gpytage.py | 16 ---------------- 3 files changed, 27 insertions(+), 29 deletions(-) create mode 100644 plugins/gpytage.py delete mode 100644 plugins/gpytage.xml delete mode 100644 portato/plugins/gpytage.py (limited to 'portato/plugins') 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 + +from subprocess import Popen + +class GPytage (Plugin): + __author__ = "René 'Necoro' Neumann" + __description__ = "Adds a menu entry to directly start gpytage, 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 @@ - - - - René 'Necoro' Neumann - GPytage - - portato.plugins.gpytage - - - Config _Editor - - - diff --git a/portato/plugins/gpytage.py b/portato/plugins/gpytage.py deleted file mode 100644 index 22cc7ef..0000000 --- a/portato/plugins/gpytage.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# -# File: portato/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 - -from subprocess import Popen - -def gpytage(*args, **kwargs): - Popen(["/usr/bin/gpytage"]) -- cgit v1.2.3-54-g00ecf From e42090a8bd7dcc5f9e7c6e41b0f44698588e6586 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 3 Jul 2008 23:33:21 +0200 Subject: Ported etc-proposals plugin --- plugins/etc_proposals.py | 43 ++++++++++++++++++++++++++++++++++++++++ plugins/etc_proposals.xml | 19 ------------------ portato/plugins/etc_proposals.py | 31 ----------------------------- 3 files changed, 43 insertions(+), 50 deletions(-) create mode 100644 plugins/etc_proposals.py delete mode 100644 plugins/etc_proposals.xml delete mode 100644 portato/plugins/etc_proposals.py (limited to 'portato/plugins') diff --git a/plugins/etc_proposals.py b/plugins/etc_proposals.py new file mode 100644 index 0000000..f02cef5 --- /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 + +from portato.helper import error + +import os +from subprocess import Popen + +class EtcProposals (Plugin): + __author__ = "René 'Necoro' Neumann" + __description__ = "Adds support for etc-proposals, 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 @@ - - - - René 'Necoro' Neumann - Etc-proposals - - portato.plugins.etc_proposals - - - - - - - - - Et_c-Proposals - - - diff --git a/portato/plugins/etc_proposals.py b/portato/plugins/etc_proposals.py deleted file mode 100644 index d5f707f..0000000 --- a/portato/plugins/etc_proposals.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -# -# File: portato/plugins/etc_proposals.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 - -from portato.helper import error - -import os -from subprocess import Popen - -PROG=["/usr/sbin/etc-proposals"] - -def launch (options = []): - if os.getuid() == 0: - Popen(PROG+options) - else: - error("ETC_PROPOSALS :: %s",_("Cannot start etc-proposals. Not root!")) - -def etc_prop (*args, **kwargs): - """Entry point for this plugin.""" - launch(["--fastexit"]) - -def etc_prop_menu (*args, **kwargs): - launch() -- cgit v1.2.3-54-g00ecf From 92017bd23d9b29810fb6a5a4987daa810fe5bb42 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Fri, 4 Jul 2008 17:58:19 +0200 Subject: Ported remaining plugins --- plugins/exception.py | 20 +++++++++++ plugins/exception.xml | 13 ------- plugins/new_version.py | 80 ++++++++++++++++++++++++++++++++++++++++++ plugins/new_version.xml | 16 --------- portato/plugins/exception.py | 2 -- portato/plugins/new_version.py | 58 ------------------------------ 6 files changed, 100 insertions(+), 89 deletions(-) create mode 100644 plugins/exception.py delete mode 100644 plugins/exception.xml create mode 100644 plugins/new_version.py delete mode 100644 plugins/new_version.xml delete mode 100644 portato/plugins/exception.py delete mode 100644 portato/plugins/new_version.py (limited to 'portato/plugins') diff --git a/plugins/exception.py b/plugins/exception.py new file mode 100644 index 0000000..e653853 --- /dev/null +++ b/plugins/exception.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/exception.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 + +def throw (*args, **kwargs): + raise Exception, "As requested, Sir!" + +p = Plugin() +p.__name__ = "ExceptionThrower" +p.__author__ = "René 'Necoro' Neumann" +p.add_menu("Throw exception", throw) +register(p) diff --git a/plugins/exception.xml b/plugins/exception.xml deleted file mode 100644 index 385e743..0000000 --- a/plugins/exception.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - René 'Necoro' Neumann - Exception Thrower - - portato.plugins.exception - - - Throw exception - - - diff --git a/plugins/new_version.py b/plugins/new_version.py new file mode 100644 index 0000000..f3479b4 --- /dev/null +++ b/plugins/new_version.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/new_version.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 + +try: + from bzrlib import plugin, branch +except ImportError: + plugin = branch = None +import gobject + +from portato.helper import debug, warning +from portato import get_listener +from portato.constants import VERSION, APP_ICON, APP +from portato.gui.utils import GtkThread + +class NewVersionFinder(Plugin): + """ + Checks for a new version of portato every 30 minutes and on startup. + """ + __author__ = "René 'Necoro' Neumann" + __dependency__ = ["dev-util/bzr"] + + def init (self): + self.add_call("main", self.run) + self.add_menu("Check for new _versions", self.menu) + + def find_version (self, rev): + try: + b = branch.Branch.open("lp:portato") + except Exception, e: + warning("NEW_VERSION :: Exception occured while accessing the remote branch: %s", str(e)) + return + + debug("NEW_VERSION :: Installed rev: %s - Current rev: %s", rev, b.revno()) + if int(rev) < int(b.revno()): + def callback(): + get_listener().send_notify(base = "New Portato Live Version Found", descr = "You have rev. %s, but the most recent revision is %s." % (rev, b.revno()), icon = APP_ICON) + return False + + gobject.idle_add(callback) + + def start_thread(self, rev): + t = GtkThread(target = self.find_version, name = "Version Updater Thread", args = (rev,)) + t.setDaemon(True) + t.start() + return True + + def menu (self, *args, **kwargs): + """ + Run the thread once. + """ + v = VERSION.split() + if len(v) != 3 or v[0] != "9999": + return None + + rev = v[-1] + + plugin.load_plugins() # to have lp: addresses parsed + + self.start_thread(rev) + return rev + + def run (self, *args, **kwargs): + """ + Run the thread once and add a 30 minutes timer. + """ + rev = self.menu() + + if rev is not None: + gobject.timeout_add(30*60*1000, self.start_thread, rev) # call it every 30 minutes + +register(NewVersionFinder, (branch is None)) diff --git a/plugins/new_version.xml b/plugins/new_version.xml deleted file mode 100644 index 2711054..0000000 --- a/plugins/new_version.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - René 'Necoro' Neumann - New Version Reminder - - portato.plugins.new_version - - - - - - - Check for new _versions - - diff --git a/portato/plugins/exception.py b/portato/plugins/exception.py deleted file mode 100644 index 64bdb77..0000000 --- a/portato/plugins/exception.py +++ /dev/null @@ -1,2 +0,0 @@ -def throw (*args, **kwargs): - raise Exception, "As requested, Sir!" diff --git a/portato/plugins/new_version.py b/portato/plugins/new_version.py deleted file mode 100644 index fe69292..0000000 --- a/portato/plugins/new_version.py +++ /dev/null @@ -1,58 +0,0 @@ -try: - from bzrlib import plugin, branch -except ImportError: - plugin = branch = None -import gobject - -from portato.helper import debug, warning -from portato import get_listener -from portato.constants import VERSION, APP_ICON, APP -from portato.gui.utils import GtkThread - -def find_version (rev): - try: - b = branch.Branch.open("lp:portato") - except Exception, e: - warning("NEW_VERSION :: Exception occured while accessing the remote branch: %s", str(e)) - return - - debug("NEW_VERSION :: Installed rev: %s - Current rev: %s", rev, b.revno()) - if int(rev) < int(b.revno()): - def callback(): - get_listener().send_notify(base = "New Portato Live Version Found", descr = "You have rev. %s, but the most recent revision is %s." % (rev, b.revno()), icon = APP_ICON) - return False - - gobject.idle_add(callback) - -def start_thread(rev): - t = GtkThread(target = find_version, name = "Version Updater Thread", args = (rev,)) - t.setDaemon(True) - t.start() - return True - -def run_menu (*args, **kwargs): - """ - Run the thread once. - """ - if not all((plugin, branch)): - return None - - v = VERSION.split() - if len(v) != 3 or v[0] != "9999": - return None - - rev = v[-1] - - plugin.load_plugins() # to have lp: addresses parsed - - start_thread(rev) - return rev - -def run (*args, **kwargs): - """ - Run the thread once and add a 30 minutes timer. - """ - rev = run_menu() - - if rev is not None: - gobject.timeout_add(30*60*1000, start_thread, rev) # call it every 30 minutes -- cgit v1.2.3-54-g00ecf