Updated docs.

This commit is contained in:
Lukáš Mandák 2015-04-13 15:51:05 +02:00
parent e31c58f1ad
commit b6080422da

View File

@ -10,7 +10,7 @@ from i3pystatus import IntervalModule
class Clock(IntervalModule): class Clock(IntervalModule):
""" """
This class shows a clock This class shows a clock.
format can be passed in four different ways: format can be passed in four different ways:
@ -18,11 +18,39 @@ class Clock(IntervalModule):
- one two-tuple, first is the format, second the timezone - one two-tuple, first is the format, second the timezone
- list of strings - no timezones - list of strings - no timezones
- list of two tuples, first is the format, second is timezone - list of two tuples, first is the format, second is timezone
Use mousewheel to cycle between formats.
For complete time format specification see:
::
man strftime
All available timezones are located in directory:
::
/usr/share/zoneinfo/
.. rubric:: Format examples
::
# one format, local timezone
format = '%a %b %-d %b %X'
# multiple formats, local timezone
format = [ '%a %b %-d %b %X', '%X' ]
# one format, specified timezone
format = ('%a %b %-d %b %X', 'Europe/Bratislava')
# multiple formats, specified timezones
format = [ ('%a %b %-d %b %X', 'America/New_York'), ('%X', 'Etc/GMT+9') ]
""" """
settings = ( settings = (
("format", "`None` means to use the default, locale-dependent format. Can cycle between formats with mousewheel"), ("format", "`None` means to use the default, locale-dependent format."),
("color", "RGB hexadecimal code color specifier, default to #ffffff, set to `i3Bar` to use i3 bar default"), ("color", "RGB hexadecimal code color specifier, default to #ffffff"),
) )
format = None format = None
color = "#ffffff" color = "#ffffff"
@ -75,7 +103,7 @@ class Clock(IntervalModule):
return [expand_format(format_) for format_ in formats] return [expand_format(format_) for format_ in formats]
def run(self): def run(self):
# set correct timezone # set timezone
if time.tzname[0] is not self.format[self.current_format_id][1]: if time.tzname[0] is not self.format[self.current_format_id][1]:
os.environ.putenv('TZ', self.format[self.current_format_id][1]) os.environ.putenv('TZ', self.format[self.current_format_id][1])
time.tzset() time.tzset()