list round choices ; fix UI

This commit is contained in:
Maxime Réaux 2026-01-30 10:52:19 +01:00
parent 032ab2d2c4
commit 723723dea1
14 changed files with 683 additions and 99 deletions

View file

@ -0,0 +1,78 @@
# Form implementation generated from reading ui file '.\src\warchron\view\ui\ui_battle_result_dialog.ui'
#
# Created by: PyQt6 UI code generator 6.7.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_battleResultDialog(object):
def setupUi(self, battleResultDialog):
battleResultDialog.setObjectName("battleResultDialog")
battleResultDialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
battleResultDialog.resize(561, 246)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/warchron_logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
battleResultDialog.setWindowIcon(icon)
self.formLayout = QtWidgets.QFormLayout(battleResultDialog)
self.formLayout.setObjectName("formLayout")
self.label = QtWidgets.QLabel(parent=battleResultDialog)
self.label.setObjectName("label")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label)
self.winnerComboBox = QtWidgets.QComboBox(parent=battleResultDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.winnerComboBox.sizePolicy().hasHeightForWidth())
self.winnerComboBox.setSizePolicy(sizePolicy)
self.winnerComboBox.setObjectName("winnerComboBox")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.winnerComboBox)
self.label_2 = QtWidgets.QLabel(parent=battleResultDialog)
self.label_2.setObjectName("label_2")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_2)
self.score = QtWidgets.QLineEdit(parent=battleResultDialog)
self.score.setObjectName("score")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.score)
self.label_3 = QtWidgets.QLabel(parent=battleResultDialog)
self.label_3.setObjectName("label_3")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_3)
self.victoryCondition = QtWidgets.QLineEdit(parent=battleResultDialog)
self.victoryCondition.setObjectName("victoryCondition")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.ItemRole.FieldRole, self.victoryCondition)
self.label_4 = QtWidgets.QLabel(parent=battleResultDialog)
self.label_4.setObjectName("label_4")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_4)
self.battleComment = QtWidgets.QPlainTextEdit(parent=battleResultDialog)
self.battleComment.setObjectName("battleComment")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.battleComment)
self.buttonBox = QtWidgets.QDialogButtonBox(parent=battleResultDialog)
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok)
self.buttonBox.setObjectName("buttonBox")
self.formLayout.setWidget(4, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.buttonBox)
self.retranslateUi(battleResultDialog)
self.buttonBox.accepted.connect(battleResultDialog.accept) # type: ignore
self.buttonBox.rejected.connect(battleResultDialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(battleResultDialog)
def retranslateUi(self, battleResultDialog):
_translate = QtCore.QCoreApplication.translate
battleResultDialog.setWindowTitle(_translate("battleResultDialog", "Battle result"))
self.label.setText(_translate("battleResultDialog", "Winner"))
self.label_2.setText(_translate("battleResultDialog", "Score"))
self.label_3.setText(_translate("battleResultDialog", "Victory condition"))
self.label_4.setText(_translate("battleResultDialog", "Comment"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
battleResultDialog = QtWidgets.QDialog()
ui = Ui_battleResultDialog()
ui.setupUi(battleResultDialog)
battleResultDialog.show()
sys.exit(app.exec())

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>battleResultDialog</class>
<widget class="QDialog" name="battleResultDialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<height>246</height>
</rect>
</property>
<property name="windowTitle">
<string>Battle result</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>../resources/warchron_logo.png</normaloff>../resources/warchron_logo.png</iconset>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Winner</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="winnerComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Score</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="score"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Victory condition</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="victoryCondition"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPlainTextEdit" name="battleComment"/>
</item>
<item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>battleResultDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>battleResultDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -0,0 +1,88 @@
# Form implementation generated from reading ui file '.\src\warchron\view\ui\ui_choices_dialog.ui'
#
# Created by: PyQt6 UI code generator 6.7.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_choicesDialog(object):
def setupUi(self, choicesDialog):
choicesDialog.setObjectName("choicesDialog")
choicesDialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
choicesDialog.resize(561, 246)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/warchron_logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
choicesDialog.setWindowIcon(icon)
self.gridLayout = QtWidgets.QGridLayout(choicesDialog)
self.gridLayout.setObjectName("gridLayout")
self.label = QtWidgets.QLabel(parent=choicesDialog)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.playerComboBox = QtWidgets.QComboBox(parent=choicesDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.playerComboBox.sizePolicy().hasHeightForWidth())
self.playerComboBox.setSizePolicy(sizePolicy)
self.playerComboBox.setObjectName("playerComboBox")
self.gridLayout.addWidget(self.playerComboBox, 0, 1, 1, 1)
self.label_2 = QtWidgets.QLabel(parent=choicesDialog)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
self.priorityComboBox = QtWidgets.QComboBox(parent=choicesDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.priorityComboBox.sizePolicy().hasHeightForWidth())
self.priorityComboBox.setSizePolicy(sizePolicy)
self.priorityComboBox.setObjectName("priorityComboBox")
self.gridLayout.addWidget(self.priorityComboBox, 1, 1, 1, 1)
self.label_3 = QtWidgets.QLabel(parent=choicesDialog)
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1)
self.secondaryComboBox = QtWidgets.QComboBox(parent=choicesDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.secondaryComboBox.sizePolicy().hasHeightForWidth())
self.secondaryComboBox.setSizePolicy(sizePolicy)
self.secondaryComboBox.setObjectName("secondaryComboBox")
self.gridLayout.addWidget(self.secondaryComboBox, 2, 1, 1, 1)
self.label_4 = QtWidgets.QLabel(parent=choicesDialog)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 3, 0, 1, 1)
self.choiceComment = QtWidgets.QPlainTextEdit(parent=choicesDialog)
self.choiceComment.setObjectName("choiceComment")
self.gridLayout.addWidget(self.choiceComment, 3, 1, 1, 1)
self.buttonBox = QtWidgets.QDialogButtonBox(parent=choicesDialog)
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 2)
self.retranslateUi(choicesDialog)
self.buttonBox.accepted.connect(choicesDialog.accept) # type: ignore
self.buttonBox.rejected.connect(choicesDialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(choicesDialog)
def retranslateUi(self, choicesDialog):
_translate = QtCore.QCoreApplication.translate
choicesDialog.setWindowTitle(_translate("choicesDialog", "Choices"))
self.label.setText(_translate("choicesDialog", "Player"))
self.label_2.setText(_translate("choicesDialog", "Priority"))
self.label_3.setText(_translate("choicesDialog", "Secondary"))
self.label_4.setText(_translate("choicesDialog", "Comment"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
choicesDialog = QtWidgets.QDialog()
ui = Ui_choicesDialog()
ui.setupUi(choicesDialog)
choicesDialog.show()
sys.exit(app.exec())

View file

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>choicesDialog</class>
<widget class="QDialog" name="choicesDialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<height>246</height>
</rect>
</property>
<property name="windowTitle">
<string>Choices</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>../resources/warchron_logo.png</normaloff>../resources/warchron_logo.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Player</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="playerComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Priority</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="priorityComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Secondary</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="secondaryComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPlainTextEdit" name="choiceComment"/>
</item>
<item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>choicesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>choicesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -183,28 +183,6 @@ class Ui_MainWindow(object):
self.gridLayout_4.addItem(spacerItem5, 5, 2, 1, 1)
self.horizontalLayout_12 = QtWidgets.QHBoxLayout()
self.horizontalLayout_12.setObjectName("horizontalLayout_12")
self.sectorsTable = QtWidgets.QTableWidget(parent=self.pageCampaign)
self.sectorsTable.setObjectName("sectorsTable")
self.sectorsTable.setColumnCount(5)
self.sectorsTable.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(4, item)
self.horizontalLayout_12.addWidget(self.sectorsTable)
self.addSectorBtn = QtWidgets.QPushButton(parent=self.pageCampaign)
self.addSectorBtn.setEnabled(True)
self.addSectorBtn.setObjectName("addSectorBtn")
self.horizontalLayout_12.addWidget(self.addSectorBtn)
self.gridLayout_4.addLayout(self.horizontalLayout_12, 4, 0, 1, 3)
self.horizontalLayout_13 = QtWidgets.QHBoxLayout()
self.horizontalLayout_13.setObjectName("horizontalLayout_13")
self.campaignParticipantsTable = QtWidgets.QTableWidget(parent=self.pageCampaign)
self.campaignParticipantsTable.setObjectName("campaignParticipantsTable")
self.campaignParticipantsTable.setColumnCount(5)
@ -219,10 +197,32 @@ class Ui_MainWindow(object):
self.campaignParticipantsTable.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.campaignParticipantsTable.setHorizontalHeaderItem(4, item)
self.horizontalLayout_13.addWidget(self.campaignParticipantsTable)
self.horizontalLayout_12.addWidget(self.campaignParticipantsTable)
self.addCampaignParticipantBtn = QtWidgets.QPushButton(parent=self.pageCampaign)
self.addCampaignParticipantBtn.setObjectName("addCampaignParticipantBtn")
self.horizontalLayout_13.addWidget(self.addCampaignParticipantBtn)
self.horizontalLayout_12.addWidget(self.addCampaignParticipantBtn)
self.gridLayout_4.addLayout(self.horizontalLayout_12, 4, 0, 1, 3)
self.horizontalLayout_13 = QtWidgets.QHBoxLayout()
self.horizontalLayout_13.setObjectName("horizontalLayout_13")
self.sectorsTable = QtWidgets.QTableWidget(parent=self.pageCampaign)
self.sectorsTable.setObjectName("sectorsTable")
self.sectorsTable.setColumnCount(5)
self.sectorsTable.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.sectorsTable.setHorizontalHeaderItem(4, item)
self.horizontalLayout_13.addWidget(self.sectorsTable)
self.addSectorBtn = QtWidgets.QPushButton(parent=self.pageCampaign)
self.addSectorBtn.setEnabled(True)
self.addSectorBtn.setObjectName("addSectorBtn")
self.horizontalLayout_13.addWidget(self.addSectorBtn)
self.gridLayout_4.addLayout(self.horizontalLayout_13, 2, 0, 1, 3)
self.horizontalLayout_11 = QtWidgets.QHBoxLayout()
self.horizontalLayout_11.setObjectName("horizontalLayout_11")
@ -385,7 +385,7 @@ class Ui_MainWindow(object):
self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(1)
self.selectedDetailsStack.setCurrentIndex(3)
self.selectedDetailsStack.setCurrentIndex(2)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
@ -429,17 +429,6 @@ class Ui_MainWindow(object):
self.labelSectors.setText(_translate("MainWindow", "Sectors"))
self.labelParticipants_2.setText(_translate("MainWindow", "Participants"))
self.endCampaignBtn.setText(_translate("MainWindow", "End campaign"))
item = self.sectorsTable.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Name"))
item = self.sectorsTable.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "Round"))
item = self.sectorsTable.horizontalHeaderItem(2)
item.setText(_translate("MainWindow", "Major obj."))
item = self.sectorsTable.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Minor opp."))
item = self.sectorsTable.horizontalHeaderItem(4)
item.setText(_translate("MainWindow", "Influence imp."))
self.addSectorBtn.setText(_translate("MainWindow", "Add Sector"))
item = self.campaignParticipantsTable.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Name"))
item = self.campaignParticipantsTable.horizontalHeaderItem(1)
@ -451,6 +440,17 @@ class Ui_MainWindow(object):
item = self.campaignParticipantsTable.horizontalHeaderItem(4)
item.setText(_translate("MainWindow", "Theme pts."))
self.addCampaignParticipantBtn.setText(_translate("MainWindow", "Add participant"))
item = self.sectorsTable.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Name"))
item = self.sectorsTable.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "Round"))
item = self.sectorsTable.horizontalHeaderItem(2)
item.setText(_translate("MainWindow", "Major obj."))
item = self.sectorsTable.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Minor opp."))
item = self.sectorsTable.horizontalHeaderItem(4)
item.setText(_translate("MainWindow", "Influence imp."))
self.addSectorBtn.setText(_translate("MainWindow", "Add Sector"))
self.campaignName.setText(_translate("MainWindow", "campaignName"))
self.campaignMonth.setText(_translate("MainWindow", "campaignMonth"))
self.labelChoices.setText(_translate("MainWindow", "Choices"))
@ -466,7 +466,7 @@ class Ui_MainWindow(object):
item = self.choicesTable.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Player"))
item = self.choicesTable.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "Prioritary"))
item.setText(_translate("MainWindow", "Priority"))
item = self.choicesTable.horizontalHeaderItem(2)
item.setText(_translate("MainWindow", "Secondary"))
self.resolvePairingBtn.setText(_translate("MainWindow", "Resolve pairing"))

View file

@ -150,7 +150,7 @@
<item>
<widget class="QStackedWidget" name="selectedDetailsStack">
<property name="currentIndex">
<number>3</number>
<number>2</number>
</property>
<widget class="QWidget" name="pageEmpty">
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -379,6 +379,46 @@
</item>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QTableWidget" name="campaignParticipantsTable">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Leader</string>
</property>
</column>
<column>
<property name="text">
<string>Theme</string>
</property>
</column>
<column>
<property name="text">
<string>Victory pts.</string>
</property>
</column>
<column>
<property name="text">
<string>Theme pts.</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QPushButton" name="addCampaignParticipantBtn">
<property name="text">
<string>Add participant</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QTableWidget" name="sectorsTable">
<column>
@ -420,46 +460,6 @@
</item>
</layout>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QTableWidget" name="campaignParticipantsTable">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Leader</string>
</property>
</column>
<column>
<property name="text">
<string>Theme</string>
</property>
</column>
<column>
<property name="text">
<string>Victory pts.</string>
</property>
</column>
<column>
<property name="text">
<string>Theme pts.</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QPushButton" name="addCampaignParticipantBtn">
<property name="text">
<string>Add participant</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
@ -573,7 +573,7 @@
</column>
<column>
<property name="text">
<string>Prioritary</string>
<string>Priority</string>
</property>
</column>
<column>

View file

@ -13,7 +13,7 @@ class Ui_sectorDialog(object):
def setupUi(self, sectorDialog):
sectorDialog.setObjectName("sectorDialog")
sectorDialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
sectorDialog.resize(514, 129)
sectorDialog.resize(602, 338)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/warchron_logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
sectorDialog.setWindowIcon(icon)
@ -59,6 +59,13 @@ class Ui_sectorDialog(object):
self.minorComboBox.setSizePolicy(sizePolicy)
self.minorComboBox.setObjectName("minorComboBox")
self.gridLayout.addWidget(self.minorComboBox, 1, 3, 1, 1)
self.label_7 = QtWidgets.QLabel(parent=sectorDialog)
self.label_7.setObjectName("label_7")
self.gridLayout.addWidget(self.label_7, 2, 0, 1, 1)
self.sectorMission = QtWidgets.QLineEdit(parent=sectorDialog)
self.sectorMission.setText("")
self.sectorMission.setObjectName("sectorMission")
self.gridLayout.addWidget(self.sectorMission, 2, 1, 1, 1)
self.label_5 = QtWidgets.QLabel(parent=sectorDialog)
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 2, 2, 1, 1)
@ -70,11 +77,17 @@ class Ui_sectorDialog(object):
self.influenceComboBox.setSizePolicy(sizePolicy)
self.influenceComboBox.setObjectName("influenceComboBox")
self.gridLayout.addWidget(self.influenceComboBox, 2, 3, 1, 1)
self.label_6 = QtWidgets.QLabel(parent=sectorDialog)
self.label_6.setObjectName("label_6")
self.gridLayout.addWidget(self.label_6, 3, 0, 1, 1)
self.sectorDescription = QtWidgets.QPlainTextEdit(parent=sectorDialog)
self.sectorDescription.setObjectName("sectorDescription")
self.gridLayout.addWidget(self.sectorDescription, 3, 1, 1, 3)
self.buttonBox = QtWidgets.QDialogButtonBox(parent=sectorDialog)
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 3, 2, 1, 2)
self.gridLayout.addWidget(self.buttonBox, 4, 2, 1, 2)
self.retranslateUi(sectorDialog)
self.buttonBox.accepted.connect(sectorDialog.accept) # type: ignore
@ -88,7 +101,9 @@ class Ui_sectorDialog(object):
self.label_3.setText(_translate("sectorDialog", "Major objective"))
self.label.setText(_translate("sectorDialog", "Round"))
self.label_4.setText(_translate("sectorDialog", "Minor opportunity"))
self.label_7.setText(_translate("sectorDialog", "Mission"))
self.label_5.setText(_translate("sectorDialog", "Influence"))
self.label_6.setText(_translate("sectorDialog", "Description"))
if __name__ == "__main__":

View file

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>129</height>
<width>602</width>
<height>338</height>
</rect>
</property>
<property name="windowTitle">
@ -86,6 +86,20 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Mission</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="sectorMission">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
@ -103,7 +117,17 @@
</property>
</widget>
</item>
<item row="3" column="2" colspan="2">
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QPlainTextEdit" name="sectorDescription"/>
</item>
<item row="4" column="2" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>

View file

@ -7,6 +7,7 @@ from PyQt6.QtWidgets import QDialog, QFileDialog, QTreeWidgetItem, QMenu
from PyQt6.QtGui import QCloseEvent
from warchron.constants import ROLE_TYPE, ROLE_ID, ItemType
from warchron.controller.dtos import ParticipantOption
from warchron.view.ui.ui_main_window import Ui_MainWindow
from warchron.view.ui.ui_player_dialog import Ui_playerDialog
from warchron.view.ui.ui_war_dialog import Ui_warDialog
@ -15,7 +16,7 @@ from warchron.view.ui.ui_objective_dialog import Ui_objectiveDialog
from warchron.view.ui.ui_war_participant_dialog import Ui_warParticipantDialog
from warchron.view.ui.ui_campaign_participant_dialog import Ui_campaignParticipantDialog
from warchron.view.ui.ui_sector_dialog import Ui_sectorDialog
from warchron.controller.dtos import ParticipantOption
from warchron.view.ui.ui_choices_dialog import Ui_choicesDialog
# utils...
@ -50,6 +51,11 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
self.show_details(None)
self.playersTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.playersTable.customContextMenuRequested.connect(self._on_players_table_context_menu)
self.warsTree.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.warsTree.customContextMenuRequested.connect(self._on_wars_tree_context_menu)
self.addCampaignBtn.clicked.connect(self._on_add_campaign_clicked)
self.addRoundBtn.clicked.connect(self._on_add_round_clicked)
# Pages
self.warParticipantsTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.warParticipantsTable.customContextMenuRequested.connect(self._on_war_participants_table_context_menu)
self.objectivesTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
@ -58,10 +64,8 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
self.campaignParticipantsTable.customContextMenuRequested.connect(self._on_campaign_participants_table_context_menu)
self.sectorsTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.sectorsTable.customContextMenuRequested.connect(self._on_sectors_table_context_menu)
self.warsTree.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.warsTree.customContextMenuRequested.connect(self._on_wars_tree_context_menu)
self.addCampaignBtn.clicked.connect(self._on_add_campaign_clicked)
self.addRoundBtn.clicked.connect(self._on_add_round_clicked)
self.choicesTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.choicesTable.customContextMenuRequested.connect(self._on_choices_table_context_menu)
def _emit_selection_changed(self, current, previous):
if not self.on_tree_selection_changed:
@ -374,10 +378,35 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
# Round page
def _on_choices_table_context_menu(self, pos):
item = self.choicesTable.itemAt(pos)
if not item:
return
row = item.row()
name_item = self.choicesTable.item(row, 0)
if not name_item:
return
choice_id = name_item.data(Qt.ItemDataRole.UserRole)
menu = QMenu(self)
edit_action = menu.addAction("Edit")
action = menu.exec(self.choicesTable.viewport().mapToGlobal(pos))
if action == edit_action and self.on_edit_item:
self.on_edit_item(ItemType.CHOICE, choice_id)
def show_round_details(self, *, index: int):
self.roundNb.setText(f"Round {index}")
def display_round_choices(self, rows: list[dict]):
self.choicesTable.setRowCount(len(rows))
for row, data in enumerate(rows):
self.choicesTable.setItem(row, 0, QtWidgets.QTableWidgetItem(data["participant_name"]))
self.choicesTable.setItem(row, 1, QtWidgets.QTableWidgetItem(data["priority"]))
self.choicesTable.setItem(row, 2, QtWidgets.QTableWidgetItem(data["secondary"]))
self.choicesTable.item(row, 0).setData(
Qt.ItemDataRole.UserRole,
data["participant_id"]
)
class PlayerDialog(QDialog):
def __init__(self, parent=None, *, default_name: str = ""):
super().__init__(parent)
@ -504,3 +533,29 @@ class SectorDialog(QDialog):
def get_influence_id(self) -> str:
return self.ui.influenceComboBox.currentData()
class ChoicesDialog(QDialog):
def __init__(self, parent=None, *, participants: list, default_participant_id=None, sectors: list, default_priority_id=None, default_secondary_id=None):
super().__init__(parent)
self.ui = Ui_choicesDialog()
self.ui.setupUi(self)
for part in participants:
self.ui.playerComboBox.addItem(part.name, part.id)
select_if_exists(self.ui.playerComboBox, default_participant_id)
self.ui.playerComboBox.setEnabled(False)
self.ui.priorityComboBox.addItem("(none)", None)
self.ui.secondaryComboBox.addItem("(none)", None)
for sect in sectors:
self.ui.priorityComboBox.addItem(sect.name, sect.id)
self.ui.secondaryComboBox.addItem(sect.name, sect.id)
select_if_exists(self.ui.priorityComboBox, default_priority_id)
select_if_exists(self.ui.secondaryComboBox, default_secondary_id)
def get_participant_id(self) -> str:
return self.ui.playerComboBox.currentData()
def get_priority_id(self) -> str:
return self.ui.priorityComboBox.currentData()
def get_secondary_id(self) -> str:
return self.ui.secondaryComboBox.currentData()