set wallet.can_change_password and wallet.has_seed for trezor

This commit is contained in:
ThomasV 2014-08-19 10:36:55 +02:00
parent 11e1e0e923
commit 20f93f7df0
3 changed files with 16 additions and 12 deletions

View File

@ -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):

View File

@ -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):

View File

@ -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