Improve UI for flight properties.

Use the new data from pydcs to improve the properties UI:

* Use human readable names
* Use appropriate control types
* Limit min and max values as appropriate for each property
* Show labels

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3090.
This commit is contained in:
Dan Albert
2023-07-19 21:42:10 -07:00
committed by Raffson
parent a0fdfa11e2
commit bce6a170b8
8 changed files with 143 additions and 7 deletions

View File

@@ -11,11 +11,11 @@ from typing import Any, ClassVar, Dict, Iterator, Optional, TYPE_CHECKING, Type
import yaml
from dcs.helicopters import helicopter_map
from dcs.planes import plane_map
from dcs.unitpropertydescription import UnitPropertyDescription
from dcs.unittype import FlyingType
from dcs.weapons_data import weapon_ids
from game.data.units import UnitClass
from game.dcs.unitproperty import UnitProperty
from game.dcs.unittype import UnitType
from game.persistency import user_custom_weapon_injections_dir
from game.radio.channels import (
@@ -329,8 +329,8 @@ class AircraftType(UnitType[Type[FlyingType]]):
def channel_name(self, radio_id: int, channel_id: int) -> str:
return self.channel_namer.channel_name(radio_id, channel_id)
def iter_props(self) -> Iterator[UnitProperty[Any]]:
return UnitProperty.for_aircraft(self.dcs_unit_type)
def iter_props(self) -> Iterator[UnitPropertyDescription]:
yield from self.dcs_unit_type.properties.values()
def capable_of(self, task: FlightType) -> bool:
return task in self.task_priorities