1 from Components.Converter.StringList import StringList
3 class TemplatedMultiContent(StringList):
4 """Turns a python tuple list into a multi-content list which can be used in a listbox renderer."""
5 def __init__(self, args):
6 StringList.__init__(self, args)
7 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_HALIGN_RIGHT, RT_VALIGN_TOP, RT_VALIGN_CENTER, RT_VALIGN_BOTTOM
8 from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmap, MultiContentEntryPixmapAlphaTest
10 del l["self"] # cleanup locals a bit
13 self.template = eval(args, {}, l)
14 assert "fonts" in self.template
15 assert "itemHeight" in self.template
16 assert "template" in self.template
18 def changed(self, what):
20 from enigma import eListboxPythonMultiContent
21 self.content = eListboxPythonMultiContent()
22 self.content.setItemHeight(self.template["itemHeight"])
23 self.content.setTemplate(self.template["template"])
25 # also setup fonts (also given by source)
27 for f in self.template["fonts"]:
28 self.content.setFont(index, f)
32 self.content.setList(self.source.list)
34 self.downstream_elements.changed(what)