X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/33cefb362d699372b409e659517285b1eab1d61b..1dc4ace24c93b9e078a9a1cc5180da725defc1a8:/lib/python/Plugins/update/plugin.py diff --git a/lib/python/Plugins/update/plugin.py b/lib/python/Plugins/update/plugin.py index 1ae0e5f6..8c2715bf 100644 --- a/lib/python/Plugins/update/plugin.py +++ b/lib/python/Plugins/update/plugin.py @@ -106,31 +106,41 @@ class Upgrade(Screen): Screen.__init__(self, session) self["text"] = ScrollLabel(_("Updating... Please wait... This can take some minutes...")) - self["actions"] = ActionMap(["WizardActions", "DirectionActions"], { - "ok": self.go, - "back": self.close, + "ok": self.cancel, + "back": self.cancel, "up": self["text"].pageUp, "down": self["text"].pageDown }, -1) - self.delayTimer = eTimer() - self.delayTimer.timeout.get().append(self.doUpdateDelay) - # WARNING! Don't copy this code! this code could harm your children! It is ugly, bad and must be banned from this world! - # it only exists due to some lack of competence by the core system designers. - self.delayTimer.start(1, 1) - - def go(self): - self.close() - - def doUpdateDelay(self): - lines = os.popen("ipkg update && ipkg upgrade -force-defaults -force-overwrite", "r").readlines() - string = "" - for x in lines: - string += x - self["text"].setText(_("Updating finished. Here is the result:") + "\n\n" + string) + self.container = eConsoleAppContainer() + self.run = 0 + self.container.appClosed.get().append(self.updateFinished) + self.container.dataAvail.get().append(self.dataAvail) + self.onLayoutFinish.append(self.startUpdate) # dont start before gui is finished + + def startUpdate(self): + self["text"].setText(_("Update Progress:") + "\n\n") + self.container.execute("ipkg update") + + def updateFinished(self, retval): + if self.run == 0: + self.run = 1 + self.container.execute("ipkg upgrade") + elif self.run == 1: + str = self["text"].getText() + str += _("Updating finished!!"); + self["text"].setText(str) + self.run = 2 + def cancel(self): + if self.run == 2: + self.close() + + def dataAvail(self, str): + self["text"].setText(self["text"].getText() + str) + RT_HALIGN_LEFT = 0 RT_HALIGN_RIGHT = 1 RT_HALIGN_CENTER = 2