mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 01:11:35 +00:00
trezor: check if device is connected before asking passphrase
This commit is contained in:
parent
ad4449dc38
commit
ca6194e563
1 changed files with 18 additions and 3 deletions
|
@ -79,16 +79,31 @@ class Plugin(BasePlugin):
|
|||
def enable(self):
|
||||
return BasePlugin.enable(self)
|
||||
|
||||
def trezor_is_connected(self):
|
||||
try:
|
||||
self.wallet.get_client().ping('t')
|
||||
except:
|
||||
return False
|
||||
return True
|
||||
|
||||
@hook
|
||||
def init_qt(self, gui):
|
||||
self.window = gui.main_window
|
||||
|
||||
@hook
|
||||
def close_wallet(self):
|
||||
print_error("trezor: clear session")
|
||||
self.wallet.client.clear_session()
|
||||
if self.wallet.client:
|
||||
self.wallet.client.clear_session()
|
||||
|
||||
@hook
|
||||
def load_wallet(self, wallet):
|
||||
self.wallet = wallet
|
||||
if not self.wallet.check_proper_device():
|
||||
QMessageBox.information(None, _('Error'), _("This wallet does not match your Trezor device"), _('OK'))
|
||||
if self.trezor_is_connected():
|
||||
if not self.wallet.check_proper_device():
|
||||
QMessageBox.information(self.window, _('Error'), _("This wallet does not match your Trezor device"), _('OK'))
|
||||
else:
|
||||
QMessageBox.information(self.window, _('Error'), _("Trezor device not detected.\nContinuing in watching-only mode."), _('OK'))
|
||||
|
||||
@hook
|
||||
def installwizard_restore(self, wizard, storage):
|
||||
|
|
Loading…
Add table
Reference in a new issue