Fix UI quirks when reopening custom loadout.

* Disable the selector.
* Select the default loadout rather than the first one so unchecking the
  custom box goes back to the default loadout.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1152
This commit is contained in:
Dan Albert 2021-06-05 13:40:11 -07:00
parent 6094179a40
commit 34f3a50234

View File

@ -13,7 +13,11 @@ class DcsLoadoutSelector(QComboBox):
for loadout in Loadout.iter_for(flight): for loadout in Loadout.iter_for(flight):
self.addItem(loadout.name, loadout) self.addItem(loadout.name, loadout)
self.model().sort(0) self.model().sort(0)
self.setCurrentText(flight.loadout.name) self.setDisabled(flight.loadout.is_custom)
if flight.loadout.is_custom:
self.setCurrentText(Loadout.default_for(flight).name)
else:
self.setCurrentText(flight.loadout.name)
class QFlightPayloadTab(QFrame): class QFlightPayloadTab(QFrame):