Revert "Use the actual Country type instead of the name."

This reverts commit bd2ec12e0f.

Country is both the data (name, ID, etc) and the container for groups
added to the miz, so it can't be used across multiple mission
generations. See https://github.com/pydcs/dcs/issues/314 for potential
follow up work that would let us do this.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2864.
This commit is contained in:
Dan Albert
2023-05-15 18:06:31 -07:00
parent 03671bbfb0
commit ca96a232f0
24 changed files with 82 additions and 64 deletions

View File

@@ -1,5 +1,6 @@
from __future__ import annotations
import dcs.countries
from PySide6.QtWidgets import QComboBox
from dcs.liveries.livery import Livery
@@ -21,7 +22,9 @@ class LiverySelector(QComboBox):
self.clear()
self.addItem("Default", None)
for idx, livery in enumerate(
squadron.aircraft.dcs_unit_type.iter_liveries_for_country(squadron.country)
squadron.aircraft.dcs_unit_type.iter_liveries_for_country(
dcs.countries.get_by_name(squadron.country)
)
):
self.addItem(livery.name, livery)
if squadron.livery == livery.id:

View File

@@ -40,6 +40,7 @@ class QFlightCreator(QDialog):
self.game = game
self.package = package
self.custom_name_text = None
self.country = self.game.blue.country_name
# Make dialog modal to prevent background windows to close unexpectedly.
self.setModal(True)
@@ -182,6 +183,7 @@ class QFlightCreator(QDialog):
flight = Flight(
self.package,
self.country,
squadron,
# A bit of a hack to work around the old API. Not actually relevant because
# the roster is passed explicitly. Needs a refactor.