From c3ddb7ccd143cd18d33c166fb0cbb0d4ed3e5eca Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 21 Jul 2014 20:21:42 +0200 Subject: add timezone support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- examples/plugins/tzclock | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 examples/plugins/tzclock (limited to 'examples/plugins/tzclock') 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) + -- cgit v1.2.3-70-g09d2