electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 3ea2872b31a742f7f5a9bae585ee365435566bc1
parent 7297e949708e24a1cfbf33959ca336477ad5181a
Author: SomberNight <somber.night@protonmail.com>
Date:   Tue, 31 Mar 2020 15:18:24 +0200

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

related: #6063

Diffstat:
Melectrum/plugin.py | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/electrum/plugin.py b/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]