be more lax as to when to allow pairing new devices

This commit is contained in:
Daniel Pavel 2013-07-06 13:55:22 +02:00
parent ba55e4d9bd
commit e2f94a9e0e
1 changed files with 6 additions and 1 deletions

View File

@ -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)