electrum

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

commit aabd9f01ee1b847e761e91a10326f1bd234647ac
parent afa4cbfcbb8e552d1bc59147b5b109a0f6c08599
Author: SomberNight <somber.night@protonmail.com>
Date:   Thu, 15 Mar 2018 20:03:12 +0100

wizard hw devices: only scan once

Diffstat:
Mlib/base_wizard.py | 21+++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/lib/base_wizard.py b/lib/base_wizard.py @@ -202,14 +202,19 @@ class BaseWizard(object): # scan devices devices = [] devmgr = self.plugins.device_manager - for name, description, plugin in support: - try: - # FIXME: side-effect: unpaired_device_info sets client.handler - u = devmgr.unpaired_device_infos(None, plugin) - except: - devmgr.print_error("error", name) - continue - devices += list(map(lambda x: (name, x), u)) + try: + scanned_devices = devmgr.scan_devices() + except BaseException as e: + devmgr.print_error('error scanning devices: {}'.format(e)) + else: + for name, description, plugin in support: + try: + # FIXME: side-effect: unpaired_device_info sets client.handler + u = devmgr.unpaired_device_infos(None, plugin, devices=scanned_devices) + except BaseException as e: + devmgr.print_error('error getting device infos for {}: {}'.format(name, e)) + continue + devices += list(map(lambda x: (name, x), u)) if not devices: msg = ''.join([ _('No hardware device detected.') + '\n',