diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-10 17:06:28 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-10 17:06:28 +0100 |
commit | bd2d1caa0ab8f83500633d011b8c01b4213484fc (patch) | |
tree | 2b25c824e7e04b2bbc9ff8241bd7a9be22c2b067 /src/plugin_manager.py | |
parent | eaced10c1667d0ddf8cf41aebf060a6c2be7173b (diff) | |
download | poezio-bd2d1caa0ab8f83500633d011b8c01b4213484fc.tar.gz poezio-bd2d1caa0ab8f83500633d011b8c01b4213484fc.tar.bz2 poezio-bd2d1caa0ab8f83500633d011b8c01b4213484fc.tar.xz poezio-bd2d1caa0ab8f83500633d011b8c01b4213484fc.zip |
Autoload plugins in session_start instead of core.__init__
Diffstat (limited to 'src/plugin_manager.py')
-rw-r--r-- | src/plugin_manager.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugin_manager.py b/src/plugin_manager.py index 36887084..fe4d2b7e 100644 --- a/src/plugin_manager.py +++ b/src/plugin_manager.py @@ -37,7 +37,7 @@ class PluginManager(object): self.event_handlers = {} # module name -> list of event_name/handler pairs loaded for the module self.tab_commands = {} #module name -> dict of tab types; tab type -> commands loaded by the module - def load(self, name): + def load(self, name, notify=True): if name in self.plugins: self.unload(name) @@ -64,9 +64,10 @@ class PluginManager(object): self.tab_commands[name] = {} self.event_handlers[name] = [] self.plugins[name] = module.Plugin(self, self.core, plugins_conf_dir) - self.core.information('Plugin %s loaded' % name, 'Info') + if notify: + self.core.information('Plugin %s loaded' % name, 'Info') - def unload(self, name): + def unload(self, name, notify=True): if name in self.plugins: try: for command in self.commands[name].keys(): @@ -83,7 +84,8 @@ class PluginManager(object): del self.commands[name] del self.tab_commands[name] del self.event_handlers[name] - self.core.information('Plugin %s unloaded' % name, 'Info') + if notify: + self.core.information('Plugin %s unloaded' % name, 'Info') except Exception as e: import traceback self.core.information(_("Could not unload plugin (may not be safe to try again): ") + traceback.format_exc()) |