wizard: fix hww scan debug_msg not working correctly
This commit is contained in:
committed by
Sander van Grieken
parent
a1dea837a7
commit
d2c7df3180
@@ -1134,12 +1134,7 @@ class WCChooseHWDevice(WizardComponent, Logger):
|
|||||||
self.rescan_button.setFocus()
|
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):
|
def scan_devices(self):
|
||||||
self.valid = False
|
self.valid = False
|
||||||
@@ -1153,6 +1148,13 @@ class WCChooseHWDevice(WizardComponent, Logger):
|
|||||||
devmgr = self.plugins.device_manager
|
devmgr = self.plugins.device_manager
|
||||||
debug_msg = ''
|
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
|
# scan devices
|
||||||
try:
|
try:
|
||||||
# scanned_devices = self.run_task_without_blocking_gui(task=devmgr.scan_devices,
|
# 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(
|
device_infos = devmgr.list_pairable_device_infos(
|
||||||
handler=None, plugin=plugin, devices=scanned_devices, include_failing_clients=True)
|
handler=None, plugin=plugin, devices=scanned_devices, include_failing_clients=True)
|
||||||
except HardwarePluginLibraryUnavailable as e:
|
except HardwarePluginLibraryUnavailable as e:
|
||||||
self.failed_getting_device_infos(debug_msg, name, e)
|
failed_getting_device_infos(name, e)
|
||||||
continue
|
continue
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
self.logger.exception('')
|
self.logger.exception('')
|
||||||
self.failed_getting_device_infos(debug_msg, name, e)
|
failed_getting_device_infos(name, e)
|
||||||
continue
|
continue
|
||||||
device_infos_failing = list(filter(lambda di: di.exception is not None, device_infos))
|
device_infos_failing = list(filter(lambda di: di.exception is not None, device_infos))
|
||||||
for di in device_infos_failing:
|
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))
|
device_infos_working = list(filter(lambda di: di.exception is None, device_infos))
|
||||||
devices += list(map(lambda x: (name, x), device_infos_working))
|
devices += list(map(lambda x: (name, x), device_infos_working))
|
||||||
if not debug_msg:
|
if not debug_msg:
|
||||||
|
|||||||
Reference in New Issue
Block a user