don't crash if time is *really* invalid
[enigma2.git] / lib / python / Components / ProgressBar.py
index 68824d5a1cb460319fe7afda9f6cb2218b06092f..f18c4672ac11513cbc1087d18ebcc3fdca3ebe06 100644 (file)
@@ -5,13 +5,24 @@ from VariableValue import *
 from enigma import eSlider
 
 # a general purpose progress bar
-class ProgressBar(HTMLComponent, GUIComponent, VariableValue):
+class ProgressBar(VariableValue, HTMLComponent, GUIComponent, object):
        def __init__(self):
                GUIComponent.__init__(self)
                VariableValue.__init__(self)
+               self.__start = 0
+               self.__end = 100
 
-       def createWidget(self, parent):
-               g = eSlider(parent)
-               g.setRange(0, 100)
-               return g
-       
+       GUI_WIDGET = eSlider
+
+       def postWidgetCreate(self, instance):
+               instance.setRange(self.__start, self.__end)
+
+       def setRange(self, range):
+               (__start, __end) = range
+               if self.instance is not None:
+                       self.instance.setRange(__start, __end)
+
+       def getRange(self):
+               return (self.__start, self.__end)
+
+       range = property(getRange, setRange)