ui: Better determination in GUI of when receiver may pair (still might be conservative)

This commit is contained in:
Peter F. Patel-Schneider 2020-01-22 17:33:08 -05:00 committed by Filipe Laíns
parent 546ccb7ac2
commit 22d37c4c1c
1 changed files with 3 additions and 2 deletions

View File

@ -595,8 +595,9 @@ def _update_receiver_panel(receiver, panel, buttons, full=False):
# b._insecure.set_visible(False)
buttons._unpair.set_visible(False)
may_pair = receiver.may_unpair and not is_pairing
if may_pair and devices_count >= receiver.max_devices:
may_pair = ( receiver.may_unpair or receiver.re_pairs ) and not is_pairing and \
( receiver.remaining_pairings() is None or receiver.remaining_pairings() != 0 )
if may_pair and not receiver.re_pairs and devices_count >= receiver.max_devices:
paired_devices = tuple(n for n in range(1, receiver.max_devices+1) if n in receiver)
may_pair &= len(paired_devices) < receiver.max_devices
buttons._pair.set_sensitive(may_pair)