Can force status bar to update early by sending a USR1 signal to the process
This commit is contained in:
parent
4598108006
commit
705c18dbcd
2 changed files with 20 additions and 12 deletions
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
import signal
|
||||||
import bumblebee.theme
|
import bumblebee.theme
|
||||||
import bumblebee.engine
|
import bumblebee.engine
|
||||||
import bumblebee.config
|
import bumblebee.config
|
||||||
|
@ -18,6 +19,9 @@ except Exception:
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
def sig_USR1_handler(signum,stack):
|
||||||
|
engine.write_output()
|
||||||
|
|
||||||
config = bumblebee.config.Config(sys.argv[1:])
|
config = bumblebee.config.Config(sys.argv[1:])
|
||||||
|
|
||||||
if config.debug():
|
if config.debug():
|
||||||
|
@ -45,6 +49,7 @@ def main():
|
||||||
output=output,
|
output=output,
|
||||||
inp=inp,
|
inp=inp,
|
||||||
)
|
)
|
||||||
|
signal.signal(10,sig_USR1_handler)
|
||||||
engine.run()
|
engine.run()
|
||||||
except KeyboardInterrupt as error:
|
except KeyboardInterrupt as error:
|
||||||
inp.stop()
|
inp.stop()
|
||||||
|
|
|
@ -255,6 +255,14 @@ class Engine(object):
|
||||||
"""Start the event loop"""
|
"""Start the event loop"""
|
||||||
self._output.start()
|
self._output.start()
|
||||||
while self.running():
|
while self.running():
|
||||||
|
self.write_output()
|
||||||
|
if self.running():
|
||||||
|
self.input.wait(float(self._config.get("interval", 1)))
|
||||||
|
|
||||||
|
self._output.stop()
|
||||||
|
self.input.stop()
|
||||||
|
|
||||||
|
def write_output(self):
|
||||||
self._output.begin()
|
self._output.begin()
|
||||||
for module in self._modules:
|
for module in self._modules:
|
||||||
self._current_module = module
|
self._current_module = module
|
||||||
|
@ -267,10 +275,5 @@ class Engine(object):
|
||||||
self._output.draw(widget=module.errorWidget(), module=module, engine=self)
|
self._output.draw(widget=module.errorWidget(), module=module, engine=self)
|
||||||
self._output.flush()
|
self._output.flush()
|
||||||
self._output.end()
|
self._output.end()
|
||||||
if self.running():
|
|
||||||
self.input.wait(float(self._config.get("interval", 1)))
|
|
||||||
|
|
||||||
self._output.stop()
|
|
||||||
self.input.stop()
|
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
Loading…
Reference in a new issue