1
0

kivy: split on_wizard_complete in two methods

This commit is contained in:
ThomasV
2020-12-04 11:56:39 +01:00
parent da2c8a3c05
commit 13b05f64e6
2 changed files with 8 additions and 6 deletions

View File

@@ -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),
@@ -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')

View File

@@ -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()
@@ -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']