Add on-leave toggle for pilots.

Pilots on leave will not be assignable to any flights (but will not be
unassigned from any already scheduled this turn).

https://github.com/dcs-liberation/dcs_liberation/issues/276
This commit is contained in:
Dan Albert
2021-05-27 17:09:09 -07:00
parent 9a9c351f47
commit 1521f0a9b1
5 changed files with 100 additions and 14 deletions

View File

@@ -458,6 +458,15 @@ class SquadronModel(QAbstractListModel):
pilot.player = not pilot.player
self.endResetModel()
def toggle_leave_state(self, index: QModelIndex) -> None:
pilot = self.pilot_at_index(index)
self.beginResetModel()
if pilot.on_leave:
pilot.return_from_leave()
else:
pilot.send_on_leave()
self.endResetModel()
class GameModel:
"""A model for the Game object.