Stop loadout resetting each time the editor opens.

This commit is contained in:
Simon Clark 2021-01-08 10:22:56 +00:00
parent 558dc591a3
commit 64b2eeface
2 changed files with 8 additions and 6 deletions

View File

@ -37,9 +37,12 @@ class QLoadoutEditor(QGroupBox):
hboxLayout.addStretch()
self.setLayout(hboxLayout)
if not self.isChecked():
for i in self.findChildren(QPylonEditor):
i.default_loadout(i.pylon.number)
def on_toggle(self):
self.flight.use_custom_loadout = self.isChecked()
# When the toggle button is hit, reset the loadout to default.
# We need to do this regardless of whether we're toggling on or off.
for i in self.findChildren(QPylonEditor):
i.default_loadout(i.pylon.number)
if not self.isChecked():
for i in self.findChildren(QPylonEditor):
i.default_loadout(i.pylon.number)

View File

@ -29,8 +29,7 @@ class QPylonEditor(QComboBox):
self.addItem(weapon.name, weapon)
if current == weapon:
self.setCurrentIndex(i + 1)
self.default_loadout(self.pylon)
self.currentIndexChanged.connect(self.on_pylon_change)
def on_pylon_change(self):