[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:
parent
a70c82dc4c
commit
e0df8b84e5
4 changed files with 79 additions and 4 deletions
|
@ -1,6 +1,8 @@
|
|||
import importlib
|
||||
import logging
|
||||
|
||||
import core.input
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def load(module_name, config=None):
|
||||
|
@ -11,8 +13,9 @@ def load(module_name, config=None):
|
|||
return Error(module_name)
|
||||
return getattr(mod, 'Module')(config)
|
||||
|
||||
class Module(object):
|
||||
class Module(core.input.Object):
|
||||
def __init__(self, config=None, widgets=[]):
|
||||
super().__init__()
|
||||
self._config = config
|
||||
self._widgets = widgets if isinstance(widgets, list) else [ widgets ]
|
||||
self._name = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue