commit 3f9d7d8b337ca14a117848fb8127b760bcfc1747
parent 7ce4727507582ba7efffe0624c849d54046cabde
Author: ThomasV <thomasv@electrum.org>
Date: Thu, 3 Dec 2020 10:23:01 +0100
kivy: save password after wallet creation
Previously, operations that require password
would fail until the wallet is reopened
Diffstat:
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py
@@ -631,8 +631,9 @@ class ElectrumWindow(App, Logger):
else:
return ''
- def on_wizard_complete(self, storage, db):
+ def on_wizard_complete(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)
@@ -665,17 +666,16 @@ class ElectrumWindow(App, Logger):
d = Question(_('Do you want to launch the wizard again?'), handle_answer)
d.open()
- def on_open_wallet(self, pw, storage):
+ def on_open_wallet(self, password, storage):
if not storage.file_exists():
wizard = Factory.InstallWizard(self.electrum_config, self.plugins)
wizard.path = storage.path
wizard.run('new')
else:
assert storage.is_past_initial_decryption()
- self.password = pw
db = WalletDB(storage.read(), manual_upgrades=False)
assert not db.requires_upgrade()
- self.on_wizard_complete(storage, db)
+ self.on_wizard_complete(storage, db, password)
def on_stop(self):
self.logger.info('on_stop')
diff --git a/electrum/gui/kivy/uix/dialogs/installwizard.py b/electrum/gui/kivy/uix/dialogs/installwizard.py
@@ -1060,9 +1060,14 @@ class InstallWizard(BaseWizard, Widget):
self.app = App.get_running_app()
def terminate(self, *, storage=None, db=None, aborted=False):
- if storage is None and not aborted:
+ # storage must be None because manual upgrades are disabled on Kivy
+ assert storage is None
+ if not aborted:
+ password = self.pw_args.password
storage, db = self.create_storage(self.path)
- self.app.on_wizard_complete(storage, db)
+ else:
+ password = None
+ self.app.on_wizard_complete(storage, db, password)
def choice_dialog(self, **kwargs):
choices = kwargs['choices']