kivy wizard: if wallet creation is aborted, show message in the wizard and stop the GUI. (see #6796)
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user