Fix deletion of waypoints.

`FlightPlan.waypoints` returns a list created from the iterator now, so
removing items from that list does not actually alter the flight plan.

Fixes https://github.com/Khopa/dcs_liberation/issues/489
This commit is contained in:
Dan Albert 2020-12-06 15:32:28 -08:00
parent b5ff32c5b6
commit b0b9c1c8e6
4 changed files with 2 additions and 8 deletions

View File

@ -69,8 +69,6 @@ class FlightPlan:
"""A list of all waypoints in the flight plan, in order."""
return list(self.iter_waypoints())
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
"""Iterates over all waypoints in the flight plan, in order."""
raise NotImplementedError

View File

@ -1,4 +1,3 @@
import itertools
from datetime import timedelta
from PySide2.QtCore import QItemSelectionModel, QPoint
@ -32,10 +31,6 @@ class QFlightWaypointList(QTableView):
self.update_list()
self.selectionModel().setCurrentIndex(self.indexAt(QPoint(1, 1)), QItemSelectionModel.Select)
self.selectionModel().selectionChanged.connect(self.on_waypoint_selected_changed)
def on_waypoint_selected_changed(self):
index = self.selectionModel().currentIndex().row()
def update_list(self):
self.model.clear()

View File

@ -104,7 +104,8 @@ class QFlightWaypointTab(QFrame):
return
self.degrade_to_custom_flight_plan()
self.flight.flight_plan.waypoints.remove(waypoint)
assert isinstance(self.flight.flight_plan, CustomFlightPlan)
self.flight.flight_plan.custom_waypoints.remove(waypoint)
def on_fast_waypoint(self):
self.subwindow = QPredefinedWaypointSelectionWindow(self.game, self.flight, self.flight_waypoint_list)