wip close round/campaign/war + refacto json None

This commit is contained in:
Maxime Réaux 2026-02-11 19:22:43 +01:00
parent 4c8086caf4
commit 6cbb7c6534
26 changed files with 474 additions and 108 deletions

View file

@ -49,20 +49,26 @@ class BattlesDialog(QDialog):
def get_sector_id(self) -> str:
return cast(str, self.ui.sectorComboBox.currentData())
def get_player_1_id(self) -> str:
return cast(str, self.ui.player1ComboBox.currentData())
def get_player_1_id(self) -> str | None:
text = cast(str, self.ui.player1ComboBox.currentData())
return text if text else None
def get_player_2_id(self) -> str:
return cast(str, self.ui.player2ComboBox.currentData())
def get_player_2_id(self) -> str | None:
text = cast(str, self.ui.player2ComboBox.currentData())
return text if text else None
def get_winner_id(self) -> str:
return cast(str, self.ui.winnerComboBox.currentData())
def get_winner_id(self) -> str | None:
text = cast(str, self.ui.winnerComboBox.currentData())
return text if text else None
def get_score(self) -> str:
return self.ui.score.text().strip()
def get_score(self) -> str | None:
text = self.ui.score.text().strip()
return text if text else None
def get_victory_condition(self) -> str:
return self.ui.victoryCondition.text().strip()
def get_victory_condition(self) -> str | None:
text = self.ui.victoryCondition.text().strip()
return text if text else None
def get_comment(self) -> str:
return self.ui.battleComment.toPlainText().strip()
def get_comment(self) -> str | None:
text = self.ui.battleComment.toPlainText().strip()
return text if text else None

View file

@ -38,11 +38,14 @@ class ChoicesDialog(QDialog):
def get_participant_id(self) -> str:
return cast(str, self.ui.playerComboBox.currentData())
def get_priority_id(self) -> str:
return cast(str, self.ui.priorityComboBox.currentData())
def get_priority_id(self) -> str | None:
text = cast(str, self.ui.priorityComboBox.currentData())
return text if text else None
def get_secondary_id(self) -> str:
return cast(str, self.ui.secondaryComboBox.currentData())
def get_secondary_id(self) -> str | None:
text = cast(str, self.ui.secondaryComboBox.currentData())
return text if text else None
def get_comment(self) -> str:
return self.ui.choiceComment.toPlainText().strip()
def get_comment(self) -> str | None:
text = self.ui.choiceComment.toPlainText().strip()
return text if text else None

View file

@ -20,5 +20,6 @@ class ObjectiveDialog(QDialog):
def get_objective_name(self) -> str:
return self.ui.objectiveName.text().strip()
def get_objective_description(self) -> str:
return self.ui.objectiveDescription.toPlainText().strip()
def get_objective_description(self) -> str | None:
text = self.ui.objectiveDescription.toPlainText().strip()
return text if text else None

View file

@ -42,14 +42,21 @@ class SectorDialog(QDialog):
def get_sector_name(self) -> str:
return self.ui.sectorName.text().strip()
def get_round_id(self) -> str:
return cast(str, self.ui.roundComboBox.currentData())
def get_round_id(self) -> str | None:
text = cast(str, self.ui.roundComboBox.currentData())
return text if text else None
def get_major_id(self) -> str:
return cast(str, self.ui.majorComboBox.currentData())
def get_major_id(self) -> str | None:
text = cast(str, self.ui.majorComboBox.currentData())
return text if text else None
def get_minor_id(self) -> str:
return cast(str, self.ui.minorComboBox.currentData())
def get_minor_id(self) -> str | None:
text = cast(str, self.ui.minorComboBox.currentData())
return text if text else None
def get_influence_id(self) -> str:
return cast(str, self.ui.influenceComboBox.currentData())
def get_influence_id(self) -> str | None:
text = cast(str, self.ui.influenceComboBox.currentData())
return text if text else None
# TODO fix mission + description missing

View file

@ -369,7 +369,7 @@ class Ui_MainWindow(object):
spacerItem15 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.horizontalLayout_13.addItem(spacerItem15)
self.resolvePairingBtn = QtWidgets.QPushButton(parent=self.pageRound)
self.resolvePairingBtn.setEnabled(True)
self.resolvePairingBtn.setEnabled(False)
self.resolvePairingBtn.setObjectName("resolvePairingBtn")
self.horizontalLayout_13.addWidget(self.resolvePairingBtn)
self.verticalLayout_8.addLayout(self.horizontalLayout_13)
@ -486,7 +486,7 @@ class Ui_MainWindow(object):
self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(1)
self.selectedDetailsStack.setCurrentIndex(1)
self.selectedDetailsStack.setCurrentIndex(3)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):

View file

@ -181,7 +181,7 @@
</widget>
<widget class="QStackedWidget" name="selectedDetailsStack">
<property name="currentIndex">
<number>1</number>
<number>3</number>
</property>
<widget class="QWidget" name="pageEmpty">
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -873,7 +873,7 @@
<item>
<widget class="QPushButton" name="resolvePairingBtn">
<property name="enabled">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="text">
<string>Resolve pairing</string>