From 67ea9ad86c87e61ff57ec78403f43fde0ceb7632 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Mon, 24 Sep 2007 00:06:18 +0000 Subject: [PATCH] push down initial 'changed' event --- .../Converter/StringListSelection.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/python/Components/Converter/StringListSelection.py 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) -- 2.30.2