mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix crash when changing squadrons in new flight.
This commit is contained in:
parent
e35e49e05e
commit
d3269bca93
@ -144,7 +144,7 @@ class QFlightCreator(QDialog):
|
||||
def reject(self) -> None:
|
||||
super().reject()
|
||||
# Clear the roster to return pilots to the pool.
|
||||
self.roster_editor.replace(None)
|
||||
self.roster_editor.replace(None, None)
|
||||
|
||||
def set_custom_name_text(self, text: str):
|
||||
self.custom_name_text = text
|
||||
@ -230,9 +230,9 @@ class QFlightCreator(QDialog):
|
||||
def on_squadron_changed(self, index: int) -> None:
|
||||
squadron: Optional[Squadron] = self.squadron_selector.itemData(index)
|
||||
self.update_max_size(self.squadron_selector.aircraft_available)
|
||||
# Clear the roster first so we return the pilots to the pool. This way if we end
|
||||
# up repopulating from the same squadron we'll get the same pilots back.
|
||||
self.roster_editor.replace(None)
|
||||
# Clear the roster first so that we return the pilots to the pool. This way if
|
||||
# we end up repopulating from the same squadron we'll get the same pilots back.
|
||||
self.roster_editor.replace(None, None)
|
||||
if squadron is not None:
|
||||
self.roster_editor.replace(
|
||||
squadron, FlightRoster(squadron, self.flight_size_spinner.value())
|
||||
|
||||
@ -84,7 +84,9 @@ class PilotSelector(QComboBox):
|
||||
self.roster.set_pilot(self.pilot_index, pilot)
|
||||
self.available_pilots_changed.emit()
|
||||
|
||||
def replace(self, squadron: Squadron, new_roster: Optional[FlightRoster]) -> None:
|
||||
def replace(
|
||||
self, squadron: Squadron | None, new_roster: Optional[FlightRoster]
|
||||
) -> None:
|
||||
self.squadron = squadron
|
||||
self.roster = new_roster
|
||||
self.rebuild()
|
||||
@ -199,7 +201,9 @@ class FlightRosterEditor(QVBoxLayout):
|
||||
for controls in self.pilot_controls[new_size:]:
|
||||
controls.disable_and_clear()
|
||||
|
||||
def replace(self, squadron: Squadron, new_roster: Optional[FlightRoster]) -> None:
|
||||
def replace(
|
||||
self, squadron: Squadron | None, new_roster: Optional[FlightRoster]
|
||||
) -> None:
|
||||
if self.roster is not None:
|
||||
self.roster.clear()
|
||||
self.roster = new_roster
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user