honor horizontal alignment also when a mark is present
[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((self.CHANGED_DEFAULT,))
15                 self.cutlist_changed()
16                 instance.setInOutList(self.__cutlist)
17
18         def changed(self, what):
19                 if what[0] == self.CHANGED_CLEAR:
20                         (self.length, self.position) = 0
21                 else:
22                         (self.length, self.position) = (self.source.length or 0, self.source.position or 0)
23
24         def cutlist_changed(self):
25                 self.cutlist = self.source.cutlist or [ ]
26
27         def getPosition(self):
28                 return self.__position
29         
30         def setPosition(self, pos):
31                 self.__position = pos
32                 if self.instance is not None:
33                         self.instance.setPosition(pos)
34         
35         position = property(getPosition, setPosition)
36
37         def getLength(self):
38                 return self.__length
39         
40         def setLength(self, len):
41                 self.__length = len
42                 if self.instance is not None:
43                         self.instance.setLength(len)
44
45         length = property(getLength, setLength)
46
47         def getCutlist(self):
48                 return self.__cutlist
49         
50         def setCutlist(self, cutlist):
51                 self.__cutlist = cutlist
52                 if self.instance is not None:
53                         self.instance.setInOutList(cutlist)
54
55         cutlist = property(getCutlist, setCutlist)