add plugin weight to PluginDescriptor... so the plugin start order can be changed now
authorghost <andreas.monzner@multimedia-labs.de>
Thu, 3 Mar 2011 17:43:41 +0000 (18:43 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Thu, 3 Mar 2011 17:43:41 +0000 (18:43 +0100)
lib/python/Components/PluginComponent.py
lib/python/Plugins/Plugin.py

index 93b0890..a713c3b 100755 (executable)
@@ -122,13 +122,14 @@ class PluginComponent:
 
                for x in where:
                        res.extend(self.plugins.get(x, [ ]))
-
-               return  res
+               res.sort(key=lambda x:x.weight)
+               return res
 
        def getPluginsForMenu(self, menuid):
                res = [ ]
                for p in self.getPlugins(PluginDescriptor.WHERE_MENU):
                        res += p(menuid)
+               res.sort(key=lambda x:x.weight)
                return res
 
        def clearPluginList(self):
index e26174a..d87e6e9 100755 (executable)
@@ -61,7 +61,7 @@ class PluginDescriptor:
        WHERE_SOFTWAREMANAGER = 14
 
 
-       def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, needsRestart = None, internal = False):
+       def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, needsRestart = None, internal = False, weight = 0):
                self.name = name
                self.internal = internal
                self.needsRestart = needsRestart
@@ -78,6 +78,8 @@ class PluginDescriptor:
                else:
                        self.icon = icon
 
+               self.weight = weight
+
                self.wakeupfnc = wakeupfnc
 
                self.__call__ = fnc