X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/568bc959ef68e29e12afb857d01de2e1f7517e4d..a0842dd1b96a660acedf4894690c3ab37c24094d:/lib/python/Screens/Console.py diff --git a/lib/python/Screens/Console.py b/lib/python/Screens/Console.py new file mode 100644 index 00000000..17d706f5 --- /dev/null +++ b/lib/python/Screens/Console.py @@ -0,0 +1,52 @@ +from enigma import eConsoleAppContainer +from Screens.Screen import Screen +from Components.ActionMap import ActionMap, NumberActionMap +from Components.ScrollLabel import ScrollLabel + +class Console(Screen): + #TODO move this to skin.xml + skin = """ + + + """ + + def __init__(self, session, args = None): + self.skin = Console.skin + Screen.__init__(self, session) + + self["text"] = ScrollLabel("") + self["actions"] = ActionMap(["WizardActions", "DirectionActions"], + { + "ok": self.cancel, + "back": self.cancel, + "up": self["text"].pageUp, + "down": self["text"].pageDown + }, -1) + + self.cmdlist = args + + self.container = eConsoleAppContainer() + self.run = 0 + self.container.appClosed.get().append(self.runFinished) + self.container.dataAvail.get().append(self.dataAvail) + self.onLayoutFinish.append(self.startRun) # dont start before gui is finished + + def startRun(self): + self["text"].setText(_("Execution Progress:") + "\n\n") + self.container.execute("ipkg update") + + def runFinished(self, retval): + self.run += 1 + if self.run != len(self.cmdlist): + self.container.execute(self.cmdlist[self.run]) + else: + str = self["text"].getText() + str += _("Execution finished!!"); + self["text"].setText(str) + + def cancel(self): + if self.run == len(self.cmdlist): + self.close() + + def dataAvail(self, str): + self["text"].setText(self["text"].getText() + str) \ No newline at end of file