blob: 747a82a61bbe25730786c6d2f4010ca8a97ed53c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
|