From 7fe27f601f70eddb3019e22cbdb8388c05d3af7e Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 21 Dec 2005 05:16:20 +0000 Subject: [PATCH] add a small ipkg upgrade plugin --- lib/python/Components/PluginComponent.py | 7 ++-- lib/python/Plugins/Makefile.am | 3 +- lib/python/Plugins/update.py | 42 ++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 lib/python/Plugins/update.py diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index 26382063..f1a0a95a 100644 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -27,7 +27,10 @@ class PluginComponent: return list def runPlugin(self, plugin, session): - exec "import " + self.prefix + plugin[2] - eval(self.prefix + plugin[2]).main(session) + try: + exec "import " + self.prefix + plugin[2] + eval(self.prefix + plugin[2]).main(session) + except: + print "exec of plugin failed!" plugins = PluginComponent() diff --git a/lib/python/Plugins/Makefile.am b/lib/python/Plugins/Makefile.am index d963b3c0..febecab4 100644 --- a/lib/python/Plugins/Makefile.am +++ b/lib/python/Plugins/Makefile.am @@ -2,4 +2,5 @@ installdir = $(LIBDIR)/enigma2/python/Plugins install_PYTHON = \ __init__.py \ - example.py \ No newline at end of file + update.py \ +# example.py diff --git a/lib/python/Plugins/update.py b/lib/python/Plugins/update.py new file mode 100644 index 00000000..7126875b --- /dev/null +++ b/lib/python/Plugins/update.py @@ -0,0 +1,42 @@ +from enigma import * +from Screens.Screen import Screen +from Components.ActionMap import ActionMap +from Components.Label import Label + +import os + +class Example(Screen): + skin = """ + + + """ + + def __init__(self, session): + self.skin = Example.skin + Screen.__init__(self, session) + + self["text"] = Label("Press OK to upgrade") + + self["actions"] = ActionMap(["WizardActions"], + { + "ok": self.ok, + "back": self.close + }, -1) + + def ok(self): + lines = os.popen("ipkg update && ipkg upgrade", "r").readlines() + string = "" + for x in lines: + string += x + self["text"].setText(string) + + +def main(session): + session.open(Example) + + +def getPicturePath(): + return "" + +def getPluginName(): + return "Softwareupdate" \ No newline at end of file -- 2.30.2