Browse Source

hw wallets: show e.g. "An unnamed trezor" if no label in select_device

related: #6063
hard-fail-on-bad-server-string
SomberNight 5 years ago
parent
commit
3ea2872b31
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 8
      electrum/plugin.py

8
electrum/plugin.py

@ -305,6 +305,7 @@ class DeviceInfo(NamedTuple):
label: Optional[str] = None
initialized: Optional[bool] = None
exception: Optional[Exception] = None
plugin_name: Optional[str] = None # manufacturer, e.g. "trezor"
class HardwarePluginToScan(NamedTuple):
@ -532,13 +533,14 @@ class DeviceMgr(ThreadJob):
except Exception as e:
self.logger.error(f'failed to create client for {plugin.name} at {device.path}: {repr(e)}')
if include_failing_clients:
infos.append(DeviceInfo(device=device, exception=e))
infos.append(DeviceInfo(device=device, exception=e, plugin_name=plugin.name))
continue
if not client:
continue
infos.append(DeviceInfo(device=device,
label=client.label(),
initialized=client.is_initialized()))
initialized=client.is_initialized(),
plugin_name=plugin.name))
return infos
@ -574,7 +576,7 @@ class DeviceMgr(ThreadJob):
# ask user to select device
msg = _("Please select which {} device to use:").format(plugin.device)
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")),
transport=info.device.transport_ui_string)
for info in infos]

Loading…
Cancel
Save