Add livery-selector in AirWingConfigurationDialog

Resolves #1861
This commit is contained in:
Raffson
2022-08-14 14:20:59 +02:00
parent e9917ba00e
commit a8d6f90f55
4 changed files with 56 additions and 2 deletions

View File

@@ -74,6 +74,10 @@ class Coalition:
def country_name(self) -> str:
return self.faction.country
@property
def country_shortname(self) -> str:
return self.faction.country_shortname
@property
def opponent(self) -> Coalition:
assert self._opponent is not None

View File

@@ -46,6 +46,9 @@ class Faction:
# Country used by this faction
country: str = field(default="")
# Country's short name used by this faction
country_shortname: str = field(default="")
# Nice name of the faction
name: str = field(default="")
@@ -172,13 +175,22 @@ class Faction:
faction = Faction(locales=json.get("locales"))
faction.country = json.get("country", "/")
if faction.country not in [c.name for c in country_dict.values()]:
country = None
for c in country_dict.values():
if c.name == faction.country:
country = c
break
if country is None:
raise AssertionError(
'Faction\'s country ("{}") is not a valid DCS country ID'.format(
faction.country
)
)
faction.country_shortname = country.shortname
faction.name = json.get("name", "")
if not faction.name:
raise AssertionError("Faction has no valid name")