add summary support for setup
[enigma2.git] / lib / python / Components / PluginList.py
1 from HTMLComponent import *
2 from GUIComponent import *
3
4 from MenuList import MenuList
5
6 from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
7 from Components.MultiContent import RT_HALIGN_LEFT, MultiContentEntryText, MultiContentEntryPixmapAlphaTest
8
9 from enigma import *
10
11 def PluginEntryComponent(plugin):
12         res = [ plugin ]
13         
14         res.append(MultiContentEntryText(pos=(80, 5), size=(300, 25), font=0, text=plugin.name))
15         res.append(MultiContentEntryText(pos=(80, 26), size=(300, 17), font=1, text=plugin.description))
16
17         if plugin.icon is None:
18                 png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "plugin.png"))
19         else:
20                 png = plugin.icon
21         res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(60, 40), png = png))
22         
23         return res
24
25 def PluginCategoryComponent(name, png):
26         res = [ name ]
27         
28         res.append(MultiContentEntryText(pos=(80, 5), size=(300, 25), font=0, text=name))
29         res.append(MultiContentEntryPixmapAlphaTest(pos=(0, 0), size=(60, 50), png = png))
30         
31         return res
32
33 def PluginDownloadComponent(plugin, name):
34         res = [ plugin ]
35         
36         res.append(MultiContentEntryText(pos=(80, 5), size=(300, 25), font=0, text=name))
37         res.append(MultiContentEntryText(pos=(80, 26), size=(300, 17), font=1, text=plugin.description))
38
39         if plugin.icon is None:
40                 png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "plugin.png"))
41         else:
42                 png = plugin.icon
43         res.append(MultiContentEntryPixmapAlphaTest(pos=(0, 0), size=(60, 50), png = png))
44         
45         return res
46
47 class PluginList(MenuList, HTMLComponent, GUIComponent):
48         def __init__(self, list):
49                 GUIComponent.__init__(self)
50                 self.l = eListboxPythonMultiContent()
51                 self.list = list
52                 self.l.setList(list)
53                 self.l.setFont(0, gFont("Regular", 20))
54                 self.l.setFont(1, gFont("Regular", 14))
55
56         GUI_WIDGET = eListbox
57
58         def postWidgetCreate(self, instance):
59                 instance.setContent(self.l)
60                 instance.setItemHeight(50)