make tmbinc happy
[enigma2.git] / lib / python / Components / config.py
index 40a460c2e3d134dc0b534459131a84028b0aaba1..f0652143666cf25471473720f43c29139ab85e89 100644 (file)
@@ -466,6 +466,8 @@ class configElement:
                if control == ConfigSlider:
                        return str(data)
                elif control == configSelection:
+                       if len(self.vals) < data + 1:
+                               return "0"
                        if isinstance(self.vals[data], str):
                                return str(data)
                        else:
@@ -485,7 +487,6 @@ class configElement:
                        return str(data.strip())
 
                elif control == configSequence:
-                       print data
                        try:
                                value = ((len(data) * ("%d" + self.vals[0]))[0:-1]) % tuple(data)
                        except: 
@@ -525,13 +526,14 @@ class configElement:
                #is this right? activate settings after load/cancel and use default     
                self.change()
 
-       def __init__(self, configPath, control, defaultValue, vals):
+       def __init__(self, configPath, control, defaultValue, vals, saveDefaults = True):
                self.configPath = configPath
                self.defaultValue = defaultValue
                self.controlType = control
                self.vals = vals
                self.notifierList = [ ]
                self.enabled = True
+               self.saveDefaults = saveDefaults
                self.loadData()         
                
        def getConfigPath(self):
@@ -546,7 +548,8 @@ class configElement:
        def reload(self):
                self.loadData()
        def save(self):
-               configfile.setKey(self.configPath, self.datatoFile(self.controlType,self.value))
+               if self.defaultValue != self.value or self.saveDefaults == True:
+                       configfile.setKey(self.configPath, self.datatoFile(self.controlType,self.value))
 
 class configElement_nonSave(configElement):
        def __init__(self, configPath, control, defaultValue, vals):