1 from Components.config import ConfigSubsection, config
2 from Tools.LoadPixmap import LoadPixmap
4 config.plugins = ConfigSubsection()
6 class PluginDescriptor:
7 """An object to describe a plugin."""
9 # where to list the plugin. Note that there are different call arguments,
10 # so you might not be able to combine them.
12 # supported arguments are:
17 # you have to ignore unknown kwargs!
20 WHERE_EXTENSIONSMENU = 0
23 # argument: session, serviceref (currently selected)
25 # argument: menuid. Fnc must return list with menuitems (4-tuple of name, fnc to call, entryid or None, weight or None)
28 # reason (0: start, 1: end)
31 # start as wizard. In that case, fnc must be tuple (priority,class) with class being a screen class!
34 # like autostart, but for a session. currently, only session starts are
35 # delivered, and only on pre-loaded plugins
36 WHERE_SESSIONSTART = 7
38 # start as teletext plugin. arguments: session, serviceref
41 # file-scanner, fnc must return a list of Scanners
44 # fnc must take an interface name as parameter and return None if the plugin supports an extended setup
45 # or return a function which is called with session and the interface name for extended setup of this interface
46 WHERE_NETWORKSETUP = 10
48 def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False):
50 self.internal = internal
51 if type(where) is list:
54 self.where = [ where ]
55 self.description = description
57 if type(icon) is str or icon is None:
63 self.wakeupfnc = wakeupfnc
67 def updateIcon(self, path):
68 if type(self.iconstr) is str:
69 self.icon = LoadPixmap(path + "/" + self.iconstr)
73 def getWakeupTime(self):
74 return self.wakeupfnc and self.wakeupfnc() or -1
76 def __eq__(self, other):
77 return self.__call__ == other.__call__