From 9842972d8b9231880f230aedef2dc91a54ed37ac Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Sat, 27 Feb 2021 09:38:20 -0500 Subject: [PATCH] receiver: handle exception when device is not available while being added --- lib/solaar/listener.py | 2 ++ lib/solaar/ui/__init__.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lib/solaar/listener.py b/lib/solaar/listener.py index bad5f605..fddccc3f 100644 --- a/lib/solaar/listener.py +++ b/lib/solaar/listener.py @@ -392,3 +392,5 @@ def _process_receiver_event(action, device_info): _error_callback('permissions', device_info.path) except Exception: _error_callback('permissions', device_info.path) + except _base.NoReceiver: + _error_callback('nodevice', device_info.path) diff --git a/lib/solaar/ui/__init__.py b/lib/solaar/ui/__init__.py index 6b69ccdf..545bd82e 100644 --- a/lib/solaar/ui/__init__.py +++ b/lib/solaar/ui/__init__.py @@ -54,6 +54,12 @@ def _error_dialog(reason, object): _('Found a Logitech Receiver (%s), but did not have permission to open it.') % object + '\n\n' + _("If you've just installed Solaar, try removing the receiver and plugging it back in.") ) + elif reason == 'nodevice': + title = _('Cannot connect to device error') + text = ( + _('Found a Logitech receiver or device at %s, but encountered an error connecting to it.') % object + '\n\n' + + _('Try removing the device and plugging it back in or turning it off and then on.') + ) elif reason == 'unpair': title = _('Unpairing failed') text = (