more explicit error dialogs, when possible
This commit is contained in:
parent
77d2ae5249
commit
faa6de3b75
|
@ -24,7 +24,10 @@ def _error_dialog(reason, object):
|
||||||
'and plugging it back in.' % object)
|
'and plugging it back in.' % object)
|
||||||
elif reason == 'unpair':
|
elif reason == 'unpair':
|
||||||
title = 'Unpairing failed'
|
title = 'Unpairing failed'
|
||||||
text = ('Failed to unpair\n%s\nfrom %s.' % (object.name, object.receiver.name))
|
text = ('Failed to unpair\n%s\nfrom %s.'
|
||||||
|
'\n'
|
||||||
|
'The receiver returned an error, with no further details.'
|
||||||
|
% (object.name, object.receiver.name))
|
||||||
else:
|
else:
|
||||||
raise Exception("ui.error_dialog: don't know how to handle (%s, %s)", reason, object)
|
raise Exception("ui.error_dialog: don't know how to handle (%s, %s)", reason, object)
|
||||||
|
|
||||||
|
|
|
@ -115,11 +115,17 @@ def _pairing_failed(assistant, receiver, error):
|
||||||
|
|
||||||
header = 'Pairing failed: %s.' % error
|
header = 'Pairing failed: %s.' % error
|
||||||
if 'timeout' in str(error):
|
if 'timeout' in str(error):
|
||||||
text = 'Make sure your device is within range,\nand it has a decent battery charge.'
|
text = ('Make sure your device is within range,\n'
|
||||||
|
'and it has a decent battery charge.')
|
||||||
elif str(error) == 'device not supported':
|
elif str(error) == 'device not supported':
|
||||||
text = 'A new device was detected, but\nit is not compatible with this receiver.'
|
text = ('A new device was detected, but\n'
|
||||||
|
'it is not compatible with this receiver.')
|
||||||
|
elif 'many' in str(error):
|
||||||
|
text = ('The receiver only supports\n'
|
||||||
|
'%d paired device(s).')
|
||||||
else:
|
else:
|
||||||
text = None
|
text = ('No further details are available\n'
|
||||||
|
'about the error.')
|
||||||
_create_page(assistant, Gtk.AssistantPageType.SUMMARY, header, 'dialog-error', text)
|
_create_page(assistant, Gtk.AssistantPageType.SUMMARY, header, 'dialog-error', text)
|
||||||
|
|
||||||
assistant.next_page()
|
assistant.next_page()
|
||||||
|
|
Loading…
Reference in New Issue