From 93d05e8cfe9e419a316a8ac78b21a4112f964710 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 31 Dec 2015 10:31:49 +0900 Subject: [PATCH] Have close_wallet hook take a wallet. --- gui/qt/main_window.py | 2 +- plugins/ledger/ledger.py | 6 ++---- plugins/trezor/plugin.py | 4 ++-- plugins/trezor/qt_generic.py | 3 --- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index add387333..0df87a274 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -244,7 +244,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): self.print_error('close_wallet', self.wallet.storage.path) self.wallet.storage.put('accounts_expanded', self.accounts_expanded) self.wallet.stop_threads() - run_hook('close_wallet') + run_hook('close_wallet', self.wallet) def load_wallet(self, wallet): self.wallet = wallet diff --git a/plugins/ledger/ledger.py b/plugins/ledger/ledger.py index 2328552fe..55a7fd0fc 100644 --- a/plugins/ledger/ledger.py +++ b/plugins/ledger/ledger.py @@ -434,13 +434,11 @@ class LedgerPlugin(BasePlugin): return True @hook - def close_wallet(self): - pass + def close_wallet(self, wallet): + self.client = None @hook def installwizard_load_wallet(self, wallet, window): - if type(wallet) != BTChipWallet: - return self.load_wallet(wallet, window) @hook diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py index 6658e02c6..1f8c8b90b 100644 --- a/plugins/trezor/plugin.py +++ b/plugins/trezor/plugin.py @@ -193,9 +193,9 @@ class TrezorCompatiblePlugin(BasePlugin): return self.get_client().atleast_version(major, minor, patch) @hook - def close_wallet(self): - self.print_error("clear session") + def close_wallet(self, wallet): if self.client: + self.print_error("clear session") self.client.clear_session() self.client.transport.close() self.client = None diff --git a/plugins/trezor/qt_generic.py b/plugins/trezor/qt_generic.py index 645aafa5a..74d68a7c4 100644 --- a/plugins/trezor/qt_generic.py +++ b/plugins/trezor/qt_generic.py @@ -124,9 +124,6 @@ class QtPlugin(TrezorPlugin): @hook def installwizard_load_wallet(self, wallet, window): - if type(wallet) != self.wallet_class: - return - wallet.plugin = self self.load_wallet(wallet, window) @hook