From d2c7df31801dcf56e69888306192dddb5b47179e Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 15 Sep 2023 11:17:13 +0200 Subject: [PATCH] wizard: fix hww scan debug_msg not working correctly --- electrum/gui/qt/wizard/wallet.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/electrum/gui/qt/wizard/wallet.py b/electrum/gui/qt/wizard/wallet.py index 6169f9d61..016e4f118 100644 --- a/electrum/gui/qt/wizard/wallet.py +++ b/electrum/gui/qt/wizard/wallet.py @@ -1134,12 +1134,7 @@ class WCChooseHWDevice(WizardComponent, Logger): self.rescan_button.setFocus() - def failed_getting_device_infos(self, debug_msg, name, e): - # nonlocal debug_msg - err_str_oneline = ' // '.join(str(e).splitlines()) - self.logger.warning(f'error getting device infos for {name}: {err_str_oneline}') - indented_error_msg = ' '.join([''] + str(e).splitlines(keepends=True)) - debug_msg += f' {name}: (error getting device infos)\n{indented_error_msg}\n' + def scan_devices(self): self.valid = False @@ -1153,6 +1148,13 @@ class WCChooseHWDevice(WizardComponent, Logger): devmgr = self.plugins.device_manager debug_msg = '' + def failed_getting_device_infos(name, e): + nonlocal debug_msg + err_str_oneline = ' // '.join(str(e).splitlines()) + self.logger.warning(f'error getting device infos for {name}: {err_str_oneline}') + indented_error_msg = ' '.join([''] + str(e).splitlines(keepends=True)) + debug_msg += f' {name}: (error getting device infos)\n{indented_error_msg}\n' + # scan devices try: # scanned_devices = self.run_task_without_blocking_gui(task=devmgr.scan_devices, @@ -1178,15 +1180,15 @@ class WCChooseHWDevice(WizardComponent, Logger): device_infos = devmgr.list_pairable_device_infos( handler=None, plugin=plugin, devices=scanned_devices, include_failing_clients=True) except HardwarePluginLibraryUnavailable as e: - self.failed_getting_device_infos(debug_msg, name, e) + failed_getting_device_infos(name, e) continue except BaseException as e: self.logger.exception('') - self.failed_getting_device_infos(debug_msg, name, e) + failed_getting_device_infos(name, e) continue device_infos_failing = list(filter(lambda di: di.exception is not None, device_infos)) for di in device_infos_failing: - self.failed_getting_device_infos(debug_msg, name, di.exception) + failed_getting_device_infos(name, di.exception) device_infos_working = list(filter(lambda di: di.exception is None, device_infos)) devices += list(map(lambda x: (name, x), device_infos_working)) if not debug_msg: