tfix plugins initialization - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 78ce20b0b8461c84bd40d039b3346a448a9e810f DIR parent 36a5e095324248920f349335cfa32a6808943a1e HTML Author: ThomasV <thomasv@gitorious> Date: Sat, 31 Jan 2015 18:09:50 +0100 fix plugins initialization Diffstat: M lib/plugins.py | 3 +++ M plugins/trezor.py | 23 ++++++++++------------- M plugins/trustedcoin.py | 8 ++------ 3 files changed, 15 insertions(+), 19 deletions(-) --- DIR diff --git a/lib/plugins.py b/lib/plugins.py t@@ -46,6 +46,9 @@ def run_hook(name, *args): for p, f in f_list: if name == 'load_wallet': p.wallet = args[0] + if name == 'init_qt': + gui = args[0] + p.window = gui.main_window if name in SPECIAL_HOOKS or p.is_enabled(): try: r = f(*args) DIR diff --git a/plugins/trezor.py b/plugins/trezor.py t@@ -55,11 +55,13 @@ class Plugin(BasePlugin): return TREZOR def is_available(self): - if self.wallet is None: - return self._is_available - if self.wallet.storage.get('wallet_type') == 'trezor': - return True - return False + if not self._is_available: + return False + if not self.wallet: + return False + if self.wallet.storage.get('wallet_type') != 'trezor': + return False + return True def requires_settings(self): return self._requires_settings t@@ -70,11 +72,9 @@ class Plugin(BasePlugin): def is_enabled(self): if not self.is_available(): return False - - if not self.wallet or self.wallet.storage.get('wallet_type') == 'trezor': - return True - - return self.wallet.storage.get('use_' + self.name) is True + if self.wallet.has_seed(): + return False + return True def enable(self): return BasePlugin.enable(self) t@@ -98,9 +98,6 @@ class Plugin(BasePlugin): @hook def load_wallet(self, wallet): - self.wallet = wallet - if self.wallet.has_seed(): - return if self.trezor_is_connected(): if not self.wallet.check_proper_device(): QMessageBox.information(self.window, _('Error'), _("This wallet does not match your Trezor device"), _('OK')) DIR diff --git a/plugins/trustedcoin.py b/plugins/trustedcoin.py t@@ -223,8 +223,8 @@ class Plugin(BasePlugin): + _("For more information, visit") + " <a href=\"https://api.trustedcoin.com/#/electrum-help\">https://api.trustedcoin.com/#/electrum-help</a>" def is_available(self): - if self.wallet is None: - return True + if not self.wallet: + return False if self.wallet.storage.get('wallet_type') == '2fa': return True return False t@@ -238,10 +238,6 @@ class Plugin(BasePlugin): def is_enabled(self): if not self.is_available(): return False - if not self.wallet: - return True - if self.wallet.storage.get('wallet_type') != '2fa': - return False if self.wallet.master_private_keys.get('x2/'): return False return True