From: Felix Domke Date: Sat, 7 Oct 2006 12:42:24 +0000 (+0000) Subject: allow empty ConfigSelection, value will be '' then. remove KEY_TIMEOUT from ConfigSel... X-Git-Tag: 2.6.0~3005 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/2764d1bc2a6c99003d0039804acadb82446554d1 allow empty ConfigSelection, value will be '' then. remove KEY_TIMEOUT from ConfigSelection, we don't need it there. Fix empty satlist. orbitial_position will be None if satlist is empty. --- diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index 883a1ea4..dc10045c 100644 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -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) diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 4da004e1..10f112c6 100644 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -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)