X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/9d3112aad388b4369a339b851aa2507a02bb2d4f..d4fb39b22f791a7b30e3b3e2077d7410495bb9bb:/lib/python/Components/Converter/StringList.py diff --git a/lib/python/Components/Converter/StringList.py b/lib/python/Components/Converter/StringList.py index 1304c643..213f08bc 100644 --- a/lib/python/Components/Converter/StringList.py +++ b/lib/python/Components/Converter/StringList.py @@ -6,23 +6,33 @@ class StringList(Converter): """Turns a simple python list into a list which can be used in a listbox.""" def __init__(self, type): Converter.__init__(self, type) + self.content = None def changed(self, what): - self.content = eListboxPythonStringContent() + if not self.content: + self.content = eListboxPythonStringContent() + if self.source: self.content.setList(self.source.list) self.downstream_elements.changed(what) def selectionChanged(self, index): self.source.selectionChanged(index) + + def setIndex(self, index): # update all non-master targets for x in self.downstream_elements: if x is not self.master: x.index = index + def getIndex(self, index): + return None + + index = property(getIndex, setIndex) + @cached def getCurrent(self): - if self.source is None: + if self.source is None or self.index is None or self.index >= len(self.source.list): return None return self.source.list[self.index] @@ -38,5 +48,8 @@ class StringList(Converter): def setIndex(self, index): if self.master is not None: self.master.index = index - + index = property(getIndex, setIndex) + + def entry_changed(self, index): + self.downstream_elements.entry_changed(index)