Merge branch 'master' of fraxinas@git.opendreambox.org:/git/enigma2
[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.__seek_position = 0
9                 self.__length = 0
10                 self.__seek_enable = 0
11                 self.__cutlist = [ ]
12         
13         GUI_WIDGET = ePositionGauge
14         
15         def postWidgetCreate(self, instance):
16                 self.changed((self.CHANGED_DEFAULT,))
17                 self.cutlist_changed()
18                 instance.setInOutList(self.__cutlist)
19
20         def changed(self, what):
21                 if what[0] == self.CHANGED_CLEAR:
22                         (self.length, self.position) = 0
23                 else:
24                         (self.length, self.position) = (self.source.length or 0, self.source.position or 0)
25
26         def cutlist_changed(self):
27                 self.cutlist = self.source.cutlist or [ ]
28
29         def getPosition(self):
30                 return self.__position
31         
32         def setPosition(self, pos):
33                 self.__position = pos
34                 if self.instance is not None:
35                         self.instance.setPosition(pos)
36         
37         position = property(getPosition, setPosition)
38
39         def getLength(self):
40                 return self.__length
41         
42         def setLength(self, len):
43                 self.__length = len
44                 if self.instance is not None:
45                         self.instance.setLength(len)
46
47         length = property(getLength, setLength)
48
49         def getCutlist(self):
50                 return self.__cutlist
51         
52         def setCutlist(self, cutlist):
53                 if self.__cutlist != cutlist:
54                         self.__cutlist = cutlist
55                         if self.instance is not None:
56                                 self.instance.setInOutList(cutlist)
57
58         cutlist = property(getCutlist, setCutlist)
59
60         def getSeekEnable(self):
61                 return self.__seek_enable
62         
63         def setSeekEnable(self, val):
64                 self.__seek_enable = val
65                 if self.instance is not None:
66                         self.instance.enableSeekPointer(val)
67
68         seek_pointer_enabled = property(getSeekEnable, setSeekEnable)
69
70         def getSeekPosition(self):
71                 return self.__seek_position
72         
73         def setSeekPosition(self, pos):
74                 self.__seek_position = pos
75                 if self.instance is not None:
76                         self.instance.setSeekPosition(pos)
77         
78         seek_pointer_position = property(getSeekPosition, setSeekPosition)