more explicit error dialogs, when possible

This commit is contained in:
Daniel Pavel 2013-07-06 14:20:50 +02:00
parent 77d2ae5249
commit faa6de3b75
2 changed files with 13 additions and 4 deletions

View File

@ -24,7 +24,10 @@ def _error_dialog(reason, object):
'and plugging it back in.' % object)
elif reason == 'unpair':
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:
raise Exception("ui.error_dialog: don't know how to handle (%s, %s)", reason, object)

View File

@ -115,11 +115,17 @@ def _pairing_failed(assistant, receiver, error):
header = 'Pairing failed: %s.' % 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':
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:
text = None
text = ('No further details are available\n'
'about the error.')
_create_page(assistant, Gtk.AssistantPageType.SUMMARY, header, 'dialog-error', text)
assistant.next_page()