mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix issues with waypoint editing.
fix a number of regressions in the flight waypoint list by changing the indexing and finding a work-around to blocking of signals This PR addresses some (but not all) recently reported issues with the waypoints screen reported in Issue #3188 . This PR was tested by: - Changing the waypoint altitude and confirming it shows up correctly when reloading the waypoint list window and on the map - Adding a waypoint and confirming that it shows up immediately and persists on reload - Deleting a waypoint (except the first waypoint) and confirming that it is removed immediately and persists on reload, Known issues: first waypoint (typically hold) cannot be deleted -- still looking into this one. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3188.
This commit is contained in:
parent
990f1c37b8
commit
32b3793082
@ -43,6 +43,8 @@ Saves from 8.x are not compatible with 9.0.0.
|
|||||||
* **[UI]** Fixed UI bug where altering an "ahead of package" TOT offset would change the offset back to a "behind pacakge" offset.
|
* **[UI]** Fixed UI bug where altering an "ahead of package" TOT offset would change the offset back to a "behind pacakge" offset.
|
||||||
* **[UI]** Fixed bug where changing TOT offsets could result in flight startup times that are in the past.
|
* **[UI]** Fixed bug where changing TOT offsets could result in flight startup times that are in the past.
|
||||||
* **[UI]** Fixed odd spacing of the finance window when there were not enough items to fill the page.
|
* **[UI]** Fixed odd spacing of the finance window when there were not enough items to fill the page.
|
||||||
|
* **[UI]** Fixed regression where waypoint altitude changes in the waypoint list screen are applied to the wrong waypoint.
|
||||||
|
* **[UI]** Fixed regression where waypoint additions in custom flight plans are not reflected until the window is reloaded.
|
||||||
|
|
||||||
# 8.1.0
|
# 8.1.0
|
||||||
|
|
||||||
|
|||||||
@ -53,9 +53,6 @@ class QFlightWaypointList(QTableView):
|
|||||||
self.setItemDelegateForColumn(1, self.altitude_editor_delegate)
|
self.setItemDelegateForColumn(1, self.altitude_editor_delegate)
|
||||||
|
|
||||||
def update_list(self) -> None:
|
def update_list(self) -> None:
|
||||||
# ignore signals when updating list so on_changed does not fire
|
|
||||||
self.model.blockSignals(True)
|
|
||||||
try:
|
|
||||||
# We need to keep just the row and rebuild the index later because the
|
# We need to keep just the row and rebuild the index later because the
|
||||||
# QModelIndex will not be valid after the model is cleared.
|
# QModelIndex will not be valid after the model is cleared.
|
||||||
current_index = self.currentIndex().row()
|
current_index = self.currentIndex().row()
|
||||||
@ -90,9 +87,6 @@ class QFlightWaypointList(QTableView):
|
|||||||
for i in range(0, self.model.columnCount()):
|
for i in range(0, self.model.columnCount()):
|
||||||
total_column_width += self.columnWidth(i) + self.lineWidth()
|
total_column_width += self.columnWidth(i) + self.lineWidth()
|
||||||
self.setFixedWidth(total_column_width)
|
self.setFixedWidth(total_column_width)
|
||||||
finally:
|
|
||||||
# stop ignoring signals
|
|
||||||
self.model.blockSignals(False)
|
|
||||||
|
|
||||||
def _add_waypoint_row(
|
def _add_waypoint_row(
|
||||||
self, row: int, flight: Flight, waypoint: FlightWaypoint
|
self, row: int, flight: Flight, waypoint: FlightWaypoint
|
||||||
@ -118,9 +112,13 @@ class QFlightWaypointList(QTableView):
|
|||||||
|
|
||||||
def on_changed(self) -> None:
|
def on_changed(self) -> None:
|
||||||
for i in range(self.model.rowCount()):
|
for i in range(self.model.rowCount()):
|
||||||
|
if self.model.item(i, 1) is not None:
|
||||||
altitude = self.model.item(i, 1).text()
|
altitude = self.model.item(i, 1).text()
|
||||||
altitude_feet = float(altitude)
|
altitude_feet = float(altitude)
|
||||||
self.flight.flight_plan.waypoints[i].alt = Distance.from_feet(altitude_feet)
|
# update waypoint index i+1 as rows are 1-indexed
|
||||||
|
self.flight.flight_plan.waypoints[i + 1].alt = Distance.from_feet(
|
||||||
|
altitude_feet
|
||||||
|
)
|
||||||
|
|
||||||
def tot_text(self, flight: Flight, waypoint: FlightWaypoint) -> str:
|
def tot_text(self, flight: Flight, waypoint: FlightWaypoint) -> str:
|
||||||
if waypoint.waypoint_type == FlightWaypointType.TAKEOFF:
|
if waypoint.waypoint_type == FlightWaypointType.TAKEOFF:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user