[core] Add (partial) support for states
Add states to the modules and widgets. Widgets are mostly just a pass-through (backwards compatibility, and ease of use - making states directly inside the widgets would require more code inside the modules to ensure that each widget is correctly updated). Still missing: - Separators during partial update (right now, it takes one interval until separators are drawn correctly)
This commit is contained in:
parent
fd57af9325
commit
84833dc7db
5 changed files with 27 additions and 3 deletions
|
@ -20,6 +20,8 @@ class Module(core.input.Object):
|
|||
super().__init__()
|
||||
self._config = config
|
||||
self._widgets = widgets if isinstance(widgets, list) else [ widgets ]
|
||||
for widget in self._widgets:
|
||||
widget.module(self)
|
||||
self._name = None
|
||||
|
||||
def parameter(self, key, default=None):
|
||||
|
@ -45,6 +47,9 @@ class Module(core.input.Object):
|
|||
def widgets(self):
|
||||
return self._widgets
|
||||
|
||||
def state(self, widget):
|
||||
return []
|
||||
|
||||
class Error(Module):
|
||||
def __init__(self, config, module, error):
|
||||
super().__init__(config, core.widget.Widget(self.full_text))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue