aboutsummaryrefslogtreecommitdiffstats
path: root/examples/moderate
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-03 22:56:08 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-03 22:56:08 +0100
commita6853eb603e8d0bb5d28c358d41f1e3632da0467 (patch)
tree07740a414319d999057d9dd39b1b4283218926a0 /examples/moderate
parentadd weather to moderate example (diff)
downloadxpybar-a6853eb603e8d0bb5d28c358d41f1e3632da0467.tar.gz
xpybar-a6853eb603e8d0bb5d28c358d41f1e3632da0467.tar.bz2
xpybar-a6853eb603e8d0bb5d28c358d41f1e3632da0467.tar.xz
add chase
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--examples/moderate15
1 files changed, 13 insertions, 2 deletions
diff --git a/examples/moderate b/examples/moderate
index 399afea..e7407e5 100644
--- a/examples/moderate
+++ b/examples/moderate
@@ -12,6 +12,7 @@ from plugins.users import Users
from plugins.pacman import Pacman
from plugins.uname import Uname
from plugins.weather import Weather
+from plugins.chase import Chase
OUTPUT, YPOS, TOP = 0, 24, True
@@ -181,17 +182,27 @@ def weather():
return rc
+chase_ = Chase()
+chase_update = Sometimes(lambda : async(chase_.update), 2 * 60 * 60 * 2)
+def chase():
+ status = chase_.status
+ status = '39' if status is None else ('32' if status else '31')
+ chase_update()
+ return '\033[%smChase\033[0m' % status
+
+
functions = [ Sometimes(lambda : clock_.read(), 1 * 2),
lambda : time.time() % 1,
Sometimes(users, 1 * 2),
weather,
+ chase,
cpu,
memory,
network,
Sometimes(uname, 30 * 60 * 2),
]
-pattern = [ '%s │ %.2f │ %s │ %s }{ %s │ %s │ %s │ %s'
+pattern = [ '%s │ %.2f │ %s │ %s │ %s }{ %s │ %s │ %s │ %s'
]
@@ -211,7 +222,7 @@ def redraw():
if semaphore.acquire(blocking = False):
values = pattern % tuple([f() for f in functions])
bar.clear()
- print(values.replace('\0', ' ' * 8))
+ #print(values.replace('\0', ' ' * 8))
bar.draw_coloured_splitted_text(0, bar.width, 10, 0, 2, values)
semaphore.release()
return True