Invert factions when "Invert Map" is set in NGW

This commit is contained in:
Raffson 2023-07-02 13:56:11 +02:00
parent ae17f195fe
commit e2d9a794b8
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
2 changed files with 13 additions and 3 deletions

View File

@ -46,6 +46,7 @@
* **[Plugins]** Updated CTLD to latest released version
* **[Options]** Renamed Maximum frontline length -> Maximum frontline width.
* **[Squadrons]** Add livery selector in Squadron Dialog, allowing you to change the livery during the campaign.
* **[New Game Wizard]** Automatically invert factions when 'Invert Map' is selected.
## Fixes

View File

@ -118,10 +118,11 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
# Campaign settings
mapSettingsGroup = QtWidgets.QGroupBox("Map Settings")
mapSettingsLayout = QtWidgets.QGridLayout()
invertMap = QtWidgets.QCheckBox()
self.registerField("invertMap", invertMap)
self.invertMap = QtWidgets.QCheckBox()
self.invertMap.stateChanged.connect(self.on_invert_map)
self.registerField("invertMap", self.invertMap)
mapSettingsLayout.addWidget(QtWidgets.QLabel("Invert Map"), 0, 0)
mapSettingsLayout.addWidget(invertMap, 0, 1)
mapSettingsLayout.addWidget(self.invertMap, 0, 1)
self.advanced_iads = QtWidgets.QCheckBox()
self.registerField("advanced_iads", self.advanced_iads)
self.iads_label = QtWidgets.QLabel("Advanced IADS (WIP)")
@ -178,6 +179,8 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
self.campaignMapDescription.setText(template.render({"campaign": campaign}))
self.faction_selection.setDefaultFactions(campaign)
if self.invertMap.isChecked():
self.on_invert_map()
self.performanceText.setText(
template_perf.render({"performance": campaign.performance})
)
@ -243,6 +246,12 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
layout.addWidget(timeGroup, 3, 1, 3, 1)
self.setLayout(layout)
def on_invert_map(self) -> None:
blue = self.faction_selection.blueFactionSelect.currentIndex()
red = self.faction_selection.redFactionSelect.currentIndex()
self.faction_selection.blueFactionSelect.setCurrentIndex(red)
self.faction_selection.redFactionSelect.setCurrentIndex(blue)
class QCampaignItem(QStandardItem):
def __init__(self, campaign: Campaign) -> None: