diff options
| author | Andreas Oberritter <obi@opendreambox.org> | 2011-02-22 18:47:12 +0100 |
|---|---|---|
| committer | Andreas Oberritter <obi@opendreambox.org> | 2011-02-22 18:47:12 +0100 |
| commit | 1b1339127ce152097492d899e401e3c6a2438f2c (patch) | |
| tree | 24b84dbbb8291eabd3b8d6f45dde919bcf249c42 /lib/python/Components/PluginComponent.py | |
| parent | 1f959e3bd0d5642d8b7381268cc4747028c38e9b (diff) | |
| parent | 1e4c82ee8d55cd1fc22da279eecdfb6a25521eb5 (diff) | |
| download | enigma2-1b1339127ce152097492d899e401e3c6a2438f2c.tar.gz enigma2-1b1339127ce152097492d899e401e3c6a2438f2c.zip | |
Merge branch 'master' into obi/master
Diffstat (limited to 'lib/python/Components/PluginComponent.py')
| -rwxr-xr-x | 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 5e439fdf..e5194b28 100755 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -8,6 +8,9 @@ from Plugins.Plugin import PluginDescriptor import keymapparser class PluginComponent: + firstRun = True + restartRequired = False + def __init__(self): self.plugins = {} self.pluginList = [ ] @@ -18,12 +21,15 @@ class PluginComponent: self.prefix = prefix 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) - + if self.firstRun or plugin.needsRestart is False: + self.pluginList.append(plugin) + for x in plugin.where: + self.plugins.setdefault(x, []).append(plugin) + if x == PluginDescriptor.WHERE_AUTOSTART: + plugin(reason=0) + else: + self.restartRequired = True + def removePlugin(self, plugin): self.pluginList.remove(plugin) for x in plugin.where: @@ -81,12 +87,21 @@ class PluginComponent: # internally, the "fnc" argument will be compared with __eq__ plugins_added = [p for p in new_plugins if p not in self.pluginList] plugins_removed = [p for p in self.pluginList if not p.internal and p not in new_plugins] + + #ignore already installed but reloaded plugins + for p in plugins_removed: + for pa in plugins_added: + if pa.name == p.name and pa.where == p.where: + pa.needsRestart = False for p in plugins_removed: self.removePlugin(p) for p in plugins_added: self.addPlugin(p) + + if self.firstRun: + self.firstRun = False def getPlugins(self, where): """Get list of plugins in a specific category""" @@ -109,6 +124,8 @@ class PluginComponent: def clearPluginList(self): self.pluginList = [] self.plugins = {} + self.firstRun = True + self.restartRequired = False def shutdown(self): for p in self.pluginList[:]: |
