fix movieplayer
[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                 timestr = "%2d:%02d:%02d" % (t.tm_hour, t.tm_min, t.tm_sec)
29                 self.setText(timestr)
30                 setLCDClock(timestr)
31
32 # realisierung als GUI
33         def createWidget(self, parent):
34                 return eLabel(parent)
35
36         def removeWidget(self, w):
37                 del self.clockTimer
38
39 # ...und als HTML:
40         def produceHTML(self):
41                 return self.getText()
42