commit 13bd10e1cbb12e9efd412ed2bc8e0f36134895b9
parent 6eb38d6b8c7bb3f03fda773d402bd619d8fea3a5
Author: SomberNight <somber.night@protonmail.com>
Date: Tue, 3 Apr 2018 14:21:22 +0200
wizard: add naive debug message to hw device scan if none are found
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git 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
@@ -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_)]