minimally improved LCD support
[vuplus_dvbapp] / 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
24         def onShow(self):               
25                 self.clockTimer.start(1000)
26         
27         def onHide(self):
28                 self.clockTimer.stop()
29
30 # "funktionalitaet"     
31         def doClock(self):
32                 t = time.localtime()
33                 timestr = "%2d:%02d:%02d" % (t.tm_hour, t.tm_min, t.tm_sec)
34                 self.setText(timestr)
35                 setLCDClock(timestr)
36
37 # realisierung als GUI
38         def createWidget(self, parent):
39                 return eLabel(parent)
40
41         def removeWidget(self, w):
42                 del self.clockTimer
43
44 # ...und als HTML:
45         def produceHTML(self):
46                 return self.getText()