1
0

add file selector and password dialog to wizard (fix #1730)

This commit is contained in:
ThomasV
2017-03-05 13:30:57 +01:00
parent 83e925c0cd
commit 45f25586ef
4 changed files with 113 additions and 41 deletions

View File

@@ -159,30 +159,19 @@ class ElectrumGui:
w.bring_to_top()
break
else:
if not os.path.exists(path):
wizard = InstallWizard(self.config, self.app, self.plugins, path)
wallet = wizard.run_and_get_wallet()
if not wallet:
return
wallet = self.daemon.get_wallet(path)
if not wallet:
storage = WalletStorage(path)
if not storage.file_exists or storage.is_encrypted():
wizard = InstallWizard(self.config, self.app, self.plugins, storage)
wallet = wizard.run_and_get_wallet()
if not wallet:
return
else:
storage.read(None)
wallet = Wallet(storage)
wallet.start_threads(self.daemon.network)
self.daemon.add_wallet(wallet)
else:
from password_dialog import PasswordDialog
msg = _("The file '%s' is encrypted.") % os.path.basename(path)
password_getter = lambda: PasswordDialog(msg=msg).run()
while True:
try:
wallet = self.daemon.load_wallet(path, password_getter)
break
except UserCancelled:
return
except InvalidPassword as e:
QMessageBox.information(None, _('Error'), str(e), _('OK'))
continue
except BaseException as e:
traceback.print_exc(file=sys.stdout)
QMessageBox.information(None, _('Error'), str(e), _('OK'))
return
w = self.create_window_for_wallet(wallet)
if uri:
w.pay_to_URI(uri)