0378ce4cc206b72187f266a912047ba98b3d4d7f
[enigma2.git] / lib / python / Plugins / Plugin.py
1 from enigma import loadPNG
2
3 class PluginDescriptor:
4         """An object to describe a plugin."""
5         
6         # where to list the plugin. Note that there are different call arguments,
7         # so you might not be able to combine them.
8         
9         # supported arguments are:
10         #   session
11         #   servicereference
12         #   reason
13         
14         # argument: session
15         WHERE_BLUEMENU = 0
16         WHERE_MAINMENU = 1
17         WHERE_PLUGINMENU  = 2
18         # argument: session, serviceref (currently selected)
19         WHERE_MOVIELIST = 3
20         # ...
21         WHERE_SETUP    = 4
22         
23         # reason (0: start, 1: end)
24         WHERE_AUTOSTART = 5
25         
26         # start as wizard. In that case, fnc must be a screen class!
27         WHERE_WIZARD = 6
28         
29         def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None):
30                 self.name = name
31                 if type(where) is list:
32                         self.where = where
33                 else:
34                         self.where = [ where ]
35                 self.description = description
36
37                 self.iconstr = icon
38                 self.icon = None
39
40                 self.__call__ = fnc
41
42         def updateIcon(self, path):
43                 if type(self.iconstr) is str:
44                         self.icon = loadPNG(path + self.iconstr)
45                 else:
46                         self.icon = None