ui: improve determination of whether pairing possible
This commit is contained in:
parent
6b9c8cffef
commit
ef0db31687
|
@ -623,7 +623,7 @@ def _update_receiver_panel(receiver, panel, buttons, full=False):
|
||||||
devices_count = len(receiver)
|
devices_count = len(receiver)
|
||||||
|
|
||||||
paired_text = _(
|
paired_text = _(
|
||||||
'No device paired.'
|
_('No device paired.')
|
||||||
) if devices_count == 0 else ngettext('%(count)s paired device.', '%(count)s paired devices.', devices_count) % {
|
) if devices_count == 0 else ngettext('%(count)s paired device.', '%(count)s paired devices.', devices_count) % {
|
||||||
'count': devices_count
|
'count': devices_count
|
||||||
}
|
}
|
||||||
|
@ -663,12 +663,8 @@ def _update_receiver_panel(receiver, panel, buttons, full=False):
|
||||||
# b._insecure.set_visible(False)
|
# b._insecure.set_visible(False)
|
||||||
buttons._unpair.set_visible(False)
|
buttons._unpair.set_visible(False)
|
||||||
|
|
||||||
if (receiver.may_unpair or receiver.re_pairs) and not is_pairing and \
|
if not is_pairing and (receiver.remaining_pairings() is None or receiver.remaining_pairings() != 0) and \
|
||||||
(receiver.remaining_pairings() is None or receiver.remaining_pairings() != 0):
|
(receiver.re_pairs or devices_count < receiver.max_devices):
|
||||||
if 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)
|
|
||||||
buttons._pair.set_sensitive(len(paired_devices) < receiver.max_devices)
|
|
||||||
else:
|
|
||||||
buttons._pair.set_sensitive(True)
|
buttons._pair.set_sensitive(True)
|
||||||
else:
|
else:
|
||||||
buttons._pair.set_sensitive(False)
|
buttons._pair.set_sensitive(False)
|
||||||
|
|
Loading…
Reference in New Issue