Browse Source

qt: show start-up wizard in case of exception

related: #4355
3.2.x
SomberNight 7 years ago
parent
commit
f0657a3507
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 10
      gui/qt/__init__.py
  2. 4
      gui/qt/installwizard.py

10
gui/qt/__init__.py

@ -185,7 +185,7 @@ class ElectrumGui:
run_hook('on_new_window', w) run_hook('on_new_window', w)
return w return w
def start_new_window(self, path, uri): def start_new_window(self, path, uri, app_is_starting=False):
'''Raises the window for the wallet if it is open. Otherwise '''Raises the window for the wallet if it is open. Otherwise
opens the wallet and creates a new window for it''' opens the wallet and creates a new window for it'''
try: try:
@ -195,7 +195,11 @@ class ElectrumGui:
d = QMessageBox(QMessageBox.Warning, _('Error'), d = QMessageBox(QMessageBox.Warning, _('Error'),
_('Cannot load wallet') + ' (1):\n' + str(e)) _('Cannot load wallet') + ' (1):\n' + str(e))
d.exec_() d.exec_()
return if app_is_starting:
# do not return so that the wizard can appear
wallet = None
else:
return
if not wallet: if not wallet:
storage = WalletStorage(path, manual_upgrades=True) storage = WalletStorage(path, manual_upgrades=True)
wizard = InstallWizard(self.config, self.app, self.plugins, storage) wizard = InstallWizard(self.config, self.app, self.plugins, storage)
@ -270,7 +274,7 @@ class ElectrumGui:
self.timer.start() self.timer.start()
self.config.open_last_wallet() self.config.open_last_wallet()
path = self.config.get_wallet_path() path = self.config.get_wallet_path()
if not self.start_new_window(path, self.config.get('url')): if not self.start_new_window(path, self.config.get('url'), app_is_starting=True):
return return
signal.signal(signal.SIGINT, lambda *args: self.app.quit()) signal.signal(signal.SIGINT, lambda *args: self.app.quit())

4
gui/qt/installwizard.py

@ -227,10 +227,10 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
self.name_e.setText(n) self.name_e.setText(n)
while True: while True:
if self.storage.file_exists() and not self.storage.is_encrypted():
break
if self.loop.exec_() != 2: # 2 = next if self.loop.exec_() != 2: # 2 = next
return return
if self.storage.file_exists() and not self.storage.is_encrypted():
break
if not self.storage.file_exists(): if not self.storage.file_exists():
break break
wallet_from_memory = get_wallet_from_daemon(self.storage.path) wallet_from_memory = get_wallet_from_daemon(self.storage.path)

Loading…
Cancel
Save