Show player/AI status for pilots.

https://github.com/dcs-liberation/dcs_liberation/issues/276
This commit is contained in:
Dan Albert 2021-05-26 19:47:53 -07:00
parent e480519855
commit b38d271f10

View File

@ -25,14 +25,17 @@ class PilotDelegate(TwoColumnRowDelegate):
return index.data(SquadronModel.PilotRole)
def text_for(self, index: QModelIndex, row: int, column: int) -> str:
pilot = self.pilot(index)
if (row, column) == (0, 0):
return self.squadron_model.data(index, Qt.DisplayRole)
elif (row, column) == (0, 1):
flown = self.pilot(index).record.missions_flown
flown = pilot.record.missions_flown
missions = "missions" if flown != 1 else "mission"
return f"{flown} {missions} flown"
elif (row, column) == (1, 0):
return "Alive" if self.pilot(index).alive else "Dead"
return "Player" if pilot.player else "AI"
elif (row, column) == (1, 1):
return "Alive" if pilot.alive else "Dead"
return ""