mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Make squadron nicknames optional.
This commit is contained in:
parent
3c802e7d55
commit
25c289deaa
@ -74,7 +74,7 @@ class Pilot:
|
||||
@dataclass
|
||||
class Squadron:
|
||||
name: str
|
||||
nickname: str
|
||||
nickname: Optional[str]
|
||||
country: str
|
||||
role: str
|
||||
aircraft: AircraftType
|
||||
@ -97,6 +97,8 @@ class Squadron:
|
||||
self.auto_assignable_mission_types = set(self.mission_types)
|
||||
|
||||
def __str__(self) -> str:
|
||||
if self.nickname is None:
|
||||
return self.name
|
||||
return f'{self.name} "{self.nickname}"'
|
||||
|
||||
def claim_available_pilot(self) -> Optional[Pilot]:
|
||||
@ -215,7 +217,7 @@ class Squadron:
|
||||
|
||||
return Squadron(
|
||||
name=data["name"],
|
||||
nickname=data["nickname"],
|
||||
nickname=data.get("nickname"),
|
||||
country=data["country"],
|
||||
role=data["role"],
|
||||
aircraft=unit_type,
|
||||
|
||||
@ -40,12 +40,12 @@ 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 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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user