X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/67b53c1cb06988394c35a6e965c99b72b67fe1be..28f2c454309697e78017bf2df4fdbcd8cebd9ed1:/lib/python/Screens/Console.py diff --git a/lib/python/Screens/Console.py b/lib/python/Screens/Console.py index c2e1688d..0ceba3ec 100644 --- a/lib/python/Screens/Console.py +++ b/lib/python/Screens/Console.py @@ -7,14 +7,15 @@ class Console(Screen): #TODO move this to skin.xml skin = """ - + """ - def __init__(self, session, title = "Console", cmdlist = None, finishedCallback = None): + def __init__(self, session, title = "Console", cmdlist = None, finishedCallback = None, closeOnSuccess = False): self.skin = Console.skin Screen.__init__(self, session) self.finishedCallback = finishedCallback + self.closeOnSuccess = closeOnSuccess self["text"] = ScrollLabel("") self["actions"] = ActionMap(["WizardActions", "DirectionActions"], @@ -42,22 +43,28 @@ class Console(Screen): def startRun(self): self["text"].setText(_("Execution Progress:") + "\n\n") print "Console: executing in run", self.run, " the command:", self.cmdlist[self.run] - self.container.execute(self.cmdlist[self.run]) + if self.container.execute(self.cmdlist[self.run]): #start of container application failed... + self.runFinished(-1) # so we must call runFinished manual def runFinished(self, retval): self.run += 1 if self.run != len(self.cmdlist): - self.container.execute(self.cmdlist[self.run]) + if self.container.execute(self.cmdlist[self.run]): #start of container application failed... + self.runFinished(-1) # so we must call runFinished manual else: str = self["text"].getText() str += _("Execution finished!!"); self["text"].setText(str) if self.finishedCallback is not None: self.finishedCallback() - + if not retval and self.closeOnSuccess: + self.cancel() + def cancel(self): if self.run == len(self.cmdlist): self.close() + self.container.appClosed.get().remove(self.runFinished) + self.container.dataAvail.get().remove(self.dataAvail) def dataAvail(self, str): self["text"].setText(self["text"].getText() + str)