Actualize clock once per second

This commit is contained in:
enkore 2013-02-23 20:43:38 +01:00
parent dd7b5ef346
commit 13c684860d
2 changed files with 6 additions and 4 deletions

View File

@ -46,7 +46,7 @@ battery status
This class shows a clock This class shows a clock
* format * format — stftime format string
### mail ### mail

View File

@ -10,8 +10,11 @@ class Clock(IntervalModule):
This class shows a clock This class shows a clock
""" """
settings = ("format",) settings = (
("format", "stftime format string"),
)
format = None format = None
interval = 1
def init(self): def init(self):
if self.format is None: if self.format is None:
@ -38,9 +41,8 @@ class Clock(IntervalModule):
self.format = "%a %-d %b %X" self.format = "%a %-d %b %X"
def run(self): def run(self):
full_text = datetime.datetime.now().strftime(self.format)
self.output = { self.output = {
"full_text": full_text, "full_text": datetime.datetime.now().strftime(self.format),
"name": "pyclock", "name": "pyclock",
"urgent": False, "urgent": False,
"color": "#ffffff" "color": "#ffffff"