1 from Converter import Converter
2 from enigma import eListboxPythonStringContent
3 from Components.Element import cached
5 class StringList(Converter):
6 """Turns a simple python list into a list which can be used in a listbox."""
7 def __init__(self, type):
8 Converter.__init__(self, type)
11 def changed(self, what):
13 self.content = eListboxPythonStringContent()
16 self.content.setList(self.source.list)
17 self.downstream_elements.changed(what)
19 def selectionChanged(self, index):
20 self.source.selectionChanged(index)
21 # update all non-master targets
22 for x in self.downstream_elements:
23 if x is not self.master:
28 if self.source is None or self.index >= len(self.source.list):
30 return self.source.list[self.index]
32 current = property(getCurrent)
34 # pass through: getIndex / setIndex to master
37 if self.master is None:
39 return self.master.index
41 def setIndex(self, index):
42 if self.master is not None:
43 self.master.index = index
45 index = property(getIndex, setIndex)