From 20f93f7df0752d81f49a69480d109b4b6972a313 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Tue, 19 Aug 2014 10:36:55 +0200 Subject: [PATCH] set wallet.can_change_password and wallet.has_seed for trezor --- gui/qt/main_window.py | 16 ++++------------ lib/wallet.py | 6 ++++++ plugins/trezor.py | 6 ++++++ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 32c34bc9..87a7d352 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -221,7 +221,7 @@ class ElectrumWindow(QMainWindow): # update menus self.new_account_menu.setEnabled(self.wallet.can_create_accounts()) self.private_keys_menu.setEnabled(not self.wallet.is_watching_only()) - self.password_menu.setEnabled(not self.wallet.is_watching_only()) + self.password_menu.setEnabled(self.wallet.can_change_password()) self.seed_menu.setEnabled(self.wallet.has_seed()) self.mpk_menu.setEnabled(self.wallet.is_deterministic()) self.import_menu.setEnabled(self.wallet.can_import()) @@ -1725,17 +1725,9 @@ class ElectrumWindow(QMainWindow): def update_buttons_on_seed(self): - if self.wallet.has_seed(): - self.seed_button.show() - else: - self.seed_button.hide() - - if not self.wallet.is_watching_only(): - self.password_button.show() - self.send_button.setText(_("Send")) - else: - self.password_button.hide() - self.send_button.setText(_("Create unsigned transaction")) + self.seed_button.setVisible(self.wallet.has_seed()) + self.password_button.setVisible(self.wallet.can_change_password()) + self.send_button.setText(_("Create unsigned transaction") if self.wallet.is_watching_only() else _("Send")) def change_password_dialog(self): diff --git a/lib/wallet.py b/lib/wallet.py index 78dddec0..20e88243 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -992,6 +992,12 @@ class Abstract_Wallet(object): def can_sign(self, tx): pass + def is_watching_only(self): + False + + def can_change_password(self): + return not self.is_watching_only() + class Imported_Wallet(Abstract_Wallet): def __init__(self, storage): diff --git a/plugins/trezor.py b/plugins/trezor.py index f30d3063..921b69af 100644 --- a/plugins/trezor.py +++ b/plugins/trezor.py @@ -108,6 +108,12 @@ class TrezorWallet(NewWallet): def can_create_accounts(self): return True + def can_change_password(self): + return False + + def has_seed(self): + return False + def is_watching_only(self): return False