diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py index 4b64c01bd..50c1a860d 100644 --- 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 index 8561f4246..e838a5c97 100644 --- 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']