tkivy: split on_wizard_complete in two methods - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 13b05f64e6a89b90b80a470538798c116f968170 DIR parent da2c8a3c0527fef0e4f1fc047ce10179cfadbb88 HTML Author: ThomasV <thomasv@electrum.org> Date: Fri, 4 Dec 2020 11:56:39 +0100 kivy: split on_wizard_complete in two methods Diffstat: M electrum/gui/kivy/main_window.py | 8 +++++--- M electrum/gui/kivy/uix/dialogs/inst… | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) --- DIR diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py t@@ -631,14 +631,16 @@ class ElectrumWindow(App, Logger): else: return '' - def on_wizard_complete(self, storage, db, password): + def on_wizard_success(self, storage, db, password): if storage: self.password = password wallet = Wallet(db, storage, config=self.electrum_config) wallet.start_network(self.daemon.network) self.daemon.add_wallet(wallet) self.load_wallet(wallet) - elif not self.wallet: + + def on_wizard_aborted(self): + 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), t@@ -675,7 +677,7 @@ class ElectrumWindow(App, Logger): assert storage.is_past_initial_decryption() db = WalletDB(storage.read(), manual_upgrades=False) assert not db.requires_upgrade() - self.on_wizard_complete(storage, db, password) + self.on_wizard_success(storage, db, password) def on_stop(self): self.logger.info('on_stop') DIR diff --git a/electrum/gui/kivy/uix/dialogs/installwizard.py b/electrum/gui/kivy/uix/dialogs/installwizard.py t@@ -643,7 +643,7 @@ class WizardDialog(EventsDialog): self._on_release = True self.close() if not button: - self.app.on_wizard_complete(None, None) + self.wizard.terminate(aborted=True) return if button is self.ids.back: self.wizard.go_back() t@@ -1065,9 +1065,9 @@ class InstallWizard(BaseWizard, Widget): if not aborted: password = self.pw_args.password storage, db = self.create_storage(self.path) + self.app.on_wizard_success(storage, db, password) else: - password = None - self.app.on_wizard_complete(storage, db, password) + self.app.on_wizard_aborted() def choice_dialog(self, **kwargs): choices = kwargs['choices']