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 possibility to remove timers in epglist
[enigma2.git]
/
lib
/
python
/
Screens
/
Console.py
diff --git
a/lib/python/Screens/Console.py
b/lib/python/Screens/Console.py
index 17d706f53e0666790490b8d1ede09e0fac521b3e..c6b156cfb7893fc7de31f9e357100ce98e4baddd 100644
(file)
--- a/
lib/python/Screens/Console.py
+++ b/
lib/python/Screens/Console.py
@@
-1,19
+1,22
@@
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):
#TODO move this to skin.xml
skin = """
<screen position="100,100" size="550,400" title="Command execution..." >
from Components.ScrollLabel import ScrollLabel
class Console(Screen):
#TODO move this to skin.xml
skin = """
<screen position="100,100" size="550,400" title="Command execution..." >
- <widget name="text" position="0,0" size="550,400" font="
Regular;15
" />
+ <widget name="text" position="0,0" size="550,400" font="
Console;14
" />
</screen>"""
</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,30
+26,46
@@
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
- self.container.appClosed.
get().
append(self.runFinished)
- self.container.dataAvail.
get().
append(self.dataAvail)
+ self.container.appClosed.append(self.runFinished)
+ self.container.dataAvail.append(self.dataAvail)
self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
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")
- self.container.execute("ipkg update")
+ print "Console: executing in run", self.run, " the command:", 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):
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)
else:
str = self["text"].getText()
str += _("Execution finished!!");
self["text"].setText(str)
-
+ self["text"].lastPage()
+ 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()
+ self.container.appClosed.remove(self.runFinished)
+ self.container.dataAvail.remove(self.dataAvail)
def dataAvail(self, str):
self["text"].setText(self["text"].getText() + str)
\ No newline at end of file
def dataAvail(self, str):
self["text"].setText(self["text"].getText() + str)
\ No newline at end of file