diff options
| author | acid-burn <acid-burn@opendreambox.org> | 2011-02-11 13:32:34 +0100 |
|---|---|---|
| committer | acid-burn <acid-burn@opendreambox.org> | 2011-02-11 13:32:34 +0100 |
| commit | cdb8a973f09efb2d42875d7854edba9a411719ff (patch) | |
| tree | 5b921108c57976ee785b89ed57490abf3707b760 /lib/python/Components/PluginComponent.py | |
| parent | 09eaa1b41d5b74464ad83eda66be50689247074f (diff) | |
| parent | 03706708fac0d7ac8cf0b63af9e473416f42e1b5 (diff) | |
| download | enigma2-cdb8a973f09efb2d42875d7854edba9a411719ff.tar.gz enigma2-cdb8a973f09efb2d42875d7854edba9a411719ff.zip | |
Merge remote branch 'origin/acid-burn/bug_670_plugin_restartoption'
Diffstat (limited to 'lib/python/Components/PluginComponent.py')
| -rwxr-xr-x | lib/python/Components/PluginComponent.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index 5e439fdf..0e178fff 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""" |
