add PositionGauge renderer
[enigma2.git] / lib / python / Components / Renderer / PositionGauge.py
1 from Renderer import Renderer
2 from enigma import ePositionGauge
3
4 class PositionGauge(Renderer):
5         def __init__(self):
6                 Renderer.__init__(self)
7                 self.__position = 0
8                 self.__length = 0
9                 self.__cutlist = [ ]
10         
11         GUI_WIDGET = ePositionGauge
12         
13         def postWidgetCreate(self, instance):
14                 self.changed()
15                 instance.setInOutList(self.__cutlist)
16
17         def changed(self):
18                 (self.length, self.position) = (self.source.length or 0, self.source.position or 0)
19
20         def cutlist_changed(self):
21                 self.cutlist = self.source.cutlist or [ ]
22
23         def getPosition(self):
24                 return self.__position
25         
26         def setPosition(self, pos):
27                 self.__position = pos
28                 if self.instance is not None:
29                         self.instance.setPosition(pos)
30         
31         position = property(getPosition, setPosition)
32
33         def getLength(self):
34                 return self.__length
35         
36         def setLength(self, len):
37                 self.__length = len
38                 if self.instance is not None:
39                         self.instance.setLength(len)
40
41         length = property(getLength, setLength)
42
43         def getCutlist(self):
44                 return self.__cutlist
45         
46         def setCutlist(self, cutlist):
47                 self.__cutlist = cutlist
48                 if self.instance is not None:
49                         self.instance.setInOutList(cutlist)
50
51         cutlist = property(getCutlist, setCutlist)