Fix altering negative TOT offsets.

https://github.com/dcs-liberation/dcs_liberation/issues/3107
This commit is contained in:
Dan Albert 2023-07-23 10:56:57 -07:00
parent e1dba91b25
commit d74ba4a6c9
2 changed files with 9 additions and 5 deletions

View File

@ -25,6 +25,7 @@ Saves from 8.x are not compatible with 9.0.0.
* **[UI]** Fixed deleting waypoints in custom flight plans deleting the wrong waypoint.
* **[UI]** Fixed flight properties UI to support F-15E S4+ laser codes.
* **[UI]** In unit transfer dialog, only list control points that are reachable from the control point units are being transferred from.
* **[UI]** Fixed UI bug where altering an "ahead of package" TOT offset would change the offset back to a "behind pacakge" offset.
# 8.1.0

View File

@ -51,10 +51,10 @@ class FlightPlanPropertiesGroup(QGroupBox):
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.negative_offset_checkbox = QCheckBox("Ahead of package")
self.negative_offset_checkbox.setChecked(negative)
self.negative_offset_checkbox.toggled.connect(self.toggle_negative_offset)
tot_offset_layout.addWidget(self.negative_offset_checkbox)
self.tot_offset_spinner = QTimeEdit(QTime(hours, minutes, seconds))
self.tot_offset_spinner.setMaximumTime(QTime(59, 0))
@ -113,9 +113,12 @@ class FlightPlanPropertiesGroup(QGroupBox):
)
def set_tot_offset(self, offset: QTime) -> None:
self.flight.flight_plan.tot_offset = timedelta(
offset = timedelta(
hours=offset.hour(), minutes=offset.minute(), seconds=offset.second()
)
if self.negative_offset_checkbox.isChecked():
offset = -offset
self.flight.flight_plan.tot_offset = offset
self.update_departure_time()
def toggle_negative_offset(self) -> None: