more fixes for kivy

This commit is contained in:
ThomasV 2016-08-30 11:19:30 +02:00
parent 08733c09c4
commit 83dbe7fbf3
3 changed files with 19 additions and 11 deletions

View File

@ -418,10 +418,11 @@ class ElectrumWindow(App):
if not path: if not path:
return return
wallet = self.daemon.load_wallet(path) wallet = self.daemon.load_wallet(path)
if wallet != self.wallet: if wallet:
self.stop_wallet() if wallet != self.wallet:
self.load_wallet(wallet) self.stop_wallet()
self.on_resume() self.load_wallet(wallet)
self.on_resume()
else: else:
Logger.debug('Electrum: Wallet not found. Launching install wizard') Logger.debug('Electrum: Wallet not found. Launching install wizard')
wizard = Factory.InstallWizard(self.electrum_config, self.network, path) wizard = Factory.InstallWizard(self.electrum_config, self.network, path)
@ -537,7 +538,6 @@ class ElectrumWindow(App):
@profiler @profiler
def load_wallet(self, wallet): def load_wallet(self, wallet):
self.wallet = wallet self.wallet = wallet
self.current_account = self.wallet.storage.get('current_account', None)
self.update_wallet() self.update_wallet()
# Once GUI has been initialized check if we want to announce something # Once GUI has been initialized check if we want to announce something
# since the callback has been called before the GUI was initialized # since the callback has been called before the GUI was initialized
@ -560,7 +560,7 @@ class ElectrumWindow(App):
elif server_lag > 1: elif server_lag > 1:
status = _("Server lagging (%d blocks)"%server_lag) status = _("Server lagging (%d blocks)"%server_lag)
else: else:
c, u, x = self.wallet.get_balance(self.current_account) c, u, x = self.wallet.get_balance()
text = self.format_amount(c+x+u) text = self.format_amount(c+x+u)
status = str(text.strip() + ' ' + self.base_unit) status = str(text.strip() + ' ' + self.base_unit)
else: else:
@ -790,12 +790,16 @@ class ElectrumWindow(App):
def _show_seed(self, label, password): def _show_seed(self, label, password):
if self.wallet.has_password() and password is None: if self.wallet.has_password() and password is None:
return return
keystore = self.wallet.keystore
try: try:
seed = self.wallet.get_seed(password) seed = keystore.get_seed(password)
passphrase = keystore.get_passphrase(password)
except: except:
self.show_error("Invalid PIN") self.show_error("Invalid PIN")
return return
label.text = _('Seed') + ':\n' + seed label.text = _('Seed') + ':\n' + seed
if passphrase:
label.text += '\n\n' + _('Passphrase') + ': ' + passphrase
def change_password(self, cb): def change_password(self, cb):
if self.wallet.has_password(): if self.wallet.has_password():

View File

@ -157,7 +157,7 @@ class HistoryScreen(CScreen):
def update(self, see_all=False): def update(self, see_all=False):
if self.app.wallet is None: if self.app.wallet is None:
return return
history = reversed(self.app.wallet.get_history(self.app.current_account)) history = reversed(self.app.wallet.get_history())
history_card = self.screen.ids.history_container history_card = self.screen.ids.history_container
history_card.clear_widgets() history_card.clear_widgets()
count = 0 count = 0

View File

@ -118,14 +118,16 @@ class BaseWizard(object):
('create_seed', _('Create a new seed')), ('create_seed', _('Create a new seed')),
('restore_from_seed', _('I already have a seed')), ('restore_from_seed', _('I already have a seed')),
('restore_from_key', _('Use public or private keys')), ('restore_from_key', _('Use public or private keys')),
('choose_hw_device', _('Use a hardware device')),
] ]
if not self.is_kivy:
choices.append(('choose_hw_device', _('Use a hardware device')))
else: else:
message = _('Add a cosigner to your multi-sig wallet') message = _('Add a cosigner to your multi-sig wallet')
choices = [ choices = [
('restore_from_key', _('Enter cosigner key')), ('restore_from_key', _('Enter cosigner key')),
('choose_hw_device', _('Cosign with hardware device')),
] ]
if not self.is_kivy:
choices.append(('choose_hw_device', _('Cosign with hardware device')))
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run) self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run)
@ -281,7 +283,9 @@ class BaseWizard(object):
self.run('create_wallet') self.run('create_wallet')
elif self.wallet_type == 'multisig': elif self.wallet_type == 'multisig':
if k.xpub in map(lambda x: x.xpub, self.keystores): if k.xpub in map(lambda x: x.xpub, self.keystores):
raise BaseException('duplicate key') self.show_error(_('Error: duplicate master public key'))
self.run('choose_keystore')
return
self.keystores.append(k) self.keystores.append(k)
if len(self.keystores) == 1: if len(self.keystores) == 1:
xpub = k.get_master_public_key() xpub = k.get_master_public_key()