mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Display a "No aircraft available" message.
If in the create flight dialog, there are no suitable aircraft for a task, or no aircraft left at all, a suitable message is now shown that prevents the user from creating a flight. Also adds in a quick "remember what plane the user had selected last" feature.
This commit is contained in:
parent
c40ad75fa2
commit
1e1cebc3fc
@ -23,6 +23,7 @@ class QAircraftTypeSelector(QComboBox):
|
|||||||
self.updateItems(mission_type, aircraft_types)
|
self.updateItems(mission_type, aircraft_types)
|
||||||
|
|
||||||
def updateItems(self, mission_type: str, aircraft_types):
|
def updateItems(self, mission_type: str, aircraft_types):
|
||||||
|
current_aircraft = self.currentData()
|
||||||
self.clear()
|
self.clear()
|
||||||
for aircraft in aircraft_types:
|
for aircraft in aircraft_types:
|
||||||
if mission_type in [FlightType.BARCAP, FlightType.ESCORT, FlightType.INTERCEPTION, FlightType.SWEEP, FlightType.TARCAP]:
|
if mission_type in [FlightType.BARCAP, FlightType.ESCORT, FlightType.INTERCEPTION, FlightType.SWEEP, FlightType.TARCAP]:
|
||||||
@ -43,3 +44,8 @@ class QAircraftTypeSelector(QComboBox):
|
|||||||
elif mission_type in [FlightType.OCA_RUNWAY]:
|
elif mission_type in [FlightType.OCA_RUNWAY]:
|
||||||
if aircraft in gen.flights.ai_flight_planner_db.RUNWAY_ATTACK_CAPABLE:
|
if aircraft in gen.flights.ai_flight_planner_db.RUNWAY_ATTACK_CAPABLE:
|
||||||
self.addItem(f"{db.unit_pretty_name(self.country, aircraft)}", userData=aircraft)
|
self.addItem(f"{db.unit_pretty_name(self.country, aircraft)}", userData=aircraft)
|
||||||
|
current_aircraft_index = self.findData(current_aircraft)
|
||||||
|
if current_aircraft_index != -1:
|
||||||
|
self.setCurrentIndex(current_aircraft_index)
|
||||||
|
if self.count() == 0:
|
||||||
|
self.addItem("No capable aircraft available", userData=None)
|
||||||
@ -117,6 +117,8 @@ class QFlightCreator(QDialog):
|
|||||||
arrival: ControlPoint = self.arrival.currentData()
|
arrival: ControlPoint = self.arrival.currentData()
|
||||||
divert: ControlPoint = self.divert.currentData()
|
divert: ControlPoint = self.divert.currentData()
|
||||||
size: int = self.flight_size_spinner.value()
|
size: int = self.flight_size_spinner.value()
|
||||||
|
if aircraft == None:
|
||||||
|
return "You must select an aircraft type."
|
||||||
if not origin.captured:
|
if not origin.captured:
|
||||||
return f"{origin.name} is not owned by your coalition."
|
return f"{origin.name} is not owned by your coalition."
|
||||||
if arrival is not None and not arrival.captured:
|
if arrival is not None and not arrival.captured:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user