allow empty ConfigSelection, value will be '' then. remove KEY_TIMEOUT from ConfigSel...
authorFelix Domke <tmbinc@elitedvb.net>
Sat, 7 Oct 2006 12:42:24 +0000 (12:42 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sat, 7 Oct 2006 12:42:24 +0000 (12:42 +0000)
lib/python/Components/ConfigList.py
lib/python/Components/config.py

index 883a1ea4c7959ed06f1cf7b744fcfc0a5bb4b195..dc10045caa58af1487283680bf139143cde97650 100644 (file)
@@ -100,7 +100,7 @@ class ConfigListScreen:
                        "8": self.keyNumberGlobal,
                        "9": self.keyNumberGlobal,
                        "0": self.keyNumberGlobal
-               }, 5)
+               }, -1) # to prevent left/right overriding the listbox
 
                self["config"] = ConfigList(list, session = session)
 
index 4da004e1bfa37c0862014ec66a3e65fde1bbe224..10f112c6379296d715a63ae2c30e198f4f8ea9b3 100644 (file)
@@ -125,7 +125,10 @@ class ConfigSelection(ConfigElement):
                else:
                        assert False, "ConfigSelection choices must be dict or list!"
                
-               assert len(self.choices), "you can't have an empty configselection"
+               #assert len(self.choices), "you can't have an empty configselection"
+               if len(self.choices) == 0:
+                       self.choices = [""]
+                       self.description[""] = ""
 
                if default is None:
                        default = self.choices[0]
@@ -165,9 +168,6 @@ class ConfigSelection(ConfigElement):
                        self.value = self.choices[(i + nchoices - 1) % nchoices]
                elif key == KEY_RIGHT:
                        self.value = self.choices[(i + 1) % nchoices]
-               elif key == KEY_TIMEOUT:
-                       self.timeout()
-                       return
 
        def getMulti(self, selected):
                return ("text", self.description[self.value])
@@ -551,11 +551,11 @@ class ConfigSatlist(ConfigSelection):
        def __init__(self, list, default = None):
                if default is not None:
                        default = str(default)
-               if list == [ ]:
-                       list = [0, "N/A"]
                ConfigSelection.__init__(self, choices = [(str(orbpos), desc) for (orbpos, desc) in list], default = default)
 
        def getOrbitalPosition(self):
+               if self.value == "":
+                       return None
                return int(self.value)
        
        orbital_position = property(getOrbitalPosition)