[core/input] Use util.cli to execute commands
If the registered callback is not callable (i.e. no Python method), assume it's a command that should be invoked via a shell.
This commit is contained in:
parent
9d4936b596
commit
4d34fa9261
1 changed files with 5 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
import uuid
|
||||
import util.cli
|
||||
|
||||
LEFT_MOUSE = 1
|
||||
MIDDLE_MOUSE = 2
|
||||
|
@ -10,7 +11,8 @@ callbacks = {}
|
|||
|
||||
class Object(object):
|
||||
def __init__(self):
|
||||
self._id = uuid.uuid4()
|
||||
super(Object, self).__init__()
|
||||
self._id = str(uuid.uuid4())
|
||||
|
||||
def id(self):
|
||||
return self._id
|
||||
|
@ -31,5 +33,7 @@ def _invoke(event, callback):
|
|||
for cb in callback.get(event['button']):
|
||||
if callable(cb):
|
||||
cb(event)
|
||||
else:
|
||||
util.cli.execute(cb, wait=False)
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Reference in a new issue