Show takeoff time in waypoint list.

https://github.com/Khopa/dcs_liberation/issues/536
This commit is contained in:
Dan Albert 2020-12-12 13:21:43 -08:00
parent 31fdd24c3e
commit 07e5c568c4
2 changed files with 12 additions and 3 deletions

View File

@ -87,6 +87,7 @@ class TravelTime:
return timedelta(hours=distance / speed * error_factor) return timedelta(hours=distance / speed * error_factor)
# TODO: Most if not all of this should move into FlightPlan.
class TotEstimator: class TotEstimator:
# An extra five minutes given as wiggle room. Expected to be spent at the # An extra five minutes given as wiggle room. Expected to be spent at the
# hold point performing any last minute configuration. # hold point performing any last minute configuration.

View File

@ -6,7 +6,8 @@ from PySide2.QtWidgets import QHeaderView, QTableView
from game.utils import meter_to_feet from game.utils import meter_to_feet
from gen.ato import Package from gen.ato import Package
from gen.flights.flight import Flight, FlightWaypoint from gen.flights.flight import Flight, FlightWaypoint, FlightWaypointType
from gen.flights.traveltime import TotEstimator
from qt_ui.windows.mission.flight.waypoints.QFlightWaypointItem import \ from qt_ui.windows.mission.flight.waypoints.QFlightWaypointItem import \
QWaypointItem QWaypointItem
@ -60,8 +61,9 @@ class QFlightWaypointList(QTableView):
tot_item.setEditable(False) tot_item.setEditable(False)
self.model.setItem(row, 2, tot_item) self.model.setItem(row, 2, tot_item)
@staticmethod def tot_text(self, flight: Flight, waypoint: FlightWaypoint) -> str:
def tot_text(flight: Flight, waypoint: FlightWaypoint) -> str: if waypoint.waypoint_type == FlightWaypointType.TAKEOFF:
return self.takeoff_text(flight)
prefix = "" prefix = ""
time = flight.flight_plan.tot_for_waypoint(waypoint) time = flight.flight_plan.tot_for_waypoint(waypoint)
if time is None: if time is None:
@ -71,3 +73,9 @@ class QFlightWaypointList(QTableView):
return "" return ""
time = timedelta(seconds=int(time.total_seconds())) time = timedelta(seconds=int(time.total_seconds()))
return f"{prefix}T+{time}" return f"{prefix}T+{time}"
def takeoff_text(self, flight: Flight) -> str:
estimator = TotEstimator(self.package)
start_time = timedelta(seconds=int(
estimator.takeoff_time_for_flight(flight).total_seconds()))
return f"T+{start_time}"