sort config file
[enigma2.git] / lib / python / Components / Clock.py
1 from HTMLComponent import *
2 from GUIComponent import *
3 from VariableText import *
4
5 #from enigma import eTimer
6 #from enigma import eLabel
7
8 from enigma import *
9
10 import time
11 # now some "real" components:
12
13 class Clock(HTMLComponent, GUIComponent, VariableText):
14         def __init__(self):
15                 VariableText.__init__(self)
16                 GUIComponent.__init__(self)
17                 self.doClock()
18                 
19                 self.clockTimer = eTimer()
20                 self.clockTimer.timeout.get().append(self.doClock)
21                 self.clockTimer.start(1000)
22
23 # "funktionalitaet"     
24         def doClock(self):
25                 t = time.localtime()
26                 #HACK use timezone settings
27                 timestr = "%2d:%02d:%02d" % (t[3] + 2, t[4], t[5])
28                 self.setText(timestr)
29                 setLCDClock(timestr)
30
31 # realisierung als GUI
32         def createWidget(self, parent):
33                 return eLabel(parent)
34
35         def removeWidget(self, w):
36                 del self.clockTimer
37
38 # ...und als HTML:
39         def produceHTML(self):
40                 return self.getText()
41