config rewrite. some extensions still need to be updated.
[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                 self.__cutlist = cutlist
54                 if self.instance is not None:
55                         self.instance.setInOutList(cutlist)
56
57         cutlist = property(getCutlist, setCutlist)
58
59         def getSeekEnable(self):
60                 return self.__seek_enable
61         
62         def setSeekEnable(self, val):
63                 self.__seek_enable = val
64                 if self.instance is not None:
65                         self.instance.enableSeekPointer(val)
66
67         seek_pointer_enabled = property(getSeekEnable, setSeekEnable)
68
69         def getSeekPosition(self):
70                 return self.__seek_position
71         
72         def setSeekPosition(self, pos):
73                 self.__seek_position = pos
74                 if self.instance is not None:
75                         self.instance.setSeekPosition(pos)
76         
77         seek_pointer_position = property(getSeekPosition, setSeekPosition)