From: Stefan Pluecken Date: Tue, 10 Jan 2006 16:09:56 +0000 (+0000) Subject: forgot to commit the update plugin :) X-Git-Tag: 2.6.0~4484 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/8ab23815c0b8c81d049ffe2e64d2566027b1b9df forgot to commit the update plugin :) --- diff --git a/lib/python/Plugins/update/plugin.py b/lib/python/Plugins/update/plugin.py new file mode 100644 index 00000000..500b6825 --- /dev/null +++ b/lib/python/Plugins/update/plugin.py @@ -0,0 +1,71 @@ +from enigma import * +from Screens.Screen import Screen +from Screens.MessageBox import MessageBox +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(_("Please press OK!")) + + self["actions"] = ActionMap(["WizardActions"], + { + "ok": self.go, + "back": self.close + }, -1) + + self.update = True + self.delayTimer = eTimer() + self.delayTimer.timeout.get().append(self.doUpdateDelay) + + def go(self): + if self.update: + self.session.openWithCallback(self.doUpdate, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!")) + else: + self.close() + + def doUpdateDelay(self): + lines = os.popen("ipkg update && ipkg upgrade", "r").readlines() + string = "" + for x in lines: + string += x + self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string) + self.update = False + + + def doUpdate(self, val = False): + if val == True: + self["text"].setText(_("Updating... Please wait... This can take some minutes...")) + self.delayTimer.start(0, 1) + else: + self.close() + +#def autostart(): + #print "**************************** AUTOSTART" +# +#def autoend(): + #print "**************************** AUTOEND" + +def main(session): + session.open(Example) + +def getPicturePath(): + return "update.png" + +def getPluginName(): + return "Softwareupdate" + +def getMenuRegistrationList(): + list = [] + list.append(("setup", 2, "Softwareupdate", "Example")) + return list \ No newline at end of file