mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Replace debug QObject models with Pydantic.
This requires less duplication and paves the way for us replacing QWebChannel with FastAPI, which in turn gets us closer to not needing Qt.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
@@ -396,17 +397,19 @@ class MapModel(QObject):
|
||||
def unculledZones(self) -> list[UnculledZone]:
|
||||
return self._unculled_zones
|
||||
|
||||
@Property(IpZonesJs, notify=ipZonesChanged)
|
||||
def ipZones(self) -> IpZonesJs:
|
||||
return self._ip_zones
|
||||
@Property(str, notify=ipZonesChanged)
|
||||
def ipZones(self) -> str:
|
||||
return json.dumps(self._ip_zones.dict(by_alias=True))
|
||||
|
||||
@Property(JoinZonesJs, notify=joinZonesChanged)
|
||||
def joinZones(self) -> JoinZonesJs:
|
||||
return self._join_zones
|
||||
@Property(str, notify=joinZonesChanged)
|
||||
def joinZones(self) -> str:
|
||||
# Must be dumped as a string and deserialized in js because QWebChannel can't
|
||||
# handle a dict. Can be cleaned up by switching from QWebChannel to FastAPI.
|
||||
return json.dumps(self._join_zones.dict(by_alias=True))
|
||||
|
||||
@Property(HoldZonesJs, notify=holdZonesChanged)
|
||||
def holdZones(self) -> HoldZonesJs:
|
||||
return self._hold_zones
|
||||
@Property(str, notify=holdZonesChanged)
|
||||
def holdZones(self) -> str:
|
||||
return json.dumps(self._hold_zones.dict(by_alias=True))
|
||||
|
||||
def reset_combats(self) -> None:
|
||||
self._air_combats = []
|
||||
|
||||
Reference in New Issue
Block a user