blob: b59a20d5fbece643fcf92a159ce572a0009da94b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
from Components.Element import cached
from enigma import eTimer
from time import time as getTime
from Source import Source
class Clock(Source):
def __init__(self):
Source.__init__(self)
self.clock_timer = eTimer()
self.clock_timer.timeout.get().append(self.poll)
self.clock_timer.start(1000)
@cached
def getClock(self):
return getTime()
time = property(getClock)
def poll(self):
self.changed((self.CHANGED_POLL,))
def doSuspend(self, suspended):
if suspended:
self.clock_timer.stop()
else:
self.clock_timer.start(1000)
self.poll()
def destroy(self):
self.clock_timer.timeout.get().remove(self.poll)
|