From 13bd10e1cbb12e9efd412ed2bc8e0f36134895b9 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 3 Apr 2018 14:21:22 +0200 Subject: [PATCH] wizard: add naive debug message to hw device scan if none are found --- lib/base_wizard.py | 9 ++++++++- lib/plugins.py | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/base_wizard.py b/lib/base_wizard.py index a7fc27f65..ba29f1ff0 100644 --- a/lib/base_wizard.py +++ b/lib/base_wizard.py @@ -206,21 +206,28 @@ class BaseWizard(object): scanned_devices = devmgr.scan_devices() except BaseException as e: devmgr.print_error('error scanning devices: {}'.format(e)) + debug_msg = ' {}:\n {}'.format(_('Error scanning devices'), e) else: + debug_msg = '' 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)) + debug_msg += ' {}:\n {}\n'.format(plugin.name, e) continue devices += list(map(lambda x: (name, x), u)) + if not debug_msg: + debug_msg = ' {}'.format(_('No exceptions encountered.')) if not devices: msg = ''.join([ _('No hardware device detected.') + '\n', _('To trigger a rescan, press \'Next\'.') + '\n\n', _('If your device is not detected on Windows, go to "Settings", "Devices", "Connected devices", and do "Remove device". Then, plug your device again.') + ' ', - _('On Linux, you might have to add a new permission to your udev rules.'), + _('On Linux, you might have to add a new permission to your udev rules.') + '\n\n', + _('Debug message') + '\n', + debug_msg ]) self.confirm_dialog(title=title, message=msg, run_next= lambda x: self.choose_hw_device(purpose)) return diff --git a/lib/plugins.py b/lib/plugins.py index 17f68dac2..b9c539948 100644 --- a/lib/plugins.py +++ b/lib/plugins.py @@ -461,6 +461,8 @@ class DeviceMgr(ThreadJob, PrintError): def unpaired_device_infos(self, handler, plugin, devices=None): '''Returns a list of DeviceInfo objects: one for each connected, unpaired device accepted by the plugin.''' + if not plugin.libraries_available: + raise Exception('Missing libraries for {}'.format(plugin.name)) if devices is None: devices = self.scan_devices() devices = [dev for dev in devices if not self.xpub_by_id(dev.id_)]