From faa6de3b75217fdecb3221f08fd55371c44436be Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Sat, 6 Jul 2013 14:20:50 +0200 Subject: [PATCH] more explicit error dialogs, when possible --- lib/solaar/ui/__init__.py | 5 ++++- lib/solaar/ui/pair_window.py | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/solaar/ui/__init__.py b/lib/solaar/ui/__init__.py index 134ce2d5..bb12b8fe 100644 --- a/lib/solaar/ui/__init__.py +++ b/lib/solaar/ui/__init__.py @@ -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) diff --git a/lib/solaar/ui/pair_window.py b/lib/solaar/ui/pair_window.py index 6367c870..aa114132 100644 --- a/lib/solaar/ui/pair_window.py +++ b/lib/solaar/ui/pair_window.py @@ -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()