use categories to categorize the plugins
[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                 if type(icon) is str or icon is None:
38                         self.iconstr = icon
39                         self.icon = None
40                 else:
41                         self.icon = icon
42
43                 self.__call__ = fnc
44
45         def updateIcon(self, path):
46                 if type(self.iconstr) is str:
47                         self.icon = loadPNG(path + self.iconstr)
48                 else:
49                         self.icon = None
50
51         def __eq__(self, other):
52                 return self.__call__ == other.__call__