electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit f9047c6df0f7463e793d5980df31e08743302f52
parent 26f2c757d39d32de7d32a058ff9147a658713c9a
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Sun,  6 Sep 2015 19:35:14 +0900

Fix for dynamic loading and unloading of plugins

Need to add and remove thread jobs

Diffstat:
Mlib/plugins.py | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/plugins.py b/lib/plugins.py @@ -73,6 +73,8 @@ class Plugins: # Inform the plugin of our windows for window in self.windows: plugin.on_new_window(window) + if self.network: + self.network.add_jobs(plugin.thread_jobs()) self.plugins[name] = plugin self.print_error("loaded", name) return plugin @@ -81,6 +83,10 @@ class Plugins: traceback.print_exc(file=sys.stdout) return None + def close_plugin(self, plugin): + if self.network: + self.network.remove_jobs(plugin.thread_jobs()) + def toggle_enabled(self, config, name): p = self.get(name) config.set_key('use_' + name, p is None, True) @@ -199,6 +205,7 @@ class BasePlugin: l = hooks.get(k, []) l.remove((self, getattr(self, k))) hooks[k] = l + self.parent.close_plugin(self) def print_error(self, *msg): print_error("[%s]"%self.name, *msg)