Dont activate plugins in PluginManager init

Plugins maybe want to use in their activation Gajim methods that
use an extension point. But because the PluginManager Object is not fully
initialized, the extension point method is not available yet

First create the PluginManager Object, then load Plugins.
This commit is contained in:
Philipp Hörist 2017-11-15 22:26:55 +01:00
parent 0fe78daae8
commit 775fec2fea
2 changed files with 5 additions and 1 deletions

View File

@ -2761,6 +2761,7 @@ class Interface:
# Creating plugin manager
from gajim import plugins
app.plugin_manager = plugins.PluginManager()
app.plugin_manager.init_plugins()
helpers.update_optional_features()
# prepopulate data which we are sure of; note: we do not log these info

View File

@ -110,7 +110,6 @@ class PluginManager(metaclass=Singleton):
for path in [app.PLUGINS_DIRS[1], app.PLUGINS_DIRS[0]]:
pc = PluginManager.scan_dir_for_plugins(path)
self.add_plugins(pc)
self._activate_all_plugins_from_global_config()
@log_calls('PluginManager')
def _plugin_has_entry_in_global_config(self, plugin):
@ -126,6 +125,10 @@ class PluginManager(metaclass=Singleton):
def _remove_plugin_entry_in_global_config(self, plugin):
app.config.del_per('plugins', plugin.short_name)
@log_calls('PluginManager')
def init_plugins(self):
self._activate_all_plugins_from_global_config()
@log_calls('PluginManager')
def add_plugin(self, plugin_class):
'''