electrum

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

commit 5058cf9d22d2aac5c62bac396768dc521384eb80
parent 13b05f64e6a89b90b80a470538798c116f968170
Author: ThomasV <thomasv@electrum.org>
Date:   Fri,  4 Dec 2020 15:16:30 +0100

kivy wizard: if wallet creation is aborted, show message in the wizard and stop the GUI. (see #6796)

Diffstat:
Melectrum/gui/kivy/main_window.py | 28++++++----------------------
Melectrum/gui/kivy/uix/dialogs/installwizard.py | 5++++-
2 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py @@ -639,34 +639,18 @@ class ElectrumWindow(App, Logger): self.daemon.add_wallet(wallet) self.load_wallet(wallet) - def on_wizard_aborted(self): + def on_wizard_aborted(self, wizard): + # wizard did not return a wallet; and there is no wallet open atm if not self.wallet: - # wizard did not return a wallet; and there is no wallet open atm - # try to open last saved wallet (potentially start wizard again) - self.load_wallet_by_name(self.electrum_config.get_wallet_path(use_gui_last_wallet=True), - ask_if_wizard=True) + self.stop() - def load_wallet_by_name(self, path, ask_if_wizard=False): + def load_wallet_by_name(self, path): if not path: return if self.wallet and self.wallet.storage.path == path: return - else: - def launch_wizard(): - d = OpenWalletDialog(self, path, self.on_open_wallet) - d.open() - if not ask_if_wizard: - launch_wizard() - else: - def handle_answer(b: bool): - if b: - launch_wizard() - else: - try: os.unlink(path) - except FileNotFoundError: pass - self.stop() - d = Question(_('Do you want to launch the wizard again?'), handle_answer) - d.open() + d = OpenWalletDialog(self, path, self.on_open_wallet) + d.open() def on_open_wallet(self, password, storage): if not storage.file_exists(): diff --git a/electrum/gui/kivy/uix/dialogs/installwizard.py b/electrum/gui/kivy/uix/dialogs/installwizard.py @@ -1067,7 +1067,10 @@ class InstallWizard(BaseWizard, Widget): storage, db = self.create_storage(self.path) self.app.on_wizard_success(storage, db, password) else: - self.app.on_wizard_aborted() + try: os.unlink(self.path) + except FileNotFoundError: pass + self.reset_stack() + self.confirm_dialog(message=_('Wallet creation failed'), run_next=self.app.on_wizard_aborted) def choice_dialog(self, **kwargs): choices = kwargs['choices']