diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-07-21 20:21:42 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-07-21 20:21:42 +0200 |
commit | c3ddb7ccd143cd18d33c166fb0cbb0d4ed3e5eca (patch) | |
tree | dbfdf60123a0c4c85c3c496b349d38acb26ab099 /examples/plugins | |
parent | update todo (diff) | |
download | xpybar-c3ddb7ccd143cd18d33c166fb0cbb0d4ed3e5eca.tar.gz xpybar-c3ddb7ccd143cd18d33c166fb0cbb0d4ed3e5eca.tar.bz2 xpybar-c3ddb7ccd143cd18d33c166fb0cbb0d4ed3e5eca.tar.xz |
add timezone support
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'examples/plugins')
-rw-r--r-- | examples/plugins/tzclock | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/plugins/tzclock b/examples/plugins/tzclock new file mode 100644 index 0000000..e4d4911 --- /dev/null +++ b/examples/plugins/tzclock @@ -0,0 +1,33 @@ +# -*- python -*- + +# A xpybar configuration example testing the features of plugins.tzclock + +from plugins.tzclock import TZClock + + +OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 24, True + + +pacific = TZClock(timezone = 'US/Pacific', format = '%T %Z') +central = TZClock(timezone = 'US/Central', format = '%T %Z') +utc = TZClock(timezone = 'UTC', format = '%T %Z', sync_to = TZClock.SECONDS) +sthlm = TZClock(timezone = 'Europe/Stockholm', format = '%T %Z') +kalinin = TZClock(timezone = 'Europe/Kaliningrad', format = '%T %Z') +tokyo = TZClock(timezone = 'Asia/Tokyo', format = '%T %Z') + + +timezones = [pacific, central, utc, sthlm, kalinin, tokyo] + + +start_ = start +def start(): + start_() + async(lambda : utc.continuous_sync(lambda : bar.invalidate())) + + +def redraw(): + time = TZClock.posix_time() + text = ' │ '.join([tz.from_posix_time(time) for tz in timezones]) + bar.clear() + bar.draw_coloured_text(0, 10, 0, 2, text) + |