X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FScreens%2FConsole.py;h=622fb447973d76005d738a90546bc3077d3c2c64;hp=03b0249b3d4b3eb7852233bf35df0bdd313181c8;hb=6f73e6abddf4170357c490966d0e1c622eb376f5;hpb=948213ba7e5d1bc6a9c4d7f5f9d35c53186b60d3 diff --git a/lib/python/Screens/Console.py b/lib/python/Screens/Console.py index 03b0249..622fb44 100644 --- a/lib/python/Screens/Console.py +++ b/lib/python/Screens/Console.py @@ -1,6 +1,6 @@ from enigma import eConsoleAppContainer from Screens.Screen import Screen -from Components.ActionMap import ActionMap, NumberActionMap +from Components.ActionMap import ActionMap from Components.ScrollLabel import ScrollLabel class Console(Screen): @@ -10,11 +10,12 @@ class Console(Screen): """ - 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,19 +43,23 @@ 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()