1 from Components.MenuList import MenuList
2 from Components.MultiContent import MultiContentEntryText
4 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT, \
7 from skin import parseFont
9 class RSSFeedList(MenuList):
10 def __init__(self, entries):
11 MenuList.__init__(self, entries, False, content = eListboxPythonMultiContent)
14 l.setFont(0, gFont("Regular", 22))
15 self.descriptionFont = gFont("Regular", 18)
16 l.setFont(1, self.descriptionFont)
18 l.setBuildFunc(self.buildListboxEntry)
20 def applySkin(self, desktop, parent):
22 if self.skinAttributes is not None:
23 for (attrib, value) in self.skinAttributes:
25 self.l.setFont(0, parseFont(value, ((1,1),(1,1))))
26 elif attrib == "descriptionFont":
27 self.descriptionFont = parseFont(value, ((1,1),(1,1)))
28 self.l.setFont(1, self.descriptionFont)
29 elif attrib == "itemHeight":
30 self.l.setItemHeight(int(value))
32 attribs.append((attrib, value))
33 self.skinAttributes = attribs
34 return MenuList.applySkin(self, desktop, parent)
36 def connectSelChanged(self, fnc):
37 if not fnc in self.onSelectionChanged:
38 self.onSelectionChanged.append(fnc)
40 def disconnectSelChanged(self, fnc):
41 if fnc in self.onSelectionChanged:
42 self.onSelectionChanged.remove(fnc)
47 def moveToEntry(self, feed):
53 if feed.uri == x[0].uri:
54 self.instance.moveSelectionTo(idx)
58 def buildListboxEntry(self, feed):
59 size = self.l.getItemSize()
61 descriptionHeight = self.descriptionFont.pointSize + 2
62 titleHeight = size.height() - descriptionHeight
66 MultiContentEntryText(pos=(0, 0), size=(width, titleHeight), font=0, flags = RT_HALIGN_LEFT|RT_WRAP, text = feed.title),
67 MultiContentEntryText(pos=(0, titleHeight), size=(width, descriptionHeight), font=1, flags = RT_HALIGN_LEFT, text = feed.description)
71 # We know that the list will never be empty...
72 return self.l.getCurrentSelection()[0]