aboutsummaryrefslogtreecommitdiffstats
path: root/examples/clock
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-04 12:34:23 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-04 12:34:23 +0100
commit26d536eb55d4fc847a8c83660fa0de7c4b077bf3 (patch)
tree2784bba8c245bbff957da41bed941e5ce917e987 /examples/clock
parentfix threading issues in xmonad example (diff)
downloadxpybar-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/clock16
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)