Revert "Merge branch 'partial-update-on-input'"
This reverts commita2cc828e58
, reversing changes made to87f185e62b
.
This commit is contained in:
parent
a2cc828e58
commit
47eeac00a0
4 changed files with 30 additions and 64 deletions
|
@ -71,7 +71,7 @@ class Module(object):
|
|||
return widget
|
||||
|
||||
def errorWidget(self):
|
||||
msg = self.error or "n/a"
|
||||
msg = self.error
|
||||
if len(msg) > 10:
|
||||
msg = "{}...".format(msg[0:7])
|
||||
return bumblebee.output.Widget(full_text="error: {}".format(msg))
|
||||
|
@ -264,37 +264,14 @@ class Engine(object):
|
|||
def run(self):
|
||||
"""Start the event loop"""
|
||||
self._output.start()
|
||||
event = None
|
||||
last_full = time.time()
|
||||
interval = float(self._config.get("interval", 1))
|
||||
while self.running():
|
||||
if event and time.time() - last_full < interval:
|
||||
log.debug("partial output update ({} {} {})".format(event, time.time(), last_full))
|
||||
self.patch_output(event)
|
||||
else:
|
||||
log.debug("full update: {} {} ({})".format(time.time(), last_full, time.time() - last_full))
|
||||
last_full = time.time()
|
||||
self.write_output()
|
||||
self.write_output()
|
||||
if self.running():
|
||||
event = self.input.wait(interval)
|
||||
self.input.wait(float(self._config.get("interval", 1)))
|
||||
|
||||
self._output.stop()
|
||||
self.input.stop()
|
||||
|
||||
def patch_output(self, event):
|
||||
for module in self._modules:
|
||||
widget = module.widget_by_id(event["instance"])
|
||||
if not widget: continue
|
||||
# this widget was affected by the event -> update
|
||||
module.update_wrapper(module.widgets())
|
||||
widget = module.errorWidget()
|
||||
if module.error is None:
|
||||
widget = module.widget_by_id(event["instance"])
|
||||
widget.link_module(module)
|
||||
self._output.replace(event, module, widget)
|
||||
self._output.flush()
|
||||
self._output.end()
|
||||
|
||||
def write_output(self):
|
||||
self._output.begin()
|
||||
for module in self._modules:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue