diff --git a/bumblebee/engine.py b/bumblebee/engine.py index bf72ad2..de260ed 100644 --- a/bumblebee/engine.py +++ b/bumblebee/engine.py @@ -4,7 +4,6 @@ import glob import pkgutil import textwrap import argparse -import threading import importlib import bumblebee.theme @@ -101,8 +100,6 @@ class Engine: print self._output.start() sys.stdout.flush() - refresh = threading.Condition() - refresh.acquire() while True: # improve this self._theme.reset() @@ -111,7 +108,7 @@ class Engine: self._theme.next() print self._output.get() sys.stdout.flush() - refresh.wait(self._args.interval) + self._output.wait(self._args.interval) print self._output.stop() diff --git a/bumblebee/output.py b/bumblebee/output.py index 206933b..9ed918b 100644 --- a/bumblebee/output.py +++ b/bumblebee/output.py @@ -1,13 +1,15 @@ +import threading class Output(object): def __init__(self, args): self._callbacks = {} + self._wait = threading.Condition() + self._wait.acquire() def redraw(self): - pass - self._refresh.acquire() - self._refresh.notify() - self._refresh.release() + self._wait.acquire() + self._wait.notify() + self._wait.release() def add_callback(self, cmd, button, module=None): if module: @@ -29,6 +31,9 @@ class Output(object): ), None) return cb + def wait(self, interval): + self._wait.wait(interval) + def start(self): pass