diff options
Diffstat (limited to 'lib/python/Components/Converter')
| -rw-r--r-- | lib/python/Components/Converter/StringListSelection.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/python/Components/Converter/StringListSelection.py b/lib/python/Components/Converter/StringListSelection.py new file mode 100644 index 00000000..747a82a6 --- /dev/null +++ b/lib/python/Components/Converter/StringListSelection.py @@ -0,0 +1,24 @@ +from Components.Converter.Converter import Converter +from Components.Element import cached + +class StringListSelection(Converter, object): + "extracts the first element of a the current string list element for displaying it on LCD" + def __init__(self, args): + Converter.__init__(self, args) + + def selChanged(self): + self.downstream_elements.changed((self.CHANGED_ALL, 0)) + + @cached + def getText(self): + cur = self.source.current + if cur and len(cur): + return cur[0] + return None + + text = property(getText) + + def changed(self, what): + if what[0] == self.CHANGED_DEFAULT: + self.source.onSelectionChanged.append(self.selChanged) + Converter.changed(self, what) |
