fix boundaries of configSequence input
[enigma2.git] / lib / python / Components / config.py
index 482482ce15d53f0ec12590fd8f44c4523e80060c..5a92f076834f8439ab97d241f224ace4f0ae7ed8 100644 (file)
@@ -37,7 +37,9 @@ class configFile:
                        
                fileHandle = open("config", "w")
                
                        
                fileHandle = open("config", "w")
                
-               for x in self.configElements:
+               keys = self.configElements.keys()
+               keys.sort()
+               for x in keys:
                        wstr = x + "=" + self.configElements[x]
                        
                        if wstr[len(wstr) - 1] != '\n':
                        wstr = x + "=" + self.configElements[x]
                        
                        if wstr[len(wstr) - 1] != '\n':
@@ -116,8 +118,7 @@ class configSequence:
                self.markedPos = 0
                
        def checkValues(self):
                self.markedPos = 0
                
        def checkValues(self):
-               maxPos = len(self.parent.value) * self.parent.vals[1] 
-               print maxPos
+               maxPos = len(self.parent.value) * len(self.parent.vals[1]) + len(self.parent.value)
                        
                if self.markedPos >= maxPos:
                        self.markedPos = maxPos - 1
                        
                if self.markedPos >= maxPos:
                        self.markedPos = maxPos - 1
@@ -316,14 +317,13 @@ class configElement:
                #is this right? activate settings after load/cancel and use default     
                self.change()
 
                #is this right? activate settings after load/cancel and use default     
                self.change()
 
-       def __init__(self, configPath, control, defaultValue, vals, shouldSave = True):
+       def __init__(self, configPath, control, defaultValue, vals):
                self.configPath = configPath
                self.defaultValue = defaultValue
                self.controlType = control
                self.vals = vals
                self.notifierList = [ ]
                self.enabled = True
                self.configPath = configPath
                self.defaultValue = defaultValue
                self.controlType = control
                self.vals = vals
                self.notifierList = [ ]
                self.enabled = True
-               self.shouldSave = shouldSave
                self.loadData()         
        def addNotifier(self, notifier):
                self.notifierList.append(notifier);
                self.loadData()         
        def addNotifier(self, notifier):
                self.notifierList.append(notifier);
@@ -334,9 +334,15 @@ class configElement:
        def reload(self):
                self.loadData()
        def save(self):
        def reload(self):
                self.loadData()
        def save(self):
-               if (self.shouldSave == True):
-                       configfile.setKey(self.configPath, self.datatoFile(self.controlType,self.value))
+               configfile.setKey(self.configPath, self.datatoFile(self.controlType,self.value))
 
 
+class configElement_nonSave(configElement):
+       def __init__(self, configPath, control, defaultValue, vals):
+               configElement.__init__(self, configPath, control, defaultValue, vals)
+
+       def save(self):
+               pass
+               
 def getConfigListEntry(description, element):
        b = element
        item = b.controlType(b)
 def getConfigListEntry(description, element):
        b = element
        item = b.controlType(b)