Browse Source

kivy: save password after wallet creation

Previously, operations that require password
would fail until the wallet is reopened
patch-4
ThomasV 4 years ago
parent
commit
3f9d7d8b33
  1. 8
      electrum/gui/kivy/main_window.py
  2. 9
      electrum/gui/kivy/uix/dialogs/installwizard.py

8
electrum/gui/kivy/main_window.py

@ -631,8 +631,9 @@ class ElectrumWindow(App, Logger):
else: else:
return '' return ''
def on_wizard_complete(self, storage, db): def on_wizard_complete(self, storage, db, password):
if storage: if storage:
self.password = password
wallet = Wallet(db, storage, config=self.electrum_config) wallet = Wallet(db, storage, config=self.electrum_config)
wallet.start_network(self.daemon.network) wallet.start_network(self.daemon.network)
self.daemon.add_wallet(wallet) 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 = Question(_('Do you want to launch the wizard again?'), handle_answer)
d.open() d.open()
def on_open_wallet(self, pw, storage): def on_open_wallet(self, password, storage):
if not storage.file_exists(): if not storage.file_exists():
wizard = Factory.InstallWizard(self.electrum_config, self.plugins) wizard = Factory.InstallWizard(self.electrum_config, self.plugins)
wizard.path = storage.path wizard.path = storage.path
wizard.run('new') wizard.run('new')
else: else:
assert storage.is_past_initial_decryption() assert storage.is_past_initial_decryption()
self.password = pw
db = WalletDB(storage.read(), manual_upgrades=False) db = WalletDB(storage.read(), manual_upgrades=False)
assert not db.requires_upgrade() assert not db.requires_upgrade()
self.on_wizard_complete(storage, db) self.on_wizard_complete(storage, db, password)
def on_stop(self): def on_stop(self):
self.logger.info('on_stop') self.logger.info('on_stop')

9
electrum/gui/kivy/uix/dialogs/installwizard.py

@ -1060,9 +1060,14 @@ class InstallWizard(BaseWizard, Widget):
self.app = App.get_running_app() self.app = App.get_running_app()
def terminate(self, *, storage=None, db=None, aborted=False): 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) 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): def choice_dialog(self, **kwargs):
choices = kwargs['choices'] choices = kwargs['choices']

Loading…
Cancel
Save