mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add DCS loadout selector.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/273.
This commit is contained in:
parent
0e3bc1ce43
commit
d41e69d770
@ -29,6 +29,7 @@ Saves from 2.5 are not compatible with 3.0.
|
||||
|
||||
* **[UI]** Engagement ranges are now displayed by default.
|
||||
* **[UI]** Engagement range display generalized to work for all patrolling flight plans (BARCAP, TARCAP, and CAS).
|
||||
* **[UI]** DCS loadouts are now selectable in the loadout setup menu.
|
||||
* **[Flight Planner]** Front lines no longer project threat zones to avoid pushing BARCAPs back so much. TARCAPs will be forcibly planned but strike packages will not route around front lines even if it is reasonable to do so.
|
||||
|
||||
## Fixes
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtWidgets import QFrame, QLabel, QVBoxLayout
|
||||
from PySide2.QtWidgets import QFrame, QLabel, QComboBox, QVBoxLayout
|
||||
|
||||
from game import Game
|
||||
from gen.flights.flight import Flight
|
||||
@ -7,11 +7,21 @@ from gen.flights.loadouts import Loadout
|
||||
from qt_ui.windows.mission.flight.payload.QLoadoutEditor import QLoadoutEditor
|
||||
|
||||
|
||||
class DcsLoadoutSelector(QComboBox):
|
||||
def __init__(self, flight: Flight) -> None:
|
||||
super().__init__()
|
||||
for loadout in Loadout.iter_for(flight):
|
||||
self.addItem(loadout.name, loadout)
|
||||
self.model().sort(0)
|
||||
self.setCurrentText(flight.loadout.name)
|
||||
|
||||
|
||||
class QFlightPayloadTab(QFrame):
|
||||
def __init__(self, flight: Flight, game: Game):
|
||||
super(QFlightPayloadTab, self).__init__()
|
||||
self.flight = flight
|
||||
self.payload_editor = QLoadoutEditor(flight, game)
|
||||
self.payload_editor.toggled.connect(self.on_custom_toggled)
|
||||
|
||||
layout = QVBoxLayout()
|
||||
|
||||
@ -22,13 +32,20 @@ class QFlightPayloadTab(QFrame):
|
||||
docsText.setAlignment(Qt.AlignCenter)
|
||||
docsText.setOpenExternalLinks(True)
|
||||
|
||||
self.payload_editor.toggled.connect(self.on_custom_toggled)
|
||||
self.loadout_selector = DcsLoadoutSelector(flight)
|
||||
self.loadout_selector.currentIndexChanged.connect(self.on_new_loadout)
|
||||
layout.addWidget(self.loadout_selector)
|
||||
layout.addWidget(self.payload_editor)
|
||||
layout.addWidget(docsText)
|
||||
|
||||
self.setLayout(layout)
|
||||
|
||||
def on_new_loadout(self, index: int) -> None:
|
||||
self.flight.loadout = self.loadout_selector.itemData(index)
|
||||
self.payload_editor.reset_pylons()
|
||||
|
||||
def on_custom_toggled(self, use_custom: bool) -> None:
|
||||
self.loadout_selector.setDisabled(use_custom)
|
||||
if use_custom:
|
||||
self.flight.loadout = self.flight.loadout.derive_custom("Custom")
|
||||
else:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user