git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add 'layers' (in buffered mode, which is not working at the moment).
[enigma2.git]
/
lib
/
python
/
Screens
/
Console.py
diff --git
a/lib/python/Screens/Console.py
b/lib/python/Screens/Console.py
index d13729f86500bcd8eacc7ea74ed43608df217094..b8f74125b51ae5e606dbb7b10a986151c86ebea0 100644
(file)
--- 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 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):
from Components.ScrollLabel import ScrollLabel
class Console(Screen):
@@
-10,10
+10,13
@@
class Console(Screen):
<widget name="text" position="0,0" size="550,400" font="Regular;15" />
</screen>"""
<widget name="text" position="0,0" size="550,400" font="Regular;15" />
</screen>"""
- def __init__(self, session,
args = Non
e):
+ def __init__(self, session,
title = "Console", cmdlist = None, finishedCallback = None, closeOnSuccess = Fals
e):
self.skin = Console.skin
Screen.__init__(self, session)
self.skin = Console.skin
Screen.__init__(self, session)
+ self.finishedCallback = finishedCallback
+ self.closeOnSuccess = closeOnSuccess
+
self["text"] = ScrollLabel("")
self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
{
self["text"] = ScrollLabel("")
self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
{
@@
-23,7
+26,10
@@
class Console(Screen):
"down": self["text"].pageDown
}, -1)
"down": self["text"].pageDown
}, -1)
- self.cmdlist = args
+ self.cmdlist = cmdlist
+ self.newtitle = title
+
+ self.onShown.append(self.updateTitle)
self.container = eConsoleAppContainer()
self.run = 0
self.container = eConsoleAppContainer()
self.run = 0
@@
-31,8
+37,12
@@
class Console(Screen):
self.container.dataAvail.get().append(self.dataAvail)
self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
self.container.dataAvail.get().append(self.dataAvail)
self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
+ def updateTitle(self):
+ self.setTitle(self.newtitle)
+
def startRun(self):
self["text"].setText(_("Execution Progress:") + "\n\n")
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])
def runFinished(self, retval):
self.container.execute(self.cmdlist[self.run])
def runFinished(self, retval):
@@
-43,7
+53,11
@@
class Console(Screen):
str = self["text"].getText()
str += _("Execution finished!!");
self["text"].setText(str)
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()
def cancel(self):
if self.run == len(self.cmdlist):
self.close()