Set up icons for TGOs.

These are just the old icons, but it's better than nothing.
This commit is contained in:
Dan Albert
2021-05-18 21:43:49 -07:00
parent 4e37666037
commit af3b8a9902
2 changed files with 153 additions and 65 deletions

View File

@@ -154,6 +154,8 @@ class GroundObjectJs(QObject):
positionChanged = Signal()
samThreatRangesChanged = Signal()
samDetectionRangesChanged = Signal()
categoryChanged = Signal()
deadChanged = Signal()
def __init__(self, tgo: TheaterGroundObject, game: Game) -> None:
super().__init__()
@@ -189,6 +191,10 @@ class GroundObjectJs(QObject):
def name(self) -> str:
return self.tgo.name
@Property(str, notify=categoryChanged)
def category(self) -> str:
return self.tgo.category
def make_unit_name(self, unit: Unit, dead: bool) -> str:
dead_label = " [DEAD]" if dead else ""
unit_display_name = unit.type
@@ -225,6 +231,12 @@ class GroundObjectJs(QObject):
ll = self.theater.point_to_ll(self.tgo.position)
return [ll.latitude, ll.longitude]
@Property(bool, notify=deadChanged)
def dead(self) -> bool:
if not self.tgo.groups:
return all(b.is_dead for b in self.buildings)
return not any(g.units for g in self.tgo.groups)
@Property(list, notify=samThreatRangesChanged)
def samThreatRanges(self) -> List[float]:
if not self.tgo.might_have_aa: