Adds prettier user-facing aircraft names. (#726)

This makes the names of the aircraft displayed to the player in the UI more verbose and readable.

It allows allows specific countries to display an aircraft's name differently. An example of this would be the JF-17 Thunder, which is known in China as the FC-1 Fierce Dragon - this now displays correctly in the Liberation UI.
This commit is contained in:
Simon Clark
2021-01-05 21:21:38 +00:00
committed by GitHub
parent c3401d478b
commit c740c8304b
12 changed files with 331 additions and 14 deletions

View File

@@ -5,12 +5,13 @@ from PySide2.QtWidgets import QComboBox
from dcs.unittype import FlyingType
from game import Game, db
class QAircraftTypeSelector(QComboBox):
"""Combo box for selecting among the given aircraft types."""
def __init__(self, aircraft_types: Iterable[Type[FlyingType]]) -> None:
def __init__(self, aircraft_types: Iterable[Type[FlyingType]], country: str) -> None:
super().__init__()
for aircraft in aircraft_types:
self.addItem(f"{aircraft.id}", userData=aircraft)
self.addItem(f"{db.unit_pretty_name(country, aircraft)}", userData=aircraft)
self.model().sort(0)