1 from Components.GUIComponent import GUIComponent
2 from Components.MultiContent import MultiContentEntryText
3 from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_WRAP
5 class RSSList(GUIComponent):
6 """Simple List Component used for RSS-Feeds. Displays first two Elements of a 4-Tupel."""
7 def __init__(self, entries):
8 GUIComponent.__init__(self)
10 self.l = eListboxPythonMultiContent()
11 self.l.setFont(0, gFont("Regular", 22))
12 self.l.setFont(1, gFont("Regular", 18))
13 self.l.setBuildFunc(self.buildListboxEntry)
14 self.l.setList(self.list)
16 self.onSelectionChanged = [ ]
18 def connectSelChanged(self, fnc):
19 if not fnc in self.onSelectionChanged:
20 self.onSelectionChanged.append(fnc)
22 def disconnectSelChanged(self, fnc):
23 if fnc in self.onSelectionChanged:
24 self.onSelectionChanged.remove(fnc)
26 def selectionChanged(self):
27 for x in self.onSelectionChanged:
35 def postWidgetCreate(self, instance):
36 instance.setContent(self.l)
37 instance.setItemHeight(100)
38 instance.selectionChanged.get().append(self.selectionChanged)
40 def buildListboxEntry(self, title, link, summary, enclosures):
42 width = self.l.getItemSize().width()
43 res.append(MultiContentEntryText(pos=(0, 0), size=(width, 75), font=0, flags = RT_HALIGN_LEFT|RT_WRAP, text = title))
44 res.append(MultiContentEntryText(pos=(0, 75), size=(width, 20), font=1, flags = RT_HALIGN_LEFT, text = link))
47 def getCurrentEntry(self):
48 return self.l.getCurrentSelection()
50 def getCurrentIndex(self):
51 return self.instance.getCurrentIndex()
53 def moveToIndex(self, index):
54 self.instance.moveSelectionTo(index)
56 def moveToEntry(self, entry):
63 self.instance.moveSelectionTo(count)
68 self.instance.moveSelection(self.instance.moveDown)
71 self.instance.moveSelection(self.instance.moveUp)