electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 9ad4d63ad1fbe22298952809fa547bf2aa2349f7
parent 2f1d6b237954b306cfc456a8f56ddcdc3a318ade
Author: ThomasV <thomasv@electrum.org>
Date:   Sat,  9 Jan 2016 10:35:10 +0100

wizard: small tweaks, fix show_restore

Diffstat:
Mgui/qt/installwizard.py | 32+++++++++++++++++---------------
Mlib/wizard.py | 18+++++++++++-------
2 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py @@ -131,22 +131,24 @@ class InstallWizard(WindowModalDialog, WizardBase): return self.pw_dialog(msg or MSG_ENTER_PASSWORD, PasswordDialog.PW_NEW) def choose_server(self, network): - # Show network dialog if config does not exist - if self.config.get('server') is None: - self.network_dialog(network) - - def show_restore(self, wallet, network, action): - def on_finished(b): - if action == 'restore': - if network: - if wallet.is_found(): - msg = _("Recovery successful") - else: - msg = _("No transactions found for this seed") + self.network_dialog(network) + + def show_restore(self, wallet, network): + if network: + def task(): + wallet.wait_until_synchronized() + if wallet.is_found(): + msg = _("Recovery successful") else: - msg = _("This wallet was restored offline. It may " - "contain more addresses than displayed.") - self.show_message(msg) + msg = _("No transactions found for this seed") + self.emit(QtCore.SIGNAL('synchronized'), msg) + self.connect(self, QtCore.SIGNAL('synchronized'), self.show_message) + t = threading.Thread(target = task) + t.start() + else: + msg = _("This wallet was restored offline. It may " + "contain more addresses than displayed.") + self.show_message(msg) def create_addresses(self, wallet): def task(): diff --git a/lib/wizard.py b/lib/wizard.py @@ -115,7 +115,7 @@ class WizardBase(PrintError): """Choose a server if one is not set in the config anyway.""" raise NotImplementedError - def show_restore(self, wallet, network, action): + def show_restore(self, wallet, network): """Show restore result""" pass @@ -124,17 +124,19 @@ class WizardBase(PrintError): filename. If the file doesn't exist launch the GUI-specific install wizard proper.''' storage = WalletStorage(filename) + need_sync = False + is_restore = False + if storage.file_exists: wallet = Wallet(storage) self.update_wallet_format(wallet) - task = None else: cr, wallet = self.create_or_restore(storage) if not wallet: return - task = lambda: self.show_restore(wallet, network, cr) + need_sync = True + is_restore = (cr == 'restore') - need_sync = False while True: action = wallet.get_action() if not action: @@ -145,7 +147,9 @@ class WizardBase(PrintError): wallet.storage.write() if network: - self.choose_server(network) + # Show network dialog if config does not exist + if self.config.get('server') is None: + self.choose_server(network) else: self.show_warning(_('You are offline')) @@ -156,8 +160,8 @@ class WizardBase(PrintError): if network: wallet.start_threads(network) - if task: - task() + if is_restore: + self.show_restore(wallet, network) return wallet