Squadron Livery Selector : Allow to show all liveries even if squadron is using livery set in the selector when in the Flight Payload Tab.

This commit is contained in:
tmz 2024-08-01 17:03:19 +02:00 committed by Raffson
parent ecb81ec32d
commit b1efaf6448
2 changed files with 11 additions and 3 deletions

View File

@ -11,7 +11,9 @@ class SquadronLiverySelector(QComboBox):
The combo box will automatically be populated with all available liveries.
"""
def __init__(self, squadron: Squadron) -> None:
def __init__(
self, squadron: Squadron, full_list_view_override: bool = False
) -> None:
super().__init__()
self.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToContents)
@ -33,7 +35,11 @@ class SquadronLiverySelector(QComboBox):
for x in faction.liveries_overrides.get(self.aircraft_type, [])
if x in [y.id.lower() for y in liveries]
]
if selected_livery is None and squadron.livery_set:
if (
selected_livery is None
and squadron.livery_set
and not full_list_view_override
):
self.addItem("Using livery-set from squadron's yaml", userData=None)
self.setEnabled(False)
return

View File

@ -151,7 +151,9 @@ class QFlightPayloadTab(QFrame):
)
self.same_livery_for_all_checkbox.toggled.connect(self.on_same_livery_toggled)
hbox.addWidget(self.same_livery_for_all_checkbox)
self.livery_selector = SquadronLiverySelector(self.flight.squadron)
self.livery_selector = SquadronLiverySelector(
self.flight.squadron, full_list_view_override=True
)
self.livery_selector.insertItem(0, "Default", None)
self.livery_selector.setCurrentIndex(
self.livery_selector.findData(self.member_selector.selected_member.livery)