removed debug output and fixed config-values
[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 from config import config
11
12 import time
13 # now some "real" components:
14
15 class Clock(HTMLComponent, GUIComponent, VariableText):
16         def __init__(self):
17                 VariableText.__init__(self)
18                 GUIComponent.__init__(self)
19                 self.doClock()
20                 
21                 self.clockTimer = eTimer()
22                 self.clockTimer.timeout.get().append(self.doClock)
23                 self.clockTimer.start(1000)
24
25 # "funktionalitaet"     
26         def doClock(self):
27                 t = time.localtime()
28                 hour = (t[3] + config.timezone.val.value) % 24;
29                 timestr = "%2d:%02d:%02d" % (hour, t[4], t[5])
30                 self.setText(timestr)
31                 setLCDClock(timestr)
32
33 # realisierung als GUI
34         def createWidget(self, parent):
35                 return eLabel(parent)
36
37         def removeWidget(self, w):
38                 del self.clockTimer
39
40 # ...und als HTML:
41         def produceHTML(self):
42                 return self.getText()
43