add Plugin.py
[openblackhole/openblackhole-enigma2.git] / lib / python / Plugins / Plugin.py
1 class PluginDescriptor:
2         """An object to describe a plugin."""
3         
4         # where to list the plugin. Note that there are different call arguments,
5         # so you might not be able to combine them.
6         
7         # supported arguments are:
8         #   session
9         #   servicereference
10         #   reason
11         
12         # argument: session
13         WHERE_BLUEMENU = 0
14         WHERE_MAINMENU = 1
15         WHERE_PLUGINMENU  = 2
16         # argument: session, serviceref (currently selected)
17         WHERE_MOVIELIST = 3
18         # ...
19         WHERE_SETUP    = 4
20         
21         # reason (0: start, 1: end)
22         WHERE_AUTOSTART = 5
23         
24         def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None):
25                 self.name = name
26                 if type(where) is list:
27                         self.where = where
28                 else:
29                         self.where = [ where ]
30                 self.description = description
31                 if type(fnc) is str:
32                         self.icon = loadPNG("..")
33                 else:
34                         self.icon = icon
35                 self.__call__ = fnc