add a blinking point to the infobar
[vuplus_dvbapp] / lib / python / Components / BlinkingPoint.py
1 from HTMLComponent import *
2 from GUIComponent import *
3
4 from Pixmap import Pixmap
5
6 from enigma import *
7
8 import time
9
10 class BlinkingPoint(GUIComponent, Pixmap):
11         SHOWN = 0
12         HIDDEN = 1
13         
14         def __init__(self):
15                 Pixmap.__init__(self)
16                 GUIComponent.__init__(self)
17                 
18                 self.state = self.SHOWN
19                 self.blinking = False
20
21                 self.timer = eTimer()
22                 self.timer.timeout.get().append(self.blink)
23                 
24         def createWidget(self, parent):
25                 return self.getePixmap(parent, "/usr/share/enigma2/record.png")
26
27         def removeWidget(self, w):
28                 pass
29         
30         def showPoint(self):
31                 print "Show point"
32                 self.state = self.SHOWN
33                 self.instance.show()
34
35         def hidePoint(self):
36                 print "Hide point"
37                 self.state = self.HIDDEN
38                 self.instance.hide()
39                 
40         def blink(self):
41                 if self.blinking == True:
42                         if (self.state == self.SHOWN):
43                                 self.hidePoint()
44                         elif (self.state == self.HIDDEN):
45                                 self.showPoint()
46                         
47         def startBlinking(self):
48                 self.blinking = True
49                 self.timer.start(500)
50                 
51         def stopBlinking(self):
52                 self.blinking = False
53                 if (self.state == self.SHOWN):
54                         self.hidePoint()
55                 self.timer.stop()