Clean up remaining Flight.from_cp users.

The preferred API for this has been `Flight.departure` for a while.
This commit is contained in:
Dan Albert
2023-06-29 20:24:24 -07:00
parent de8d42e3e5
commit b549af9cb7
9 changed files with 7 additions and 11 deletions

View File

@@ -138,7 +138,7 @@ class PackageModel(QAbstractListModel):
@staticmethod
def text_for_flight(flight: Flight) -> str:
"""Returns the text that should be displayed for the flight."""
origin = flight.from_cp.name
origin = flight.departure.name
startup = flight.flight_plan.startup_time()
return f"{flight} from {origin} at {startup}"

View File

@@ -46,7 +46,7 @@ class FlightDelegate(TwoColumnRowDelegate):
clients = self.num_clients(index)
return f"Player Slots: {clients}" if clients else ""
elif (row, column) == (1, 0):
origin = flight.from_cp.name
origin = flight.departure.name
if flight.arrival != flight.departure:
return f"From {origin} to {flight.arrival.name}"
return f"From {origin}"

View File

@@ -25,7 +25,7 @@ class QPlannedFlightsView(QListView):
self.flight_items = []
for package in self.game_model.ato_model.packages:
for flight in package.flights:
if flight.from_cp == self.cp:
if flight.departure == self.cp:
item = QFlightItem(package.package, flight)
self.flight_items.append(item)

View File

@@ -32,7 +32,7 @@ class FlightPlanPropertiesGroup(QGroupBox):
self.departure_time = QLabel()
layout.addLayout(
QLabeledWidget(
f"Departing from <b>{flight.from_cp.name}</b>", self.departure_time
f"Departing from <b>{flight.departure.name}</b>", self.departure_time
)
)
self.package_model.tot_changed.connect(self.update_departure_time)