Fix UI bug in CreateFlight window

Pilot's player checkbox would be enabled for non-flyable aircraft if the initially selected aircraft that was flyable.
This commit is contained in:
Raffson 2023-01-13 20:06:35 +01:00
parent 9dd6022907
commit e8151678dd
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -119,8 +119,13 @@ class PilotControls(QHBoxLayout):
pilot = self.selector.itemData(index)
self.player_checkbox.blockSignals(True)
try:
if self.roster and self.roster.squadron.aircraft.flyable:
self.player_checkbox.setChecked(pilot is not None and pilot.player)
else:
self.player_checkbox.setChecked(False)
finally:
if self.roster is not None:
self.player_checkbox.setEnabled(self.roster.squadron.aircraft.flyable)
self.player_checkbox.blockSignals(False)
def update_available_pilots(self) -> None: