append, don't overwrite __init__.py files
[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 *
7
8 from enigma import *
9
10 RT_HALIGN_LEFT = 0
11 RT_HALIGN_RIGHT = 1
12 RT_HALIGN_CENTER = 2
13 RT_HALIGN_BLOCK = 4
14
15 RT_VALIGN_TOP = 0
16 RT_VALIGN_CENTER = 8
17 RT_VALIGN_BOTTOM = 16
18
19 def PluginEntryComponent(plugin):
20         res = [ plugin ]
21         
22         res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 25, 0, RT_HALIGN_LEFT, plugin.name))
23         res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 26, 300, 17, 1, RT_HALIGN_LEFT, plugin.description))
24
25         if plugin.icon is None:
26                 png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "/plugin.png"))
27         else:
28                 png = plugin.icon
29         res.append((eListboxPythonMultiContent.TYPE_PIXMAP, 10, 5, 60, 40, png))
30         
31         return res
32
33 class PluginList(HTMLComponent, GUIComponent, MenuList):
34         def __init__(self, list):
35                 GUIComponent.__init__(self)
36                 self.l = eListboxPythonMultiContent()
37                 self.list = list
38                 self.l.setList(list)
39                 self.l.setFont(0, gFont("Regular", 20))
40                 self.l.setFont(1, gFont("Regular", 14))
41         
42         def GUIcreate(self, parent):
43                 self.instance = eListbox(parent)
44                 self.instance.setContent(self.l)
45                 self.instance.setItemHeight(50)