mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
qt wizard: still show selector window if storage.__init__ raises WFE
(WalletFileException; e.g. if storage version is from the future)
This commit is contained in:
parent
c7346c1eb8
commit
f44f7d60ab
1 changed files with 8 additions and 6 deletions
|
@ -180,7 +180,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
hbox.addWidget(button)
|
hbox.addWidget(button)
|
||||||
vbox.addLayout(hbox)
|
vbox.addLayout(hbox)
|
||||||
|
|
||||||
self.msg_label = QLabel('')
|
self.msg_label = WWLabel('')
|
||||||
vbox.addWidget(self.msg_label)
|
vbox.addWidget(self.msg_label)
|
||||||
hbox2 = QHBoxLayout()
|
hbox2 = QHBoxLayout()
|
||||||
self.pw_e = QLineEdit('', self)
|
self.pw_e = QLineEdit('', self)
|
||||||
|
@ -195,7 +195,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
temp_storage = WalletStorage(path, manual_upgrades=True)
|
temp_storage = WalletStorage(path, manual_upgrades=True)
|
||||||
except StorageReadWriteError:
|
except (StorageReadWriteError, WalletFileException):
|
||||||
temp_storage = None # type: Optional[WalletStorage]
|
temp_storage = None # type: Optional[WalletStorage]
|
||||||
wallet_folder = os.path.dirname(path)
|
wallet_folder = os.path.dirname(path)
|
||||||
|
|
||||||
|
@ -208,6 +208,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
# FIXME? "filename" might contain ".." (etc) and hence sketchy path traversals are possible
|
# FIXME? "filename" might contain ".." (etc) and hence sketchy path traversals are possible
|
||||||
nonlocal temp_storage
|
nonlocal temp_storage
|
||||||
temp_storage = None
|
temp_storage = None
|
||||||
|
msg = None
|
||||||
path = os.path.join(wallet_folder, filename)
|
path = os.path.join(wallet_folder, filename)
|
||||||
wallet_from_memory = get_wallet_from_daemon(path)
|
wallet_from_memory = get_wallet_from_daemon(path)
|
||||||
try:
|
try:
|
||||||
|
@ -215,10 +216,11 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
temp_storage = wallet_from_memory.storage # type: Optional[WalletStorage]
|
temp_storage = wallet_from_memory.storage # type: Optional[WalletStorage]
|
||||||
else:
|
else:
|
||||||
temp_storage = WalletStorage(path, manual_upgrades=True)
|
temp_storage = WalletStorage(path, manual_upgrades=True)
|
||||||
except StorageReadWriteError:
|
except (StorageReadWriteError, WalletFileException) as e:
|
||||||
pass
|
msg = _('Cannot read file') + f'\n{repr(e)}'
|
||||||
except Exception:
|
except Exception as e:
|
||||||
self.logger.exception('')
|
self.logger.exception('')
|
||||||
|
msg = _('Cannot read file') + f'\n{repr(e)}'
|
||||||
self.next_button.setEnabled(temp_storage is not None)
|
self.next_button.setEnabled(temp_storage is not None)
|
||||||
user_needs_to_enter_password = False
|
user_needs_to_enter_password = False
|
||||||
if temp_storage:
|
if temp_storage:
|
||||||
|
@ -238,7 +240,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
else:
|
else:
|
||||||
msg = _("This file is already open in memory.") + "\n" \
|
msg = _("This file is already open in memory.") + "\n" \
|
||||||
+ _("Press 'Next' to create/focus window.")
|
+ _("Press 'Next' to create/focus window.")
|
||||||
else:
|
if msg is None:
|
||||||
msg = _('Cannot read file')
|
msg = _('Cannot read file')
|
||||||
self.msg_label.setText(msg)
|
self.msg_label.setText(msg)
|
||||||
if user_needs_to_enter_password:
|
if user_needs_to_enter_password:
|
||||||
|
|
Loading…
Add table
Reference in a new issue