diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-02-19 20:47:23 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-02-19 20:47:23 +0000 |
| commit | 57534d26a3ec9cc77ab3eedc5ad393897e4dee95 (patch) | |
| tree | 42b9c2fd59234c4fb6830728c9824bce1625d01c /lib/python/Components/PluginComponent.py | |
| parent | daaf4b6ba8fbddd81553e0076385220ef1a7f327 (diff) | |
| download | enigma2-57534d26a3ec9cc77ab3eedc5ad393897e4dee95.tar.gz enigma2-57534d26a3ec9cc77ab3eedc5ad393897e4dee95.zip | |
re-add autostart plugins
Diffstat (limited to 'lib/python/Components/PluginComponent.py')
| -rw-r--r-- | lib/python/Components/PluginComponent.py | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index cfdbc4d0..bd8a6d07 100644 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -1,6 +1,7 @@ import os from Tools.Directories import * +from Plugins.Plugin import PluginDescriptor def my_import(name): mod = __import__(name) @@ -12,12 +13,27 @@ def my_import(name): class PluginComponent: def __init__(self): self.plugins = {} + self.pluginList = [ ] self.setPluginPrefix("Plugins.") def setPluginPrefix(self, prefix): self.prefix = prefix - - def readPluginList(self, runAutostartPlugins=False, runAutoendPlugins=False): + + def addPlugin(self, plugin): + self.pluginList.append(plugin) + for x in plugin.where: + self.plugins.setdefault(x, []).append(plugin) + if x == PluginDescriptor.WHERE_AUTOSTART: + plugin(reason=0) + + def removePlugin(self, plugin): + self.pluginList.remove(plugin) + for x in plugin.where: + self.plugins[x].remove(plugin) + if x == PluginDescriptor.WHERE_AUTOSTART: + plugin(reason=1) + + def readPluginList(self): """enumerates plugins""" directories = os.listdir(resolveFilename(SCOPE_PLUGINS)) @@ -40,10 +56,7 @@ class PluginComponent: plugins = [ plugins ] for p in plugins: - print "imported plugin %s" % (p.name) - - for x in p.where: - self.plugins.setdefault(x, []).append(p) + self.addPlugin(p); def getPlugins(self, where): """Get list of plugins in a specific category""" @@ -56,4 +69,8 @@ class PluginComponent: res.append(p) return res + def shutdown(self): + for p in self.pluginList[:]: + self.removePlugin(p) + plugins = PluginComponent() |
