add configsatlist
authorRonny Strutz <ronny.strutz@multimedia-labs.de>
Fri, 7 Oct 2005 12:09:21 +0000 (12:09 +0000)
committerRonny Strutz <ronny.strutz@multimedia-labs.de>
Fri, 7 Oct 2005 12:09:21 +0000 (12:09 +0000)
lib/python/Components/config.py

index 7bd8175..bd5656c 100644 (file)
@@ -77,6 +77,41 @@ class configSelection:
        def __call__(self, selected):                   #needed by configlist
                self.checkValues()
                return ("text", self.parent.vals[self.parent.value])
+
+class configSatlist:
+       def __init__(self, parent):
+               self.parent = parent
+
+       def checkValues(self):
+               if self.parent.value < 0:
+                       self.parent.value = 0   
+
+               if(self.parent.value >= (len(self.parent.vals) - 1)):
+                       self.parent.value = len(self.parent.vals) - 1
+                       
+               print "value" + str(self.parent.value)
+               print "name " + self.parent.vals[self.parent.value][0]
+
+       def cancel(self):
+               self.parent.reload()
+
+       def save(self):
+               self.parent.save()
+
+       def handleKey(self, key):
+               if key == config.key["prevElement"]:
+                       self.parent.value = self.parent.value - 1
+               if key == config.key["nextElement"]:
+                       self.parent.value = self.parent.value + 1
+               
+               self.checkValues()                      
+
+               self.parent.change()    
+
+       def __call__(self, selected):                   #needed by configlist
+               self.checkValues()
+               #fixme
+               return ("text", str(self.parent.vals[self.parent.value][0]))
                
 class configSequence:
        def __init__(self, parent):