1 from enigma import eConsoleAppContainer
2 from Screens.Screen import Screen
3 from Components.ActionMap import ActionMap, NumberActionMap
4 from Components.ScrollLabel import ScrollLabel
7 #TODO move this to skin.xml
9 <screen position="100,100" size="550,400" title="Command execution..." >
10 <widget name="text" position="0,0" size="550,400" font="Regular;15" />
13 def __init__(self, session, title = "Console", cmdlist = None):
14 self.skin = Console.skin
15 Screen.__init__(self, session)
17 self["text"] = ScrollLabel("")
18 self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
22 "up": self["text"].pageUp,
23 "down": self["text"].pageDown
26 self.cmdlist = cmdlist
29 self.onShown.append(self.updateTitle)
31 self.container = eConsoleAppContainer()
33 self.container.appClosed.get().append(self.runFinished)
34 self.container.dataAvail.get().append(self.dataAvail)
35 self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
37 def updateTitle(self):
38 self.setTitle(self.newtitle)
41 self["text"].setText(_("Execution Progress:") + "\n\n")
42 print "Console: executing in run", self.run, " the command:", self.cmdlist[self.run]
43 self.container.execute(self.cmdlist[self.run])
45 def runFinished(self, retval):
47 if self.run != len(self.cmdlist):
48 self.container.execute(self.cmdlist[self.run])
50 str = self["text"].getText()
51 str += _("Execution finished!!");
52 self["text"].setText(str)
55 if self.run == len(self.cmdlist):
58 def dataAvail(self, str):
59 self["text"].setText(self["text"].getText() + str)