add ConfigurationBackup plugin
[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         # you have to ignore unknown kwargs!
15         
16         # argument: session
17         WHERE_BLUEMENU = 0
18         WHERE_MAINMENU = 1
19         WHERE_PLUGINMENU  = 2
20         # argument: session, serviceref (currently selected)
21         WHERE_MOVIELIST = 3
22         # ...
23         WHERE_SETUP    = 4
24         
25         # reason (0: start, 1: end)
26         WHERE_AUTOSTART = 5
27         
28         # start as wizard. In that case, fnc must be a screen class!
29         WHERE_WIZARD = 6
30         
31         def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None):
32                 self.name = name
33                 if type(where) is list:
34                         self.where = where
35                 else:
36                         self.where = [ where ]
37                 self.description = description
38
39                 if type(icon) is str or icon is None:
40                         self.iconstr = icon
41                         self.icon = None
42                 else:
43                         self.icon = icon
44
45                 self.__call__ = fnc
46
47         def updateIcon(self, path):
48                 if type(self.iconstr) is str:
49                         self.icon = loadPNG(path + "/" + self.iconstr)
50                 else:
51                         self.icon = None
52
53         def __eq__(self, other):
54                 return self.__call__ == other.__call__