mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
Small fix for trezor devices
Client operations are asynchronous; do any unpairing after the operation.
This commit is contained in:
parent
f6200bd73e
commit
eb865779eb
1 changed files with 6 additions and 4 deletions
|
@ -320,12 +320,16 @@ class SettingsDialog(WindowModalDialog):
|
||||||
self.current_label=None
|
self.current_label=None
|
||||||
|
|
||||||
def invoke_client(method, *args, **kw_args):
|
def invoke_client(method, *args, **kw_args):
|
||||||
|
unpair_after = kw_args.pop('unpair_after', False)
|
||||||
|
|
||||||
def task():
|
def task():
|
||||||
client = devmgr.client_by_id(device_id, handler)
|
client = devmgr.client_by_id(device_id, handler)
|
||||||
if not client:
|
if not client:
|
||||||
raise RuntimeError("Device not connected")
|
raise RuntimeError("Device not connected")
|
||||||
if method:
|
if method:
|
||||||
getattr(client, method)(*args, **kw_args)
|
getattr(client, method)(*args, **kw_args)
|
||||||
|
if unpair_after:
|
||||||
|
devmgr.unpair_id(device_id)
|
||||||
return client.features
|
return client.features
|
||||||
|
|
||||||
thread.add(task, on_success=update)
|
thread.add(task, on_success=update)
|
||||||
|
@ -378,8 +382,7 @@ class SettingsDialog(WindowModalDialog):
|
||||||
"Are you sure you want to proceed?") % plugin.device
|
"Are you sure you want to proceed?") % plugin.device
|
||||||
if not self.question(msg, title=title):
|
if not self.question(msg, title=title):
|
||||||
return
|
return
|
||||||
invoke_client('toggle_passphrase')
|
invoke_client('toggle_passphrase', unpair_after=True)
|
||||||
devmgr.unpair_id(device_id)
|
|
||||||
|
|
||||||
def change_homescreen():
|
def change_homescreen():
|
||||||
from PIL import Image # FIXME
|
from PIL import Image # FIXME
|
||||||
|
@ -416,8 +419,7 @@ class SettingsDialog(WindowModalDialog):
|
||||||
if not self.question(msg, title=title,
|
if not self.question(msg, title=title,
|
||||||
icon=QMessageBox.Critical):
|
icon=QMessageBox.Critical):
|
||||||
return
|
return
|
||||||
invoke_client('wipe_device')
|
invoke_client('wipe_device', unpair_after=True)
|
||||||
devmgr.unpair_id(device_id)
|
|
||||||
|
|
||||||
def slider_moved():
|
def slider_moved():
|
||||||
mins = timeout_slider.sliderPosition()
|
mins = timeout_slider.sliderPosition()
|
||||||
|
|
Loading…
Add table
Reference in a new issue