Make squadron nicknames optional.

(cherry picked from commit 25c289deaa)
This commit is contained in:
Dan Albert
2021-06-12 21:43:26 -07:00
parent 1ac95438ce
commit 70b4f75f25
2 changed files with 6 additions and 4 deletions

View File

@@ -42,14 +42,14 @@ class SquadronDelegate(TwoColumnRowDelegate):
def text_for(self, index: QModelIndex, row: int, column: int) -> str:
if (row, column) == (0, 0):
return self.air_wing_model.data(index, Qt.DisplayRole)
return self.squadron(index).name
elif (row, column) == (0, 1):
squadron = self.air_wing_model.data(index, AirWingModel.SquadronRole)
return db.unit_get_expanded_info(
squadron.country, squadron.aircraft, "name"
)
elif (row, column) == (1, 0):
return self.squadron(index).nickname
return self.squadron(index).nickname or ""
elif (row, column) == (1, 1):
squadron = self.squadron(index)
alive = squadron.number_of_living_pilots