[core] Add input handling

Add a (half-finished) input library, that for now simply allows
registration and triggering of events.

As next steps, the trigger will happen as part of a separate thread that
reads input events.

Additionally, invoking commands via a execute() will be supported.

Thirdly, there is need of a way to selectively update the affected
modules (widgets), which should be possible given that the event
contains both the instance (widget ID) and name (module name).
This commit is contained in:
Tobias Witek 2020-02-07 21:28:29 +01:00
parent a70c82dc4c
commit e0df8b84e5
4 changed files with 79 additions and 4 deletions

View file

@ -13,13 +13,13 @@ import locale
import core.module
import core.widget
import core.input
class Module(core.module.Module):
def __init__(self, config):
super().__init__(config, core.widget.Widget(self.full_text))
# TODO: register callback
#engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
# cmd='calendar')
core.input.register(self, button=core.input.LEFT_MOUSE, cmd='calendar')
self._fmt = self.parameter('format', self.default_format())
l = locale.getdefaultlocale()
if not l or l == (None, None):