mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix weird wrong default campaign field bug.
I tried fixing this using setField after registering it, but it does nothing. I suspect this is because the page hasn't been registered with the wizard yet so it's setting the field for the wrong wizard.
This commit is contained in:
parent
8fea8e7b47
commit
380d6bf47a
@ -28,6 +28,7 @@ Saves from 4.x are not compatible with 5.0.
|
||||
* **[Campaign]** Naval control points will no longer claim ground objectives during campaign generation and prevent them from spawning.
|
||||
* **[Mission Generation]** Mission results and other files will now be opened with enforced utf-8 encoding to prevent an issue where destroyed ground units were untracked because of special characters in their names.
|
||||
* **[UI]** Selling of Units is now visible again in the UI dialog and shows the correct amount of sold units
|
||||
* **[UI]** Fixed bug where an incompatible campaign could be generated if no action is taken on the campaign selection screen.
|
||||
|
||||
# 4.1.1
|
||||
|
||||
|
||||
@ -65,6 +65,8 @@ class NewGameWizard(QtWidgets.QWizard):
|
||||
logging.info("======================")
|
||||
|
||||
campaign = self.field("selectedCampaign")
|
||||
if campaign is None:
|
||||
campaign = self.theater_page.campaignList.selected_campaign
|
||||
if campaign is None:
|
||||
campaign = self.campaigns[0]
|
||||
|
||||
@ -299,13 +301,13 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
|
||||
text="Show incompatible campaigns"
|
||||
)
|
||||
show_incompatible_campaigns_checkbox.setChecked(False)
|
||||
campaignList = QCampaignList(
|
||||
self.campaignList = QCampaignList(
|
||||
campaigns, show_incompatible_campaigns_checkbox.isChecked()
|
||||
)
|
||||
show_incompatible_campaigns_checkbox.toggled.connect(
|
||||
lambda checked: campaignList.setup_content(show_incompatible=checked)
|
||||
lambda checked: self.campaignList.setup_content(show_incompatible=checked)
|
||||
)
|
||||
self.registerField("selectedCampaign", campaignList)
|
||||
self.registerField("selectedCampaign", self.campaignList)
|
||||
|
||||
# Faction description
|
||||
self.campaignMapDescription = QTextEdit("")
|
||||
@ -365,7 +367,7 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
|
||||
template_perf = jinja_env.get_template(
|
||||
"campaign_performance_template_EN.j2"
|
||||
)
|
||||
campaign = campaignList.selected_campaign
|
||||
campaign = self.campaignList.selected_campaign
|
||||
self.setField("selectedCampaign", campaign)
|
||||
if campaign is None:
|
||||
self.campaignMapDescription.setText("No campaign selected")
|
||||
@ -378,11 +380,13 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
|
||||
template_perf.render({"performance": campaign.performance})
|
||||
)
|
||||
|
||||
campaignList.selectionModel().setCurrentIndex(
|
||||
campaignList.indexAt(QPoint(1, 1)), QItemSelectionModel.Rows
|
||||
self.campaignList.selectionModel().setCurrentIndex(
|
||||
self.campaignList.indexAt(QPoint(1, 1)), QItemSelectionModel.Rows
|
||||
)
|
||||
|
||||
campaignList.selectionModel().selectionChanged.connect(on_campaign_selected)
|
||||
self.campaignList.selectionModel().selectionChanged.connect(
|
||||
on_campaign_selected
|
||||
)
|
||||
on_campaign_selected()
|
||||
|
||||
docsText = QtWidgets.QLabel(
|
||||
@ -409,7 +413,7 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
|
||||
|
||||
layout = QtWidgets.QGridLayout()
|
||||
layout.setColumnMinimumWidth(0, 20)
|
||||
layout.addWidget(campaignList, 0, 0, 5, 1)
|
||||
layout.addWidget(self.campaignList, 0, 0, 5, 1)
|
||||
layout.addWidget(show_incompatible_campaigns_checkbox, 5, 0, 1, 1)
|
||||
layout.addWidget(docsText, 6, 0, 1, 1)
|
||||
layout.addWidget(self.campaignMapDescription, 0, 1, 1, 1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user