[core/module] add missing registration of input events via CLI

see #628
This commit is contained in:
tobi-wan-kenobi 2020-05-15 19:59:13 +02:00
parent bfe5d8f493
commit 3bb2fb8247
2 changed files with 13 additions and 0 deletions

View file

@ -102,6 +102,7 @@ def main():
for module in config.modules(): for module in config.modules():
modules.append(core.module.load(module, config, theme)) modules.append(core.module.load(module, config, theme))
modules[-1].register_callbacks()
if config.reverse(): if config.reverse():
modules.reverse() modules.reverse()

View file

@ -201,6 +201,18 @@ class Module(core.input.Object):
return "warning" return "warning"
return None return None
def register_callbacks(self):
actions = [
{ "name": "left-click", "id": core.input.LEFT_MOUSE },
{ "name": "right-click", "id": core.input.RIGHT_MOUSE },
{ "name": "middle-click", "id": core.input.MIDDLE_MOUSE },
{ "name": "wheel-up", "id": core.input.WHEEL_UP },
{ "name": "wheel-down", "id": core.input.WHEEL_DOWN },
]
for action in actions:
if self.parameter(action["name"]):
core.input.register(self, action["id"], self.parameter(action["name"]))
class Error(Module): class Error(Module):
"""Represents an "error" module """Represents an "error" module