mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
hw wallets: show e.g. "An unnamed trezor" if no label in select_device
related: #6063
This commit is contained in:
parent
7297e94970
commit
3ea2872b31
1 changed files with 5 additions and 3 deletions
|
@ -305,6 +305,7 @@ class DeviceInfo(NamedTuple):
|
||||||
label: Optional[str] = None
|
label: Optional[str] = None
|
||||||
initialized: Optional[bool] = None
|
initialized: Optional[bool] = None
|
||||||
exception: Optional[Exception] = None
|
exception: Optional[Exception] = None
|
||||||
|
plugin_name: Optional[str] = None # manufacturer, e.g. "trezor"
|
||||||
|
|
||||||
|
|
||||||
class HardwarePluginToScan(NamedTuple):
|
class HardwarePluginToScan(NamedTuple):
|
||||||
|
@ -532,13 +533,14 @@ class DeviceMgr(ThreadJob):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f'failed to create client for {plugin.name} at {device.path}: {repr(e)}')
|
self.logger.error(f'failed to create client for {plugin.name} at {device.path}: {repr(e)}')
|
||||||
if include_failing_clients:
|
if include_failing_clients:
|
||||||
infos.append(DeviceInfo(device=device, exception=e))
|
infos.append(DeviceInfo(device=device, exception=e, plugin_name=plugin.name))
|
||||||
continue
|
continue
|
||||||
if not client:
|
if not client:
|
||||||
continue
|
continue
|
||||||
infos.append(DeviceInfo(device=device,
|
infos.append(DeviceInfo(device=device,
|
||||||
label=client.label(),
|
label=client.label(),
|
||||||
initialized=client.is_initialized()))
|
initialized=client.is_initialized(),
|
||||||
|
plugin_name=plugin.name))
|
||||||
|
|
||||||
return infos
|
return infos
|
||||||
|
|
||||||
|
@ -574,7 +576,7 @@ class DeviceMgr(ThreadJob):
|
||||||
# ask user to select device
|
# ask user to select device
|
||||||
msg = _("Please select which {} device to use:").format(plugin.device)
|
msg = _("Please select which {} device to use:").format(plugin.device)
|
||||||
descriptions = ["{label} ({init}, {transport})"
|
descriptions = ["{label} ({init}, {transport})"
|
||||||
.format(label=info.label,
|
.format(label=info.label or _("An unnamed {}").format(info.plugin_name),
|
||||||
init=(_("initialized") if info.initialized else _("wiped")),
|
init=(_("initialized") if info.initialized else _("wiped")),
|
||||||
transport=info.device.transport_ui_string)
|
transport=info.device.transport_ui_string)
|
||||||
for info in infos]
|
for info in infos]
|
||||||
|
|
Loading…
Add table
Reference in a new issue