added setup screens
[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 import time
9 # now some "real" components:
10
11 class Clock(HTMLComponent, GUIComponent, VariableText):
12         def __init__(self):
13                 VariableText.__init__(self)
14                 GUIComponent.__init__(self)
15                 self.doClock()
16                 
17                 self.clockTimer = eTimer()
18                 self.clockTimer.timeout.get().append(self.doClock)
19                 self.clockTimer.start(1000)
20
21 # "funktionalitaet"     
22         def doClock(self):
23                 t = time.localtime()
24                 #HACK use timezone settings
25                 self.setText("%2d:%02d:%02d" % (t[3] + 2, t[4], t[5]))
26
27 # realisierung als GUI
28         def createWidget(self, parent):
29                 return eLabel(parent)
30
31         def removeWidget(self, w):
32                 del self.clockTimer
33
34 # ...und als HTML:
35         def produceHTML(self):
36                 return self.getText()
37