suspend timers when all renders are hidden
[enigma2.git] / lib / python / Components / Sources / Clock.py
1 from Tools.Event import Event
2 from enigma import eTimer
3 import time
4
5 from Source import Source
6
7 class Clock(Source):
8         def __init__(self):
9                 Source.__init__(self)
10                 self.clock_timer = eTimer()
11                 self.clock_timer.timeout.get().append(self.poll)
12                 self.clock_timer.start(1000)
13
14         def getClock(self):
15                 return time.time()
16
17         time = property(getClock)
18
19         def poll(self):
20                 self.changed((self.CHANGED_POLL,))
21
22         def doSuspend(self, suspended):
23                 if suspended:
24                         self.clock_timer.stop()
25                 else:
26                         self.clock_timer.start(1000)
27                         self.poll()
28