Merge branch 'master' into experimental
[enigma2.git] / lib / python / Components / PluginList.py
1 from MenuList import MenuList
2
3 from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
4 from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
5
6 from enigma import eListboxPythonMultiContent, gFont
7 from Tools.LoadPixmap import LoadPixmap
8
9 def PluginEntryComponent(plugin):
10         if plugin.icon is None:
11                 png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/plugin.png"))
12         else:
13                 png = plugin.icon
14
15         return [
16                 plugin,
17                 MultiContentEntryText(pos=(120, 5), size=(320, 25), font=0, text=plugin.name),
18                 MultiContentEntryText(pos=(120, 26), size=(320, 17), font=1, text=plugin.description),
19                 MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(100, 40), png = png)
20         ]
21
22 def PluginCategoryComponent(name, png):
23         return [
24                 name,
25                 MultiContentEntryText(pos=(120, 5), size=(320, 25), font=0, text=name),
26                 MultiContentEntryPixmapAlphaTest(pos=(10, 0), size=(100, 50), png = png)
27         ]
28
29 def PluginDownloadComponent(plugin, name):
30         if plugin.icon is None:
31                 png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/plugin.png"))
32         else:
33                 png = plugin.icon
34
35         return [
36                 plugin,
37                 MultiContentEntryText(pos=(120, 5), size=(320, 25), font=0, text=name),
38                 MultiContentEntryText(pos=(120, 26), size=(320, 17), font=1, text=plugin.description),
39                 MultiContentEntryPixmapAlphaTest(pos=(10, 0), size=(100, 50), png = png)
40         ]
41         
42
43 class PluginList(MenuList):
44         def __init__(self, list, enableWrapAround=False):
45                 MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
46                 self.l.setFont(0, gFont("Regular", 20))
47                 self.l.setFont(1, gFont("Regular", 14))
48                 self.l.setItemHeight(50)