Browse Source

wizard: add naive debug message to hw device scan if none are found

3.2.x
SomberNight 7 years ago
parent
commit
13bd10e1cb
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 9
      lib/base_wizard.py
  2. 2
      lib/plugins.py

9
lib/base_wizard.py

@ -206,21 +206,28 @@ class BaseWizard(object):
scanned_devices = devmgr.scan_devices() scanned_devices = devmgr.scan_devices()
except BaseException as e: except BaseException as e:
devmgr.print_error('error scanning devices: {}'.format(e)) devmgr.print_error('error scanning devices: {}'.format(e))
debug_msg = ' {}:\n {}'.format(_('Error scanning devices'), e)
else: else:
debug_msg = ''
for name, description, plugin in support: for name, description, plugin in support:
try: try:
# FIXME: side-effect: unpaired_device_info sets client.handler # FIXME: side-effect: unpaired_device_info sets client.handler
u = devmgr.unpaired_device_infos(None, plugin, devices=scanned_devices) u = devmgr.unpaired_device_infos(None, plugin, devices=scanned_devices)
except BaseException as e: except BaseException as e:
devmgr.print_error('error getting device infos for {}: {}'.format(name, e)) devmgr.print_error('error getting device infos for {}: {}'.format(name, e))
debug_msg += ' {}:\n {}\n'.format(plugin.name, e)
continue continue
devices += list(map(lambda x: (name, x), u)) devices += list(map(lambda x: (name, x), u))
if not debug_msg:
debug_msg = ' {}'.format(_('No exceptions encountered.'))
if not devices: if not devices:
msg = ''.join([ msg = ''.join([
_('No hardware device detected.') + '\n', _('No hardware device detected.') + '\n',
_('To trigger a rescan, press \'Next\'.') + '\n\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.') + ' ', _('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)) self.confirm_dialog(title=title, message=msg, run_next= lambda x: self.choose_hw_device(purpose))
return return

2
lib/plugins.py

@ -461,6 +461,8 @@ class DeviceMgr(ThreadJob, PrintError):
def unpaired_device_infos(self, handler, plugin, devices=None): def unpaired_device_infos(self, handler, plugin, devices=None):
'''Returns a list of DeviceInfo objects: one for each connected, '''Returns a list of DeviceInfo objects: one for each connected,
unpaired device accepted by the plugin.''' unpaired device accepted by the plugin.'''
if not plugin.libraries_available:
raise Exception('Missing libraries for {}'.format(plugin.name))
if devices is None: if devices is None:
devices = self.scan_devices() devices = self.scan_devices()
devices = [dev for dev in devices if not self.xpub_by_id(dev.id_)] devices = [dev for dev in devices if not self.xpub_by_id(dev.id_)]

Loading…
Cancel
Save