honor horizontal alignment also when a mark is present
[enigma2.git] / lib / python / Components / Renderer / Progress.py
1 from Components.VariableValue import VariableValue
2 from Renderer import Renderer
3
4 from enigma import eSlider
5
6 class Progress(VariableValue, Renderer):
7         def __init__(self):
8                 Renderer.__init__(self)
9                 VariableValue.__init__(self)
10                 self.__start = 0
11                 self.__end = 100
12
13         GUI_WIDGET = eSlider
14
15         def changed(self, what):
16                 if what[0] == self.CHANGED_CLEAR:
17                         (self.range, self.value) = ((0, 1), 0)
18                         return
19
20                 range = self.source.range or 100
21                 value = self.source.value
22                 if value is None:
23                         value = 0
24                 (self.range, self.value) = ((0, range), value)
25
26         GUI_WIDGET = eSlider
27
28         def postWidgetCreate(self, instance):
29                 instance.setRange(self.__start, self.__end)
30
31         def setRange(self, range):
32                 (self.__start, self.__end) = range
33                 if self.instance is not None:
34                         self.instance.setRange(self.__start, self.__end)
35
36         def getRange(self):
37                 return (self.__start, self.__end)
38
39         range = property(getRange, setRange)