mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add UI for TOT offset adjustment.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2912.
This commit is contained in:
parent
7a57bd3ee0
commit
0acf970443
@ -131,6 +131,15 @@ BAI/ANTISHIP/DEAD/STRIKE/BARCAP/CAS/OCA/AIR-ASSAULT (main) missions
|
|||||||
* **[Mission Generation]** Kneeboard STRIKE coordinates would sometimes get clipped when not fitting.
|
* **[Mission Generation]** Kneeboard STRIKE coordinates would sometimes get clipped when not fitting.
|
||||||
* **[UI]** Fix exception when trying to add a waypoints to a flightplan.
|
* **[UI]** Fix exception when trying to add a waypoints to a flightplan.
|
||||||
|
|
||||||
|
|
||||||
|
# 7.1.0
|
||||||
|
|
||||||
|
## Features/Improvements
|
||||||
|
|
||||||
|
* **[Mission Planning]** Per-flight TOT offsets can now be set in the flight details UI. This allows individual flights to be scheduled ahead of or behind the rest of the package.
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
|
||||||
# Liberation:
|
# Liberation:
|
||||||
# 7.0.0
|
# 7.0.0
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,16 @@
|
|||||||
import logging
|
import logging
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
from PySide2.QtWidgets import QGroupBox, QLabel, QMessageBox, QVBoxLayout
|
from PySide2.QtCore import QTime
|
||||||
|
from PySide2.QtWidgets import (
|
||||||
|
QGroupBox,
|
||||||
|
QLabel,
|
||||||
|
QMessageBox,
|
||||||
|
QVBoxLayout,
|
||||||
|
QTimeEdit,
|
||||||
|
QHBoxLayout,
|
||||||
|
QCheckBox,
|
||||||
|
)
|
||||||
|
|
||||||
from game import Game
|
from game import Game
|
||||||
from game.ato.flight import Flight
|
from game.ato.flight import Flight
|
||||||
@ -10,9 +20,9 @@ from qt_ui.widgets.QLabeledWidget import QLabeledWidget
|
|||||||
from qt_ui.widgets.combos.QArrivalAirfieldSelector import QArrivalAirfieldSelector
|
from qt_ui.widgets.combos.QArrivalAirfieldSelector import QArrivalAirfieldSelector
|
||||||
|
|
||||||
|
|
||||||
class FlightAirfieldDisplay(QGroupBox):
|
class FlightPlanPropertiesGroup(QGroupBox):
|
||||||
def __init__(self, game: Game, package_model: PackageModel, flight: Flight) -> None:
|
def __init__(self, game: Game, package_model: PackageModel, flight: Flight) -> None:
|
||||||
super().__init__("Departure/Arrival")
|
super().__init__("Flight plan properties")
|
||||||
self.game = game
|
self.game = game
|
||||||
self.package_model = package_model
|
self.package_model = package_model
|
||||||
self.flight = flight
|
self.flight = flight
|
||||||
@ -28,6 +38,31 @@ class FlightAirfieldDisplay(QGroupBox):
|
|||||||
self.package_model.tot_changed.connect(self.update_departure_time)
|
self.package_model.tot_changed.connect(self.update_departure_time)
|
||||||
self.update_departure_time()
|
self.update_departure_time()
|
||||||
|
|
||||||
|
tot_offset_layout = QHBoxLayout()
|
||||||
|
layout.addLayout(tot_offset_layout)
|
||||||
|
|
||||||
|
delay = int(self.flight.flight_plan.tot_offset.total_seconds())
|
||||||
|
negative = delay < 0
|
||||||
|
if negative:
|
||||||
|
delay = -delay
|
||||||
|
hours = delay // 3600
|
||||||
|
minutes = delay // 60 % 60
|
||||||
|
seconds = delay % 60
|
||||||
|
|
||||||
|
tot_offset_layout.addWidget(QLabel("TOT Offset (minutes:seconds)"))
|
||||||
|
tot_offset_layout.addStretch()
|
||||||
|
negative_offset_checkbox = QCheckBox("Ahead of package")
|
||||||
|
negative_offset_checkbox.setChecked(negative)
|
||||||
|
negative_offset_checkbox.toggled.connect(self.toggle_negative_offset)
|
||||||
|
tot_offset_layout.addWidget(negative_offset_checkbox)
|
||||||
|
|
||||||
|
self.tot_offset_spinner = QTimeEdit(QTime(hours, minutes, seconds))
|
||||||
|
self.tot_offset_spinner.setMaximumTime(QTime(59, 0))
|
||||||
|
self.tot_offset_spinner.setDisplayFormat("mm:ss")
|
||||||
|
self.tot_offset_spinner.timeChanged.connect(self.set_tot_offset)
|
||||||
|
self.tot_offset_spinner.setToolTip("Flight TOT offset from package TOT")
|
||||||
|
tot_offset_layout.addWidget(self.tot_offset_spinner)
|
||||||
|
|
||||||
layout.addWidget(
|
layout.addWidget(
|
||||||
QLabel(
|
QLabel(
|
||||||
"Determined based on the package TOT. Edit the "
|
"Determined based on the package TOT. Edit the "
|
||||||
@ -74,3 +109,13 @@ class FlightAirfieldDisplay(QGroupBox):
|
|||||||
QMessageBox.critical(
|
QMessageBox.critical(
|
||||||
self, "Could not update flight plan", str(ex), QMessageBox.Ok
|
self, "Could not update flight plan", str(ex), QMessageBox.Ok
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def set_tot_offset(self, offset: QTime) -> None:
|
||||||
|
self.flight.flight_plan.tot_offset = timedelta(
|
||||||
|
hours=offset.hour(), minutes=offset.minute(), seconds=offset.second()
|
||||||
|
)
|
||||||
|
self.update_departure_time()
|
||||||
|
|
||||||
|
def toggle_negative_offset(self) -> None:
|
||||||
|
self.flight.flight_plan.tot_offset = -self.flight.flight_plan.tot_offset
|
||||||
|
self.update_departure_time()
|
||||||
@ -1,11 +1,10 @@
|
|||||||
from PySide2.QtCore import Signal
|
from PySide2.QtCore import Signal
|
||||||
from PySide2.QtWidgets import QFrame, QGridLayout, QVBoxLayout
|
from PySide2.QtWidgets import QFrame, QGridLayout, QVBoxLayout
|
||||||
|
|
||||||
from game import Game
|
|
||||||
from game.ato.flight import Flight
|
from game.ato.flight import Flight
|
||||||
from qt_ui.models import PackageModel, GameModel
|
from qt_ui.models import PackageModel, GameModel
|
||||||
from qt_ui.windows.mission.flight.settings.FlightAirfieldDisplay import (
|
from qt_ui.windows.mission.flight.settings.FlightPlanPropertiesGroup import (
|
||||||
FlightAirfieldDisplay,
|
FlightPlanPropertiesGroup,
|
||||||
)
|
)
|
||||||
from qt_ui.windows.mission.flight.settings.QCommsEditor import QCommsEditor
|
from qt_ui.windows.mission.flight.settings.QCommsEditor import QCommsEditor
|
||||||
from qt_ui.windows.mission.flight.settings.QCustomName import QFlightCustomName
|
from qt_ui.windows.mission.flight.settings.QCustomName import QFlightCustomName
|
||||||
@ -25,7 +24,7 @@ class QGeneralFlightSettingsTab(QFrame):
|
|||||||
widgets = [
|
widgets = [
|
||||||
QFlightTypeTaskInfo(flight),
|
QFlightTypeTaskInfo(flight),
|
||||||
QCommsEditor(flight, game),
|
QCommsEditor(flight, game),
|
||||||
FlightAirfieldDisplay(game.game, package_model, flight),
|
FlightPlanPropertiesGroup(game.game, package_model, flight),
|
||||||
QFlightSlotEditor(package_model, flight, game.game),
|
QFlightSlotEditor(package_model, flight, game.game),
|
||||||
QFlightStartType(package_model, flight),
|
QFlightStartType(package_model, flight),
|
||||||
QFlightCustomName(flight),
|
QFlightCustomName(flight),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user