From e2f94a9e0e7d2e6efd41d5bd6a6a82ac9a5c5bc5 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Sat, 6 Jul 2013 13:55:22 +0200 Subject: [PATCH] be more lax as to when to allow pairing new devices --- lib/solaar/ui/window.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/solaar/ui/window.py b/lib/solaar/ui/window.py index 11f30fe1..2a1741ac 100644 --- a/lib/solaar/ui/window.py +++ b/lib/solaar/ui/window.py @@ -579,7 +579,12 @@ def _update_receiver_panel(receiver, panel, buttons, full=False): # b._insecure.set_visible(False) buttons._unpair.set_visible(False) - buttons._pair.set_sensitive(devices_count < receiver.max_devices and not is_pairing) + + may_pair = receiver.may_unpair and not is_pairing + if may_pair and devices_count >= receiver.max_devices: + online_devices = (n for n in range(1, receiver.max_devices) if n in receiver and receiver[n].online) + may_pair &= len(online_devices) < receiver.max_devices + buttons._pair.set_sensitive(may_pair) buttons._pair.set_visible(True)