From 4d34fa926142b8bb9250141d2dd252be5a78a10d Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sat, 8 Feb 2020 13:40:51 +0100 Subject: [PATCH] [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. --- core/input.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/input.py b/core/input.py index 1b76016..dde22a8 100644 --- a/core/input.py +++ b/core/input.py @@ -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