diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-03-04 12:34:23 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-03-04 12:34:23 +0100 |
commit | 26d536eb55d4fc847a8c83660fa0de7c4b077bf3 (patch) | |
tree | 2784bba8c245bbff957da41bed941e5ce917e987 /examples/clock | |
parent | fix threading issues in xmonad example (diff) | |
download | xpybar-26d536eb55d4fc847a8c83660fa0de7c4b077bf3.tar.gz xpybar-26d536eb55d4fc847a8c83660fa0de7c4b077bf3.tar.bz2 xpybar-26d536eb55d4fc847a8c83660fa0de7c4b077bf3.tar.xz |
add Bar.invalidate
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | examples/clock | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/examples/clock b/examples/clock index c7d9ac2..163f7d5 100644 --- a/examples/clock +++ b/examples/clock @@ -17,19 +17,11 @@ clock = Clock(format = '%Y-(%m)%b-%d %T, %a w%V, %Z', utc = False, sync_to = Clo start_ = start def start(): start_() - def refresh(): - if redraw(): - get_display().flush() - async(lambda : clock.continuous_sync(refresh)) + async(lambda : clock.continuous_sync(lambda : bar.invalidate())) -semaphore = threading.Semaphore() def redraw(): - if semaphore.acquire(blocking = False): - text = clock.read() - bar.clear() - bar.draw_coloured_text(0, 10, 0, 2, text) - semaphore.release() - return True - return False + text = clock.read() + bar.clear() + bar.draw_coloured_text(0, 10, 0, 2, text) |