add parameter to Console screen to set the console window title
[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         # like autostart, but for a session. currently, only session starts are 
32         # delivered, and only on pre-loaded plugins
33         WHERE_SESSIONSTART = 7
34         
35         def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None):
36                 self.name = name
37                 if type(where) is list:
38                         self.where = where
39                 else:
40                         self.where = [ where ]
41                 self.description = description
42
43                 if type(icon) is str or icon is None:
44                         self.iconstr = icon
45                         self.icon = None
46                 else:
47                         self.icon = icon
48
49                 self.__call__ = fnc
50
51         def updateIcon(self, path):
52                 if type(self.iconstr) is str:
53                         self.icon = loadPNG(path + "/" + self.iconstr)
54                 else:
55                         self.icon = None
56
57         def __eq__(self, other):
58                 return self.__call__ == other.__call__