git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
VirtualKeyBoard: Add cz/sk layout (patch from Petr)to VirtualKeyBoard. Add possibilit...
[enigma2.git]
/
lib
/
python
/
Components
/
Console.py
diff --git
a/lib/python/Components/Console.py
b/lib/python/Components/Console.py
old mode 100644
(file)
new mode 100755
(executable)
index
b034824
..
a41317e
--- a/
lib/python/Components/Console.py
+++ b/
lib/python/Components/Console.py
@@
-8,7
+8,7
@@
class Console(object):
self.callbacks = {}
self.extra_args = {}
self.callbacks = {}
self.extra_args = {}
- def ePopen(self, cmd, callback, extra_args=[]):
+ def ePopen(self, cmd, callback
=None
, extra_args=[]):
name = cmd
i = 0
while self.appContainers.has_key(name):
name = cmd
i = 0
while self.appContainers.has_key(name):
@@
-21,24
+21,26
@@
class Console(object):
self.appContainers[name] = eConsoleAppContainer()
self.appContainers[name].dataAvail.append(boundFunction(self.dataAvailCB,name))
self.appContainers[name].appClosed.append(boundFunction(self.finishedCB,name))
self.appContainers[name] = eConsoleAppContainer()
self.appContainers[name].dataAvail.append(boundFunction(self.dataAvailCB,name))
self.appContainers[name].appClosed.append(boundFunction(self.finishedCB,name))
- retval = self.appContainers[name].execute(cmd)
+ if isinstance(cmd, str): # until .execute supports a better api
+ cmd = [cmd]
+ retval = self.appContainers[name].execute(*cmd)
if retval:
self.finishedCB(name, retval)
if retval:
self.finishedCB(name, retval)
- def eBatch(self, cmds, callback, debug=False):
+ def eBatch(self, cmds, callback,
extra_args=[],
debug=False):
self.debug = debug
cmd = cmds.pop(0)
self.debug = debug
cmd = cmds.pop(0)
- self.ePopen(cmd, self.eBatchCB, [cmds, callback,
cmd
])
+ self.ePopen(cmd, self.eBatchCB, [cmds, callback,
extra_args
])
- def eBatchCB(self, data, retval, extra_args):
- (cmds, callback,
lastcmd) =
extra_args
+ def eBatchCB(self, data, retval,
_
extra_args):
+ (cmds, callback,
extra_args) = _
extra_args
if self.debug:
if self.debug:
- print '[eBatch]
cmd="%s", retval=%s, cmds left=%d, data:\n%s' % (lastcmd,
retval, len(cmds), data)
+ print '[eBatch]
retval=%s, cmds left=%d, data:\n%s' % (
retval, len(cmds), data)
if len(cmds):
cmd = cmds.pop(0)
if len(cmds):
cmd = cmds.pop(0)
- self.ePopen(cmd, self.eBatchCB, [cmds, callback,
cmd
])
+ self.ePopen(cmd, self.eBatchCB, [cmds, callback,
extra_args
])
else:
else:
- callback()
+ callback(
extra_args
)
def dataAvailCB(self, name, data):
self.appResults[name] += data
def dataAvailCB(self, name, data):
self.appResults[name] += data
@@
-50,5
+52,15
@@
class Console(object):
extra_args = self.extra_args[name]
del self.appContainers[name]
del self.extra_args[name]
extra_args = self.extra_args[name]
del self.appContainers[name]
del self.extra_args[name]
- self.callbacks[name](data,retval,extra_args)
+ if self.callbacks[name]:
+ self.callbacks[name](data,retval,extra_args)
del self.callbacks[name]
del self.callbacks[name]
+
+ def kill(self,name):
+ if name in self.appContainers:
+ print "[Console] killing: ",self.appContainers[name]
+ self.appContainers[name].kill()
+
+ def killAll(self):
+ for name in self.appContainers:
+ self.kill(name)