Merge branch 'bug_539_add_multicontent_pixmap_progress'
[enigma2.git] / lib / python / Components / Converter / StringListSelection.py
1 from Components.Converter.Converter import Converter
2 from Components.Element import cached
3
4 class StringListSelection(Converter, object):
5         "extracts the first element of a the current string list  element for displaying it on LCD"
6         def __init__(self, args):
7                 Converter.__init__(self, args)
8
9         def selChanged(self):
10                 self.downstream_elements.changed((self.CHANGED_ALL, 0))
11
12         @cached
13         def getText(self):
14                 cur = self.source.current
15                 if cur and len(cur):
16                         return cur[0]
17                 return None
18
19         text = property(getText)
20
21         def changed(self, what):
22                 if what[0] == self.CHANGED_DEFAULT:
23                         self.source.onSelectionChanged.append(self.selChanged)
24                 Converter.changed(self, what)