list round choices ; fix UI
This commit is contained in:
parent
032ab2d2c4
commit
723723dea1
14 changed files with 683 additions and 99 deletions
|
|
@ -15,6 +15,8 @@ class ItemType(StrEnum):
|
||||||
WAR_PARTICIPANT = "war_participant"
|
WAR_PARTICIPANT = "war_participant"
|
||||||
SECTOR = "sector"
|
SECTOR = "sector"
|
||||||
CAMPAIGN_PARTICIPANT = "campaign_participant"
|
CAMPAIGN_PARTICIPANT = "campaign_participant"
|
||||||
|
CHOICE = "choice"
|
||||||
|
BATTLE = "battle"
|
||||||
|
|
||||||
class RefreshScope(Enum):
|
class RefreshScope(Enum):
|
||||||
NONE = auto()
|
NONE = auto()
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ from warchron.model.model import Model
|
||||||
from warchron.view.view import View
|
from warchron.view.view import View
|
||||||
|
|
||||||
from warchron.constants import ItemType, RefreshScope
|
from warchron.constants import ItemType, RefreshScope
|
||||||
from warchron.view.view import PlayerDialog, WarDialog, CampaignDialog, ObjectiveDialog, WarParticipantDialog, CampaignParticipantDialog, SectorDialog
|
|
||||||
from warchron.controller.dtos import ParticipantOption
|
from warchron.controller.dtos import ParticipantOption
|
||||||
|
from warchron.view.view import PlayerDialog, WarDialog, CampaignDialog, ObjectiveDialog, WarParticipantDialog, CampaignParticipantDialog, SectorDialog, ChoicesDialog
|
||||||
|
|
||||||
class Controller:
|
class Controller:
|
||||||
def __init__(self, model: Model, view: View):
|
def __init__(self, model: Model, view: View):
|
||||||
|
|
@ -167,6 +167,24 @@ class Controller:
|
||||||
def _fill_round_details(self, round_id: str):
|
def _fill_round_details(self, round_id: str):
|
||||||
index = self.model.get_round_index(round_id)
|
index = self.model.get_round_index(round_id)
|
||||||
self.view.show_round_details(index=index)
|
self.view.show_round_details(index=index)
|
||||||
|
camp, rnd, participants, sectors = self.model.get_round_choices_data(round_id)
|
||||||
|
rows = []
|
||||||
|
for part in participants:
|
||||||
|
player = self.model.get_player(part.id)
|
||||||
|
choice = rnd.get_choice(part.id)
|
||||||
|
priority_name = ""
|
||||||
|
secondary_name = ""
|
||||||
|
if choice and choice.priority_sector_id:
|
||||||
|
priority_name = self.model.get_sector(choice.priority_sector_id).name
|
||||||
|
if choice and choice.secondary_sector_id:
|
||||||
|
secondary_name = self.model.get_sector(choice.secondary_sector_id).name
|
||||||
|
rows.append({
|
||||||
|
"participant_id": part.id,
|
||||||
|
"participant_name": player.name,
|
||||||
|
"priority": priority_name,
|
||||||
|
"secondary": secondary_name,
|
||||||
|
})
|
||||||
|
self.view.display_round_choices(rows)
|
||||||
|
|
||||||
def on_tree_selection_changed(self, selection):
|
def on_tree_selection_changed(self, selection):
|
||||||
self.selected_war_id = None
|
self.selected_war_id = None
|
||||||
|
|
@ -325,7 +343,9 @@ class Controller:
|
||||||
theme = dialog.get_participant_theme()
|
theme = dialog.get_participant_theme()
|
||||||
self.model.update_campaign_participant(item_id, leader=leader, theme=theme)
|
self.model.update_campaign_participant(item_id, leader=leader, theme=theme)
|
||||||
self.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
self.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||||
self.is_dirty = True
|
elif item_type == ItemType.CHOICE:
|
||||||
|
self.edit_round_choice(item_id)
|
||||||
|
self.refresh(RefreshScope.ROUND_DETAILS)
|
||||||
|
|
||||||
def delete_item(self, item_type: str, item_id: str):
|
def delete_item(self, item_type: str, item_id: str):
|
||||||
reply = QMessageBox.question(
|
reply = QMessageBox.question(
|
||||||
|
|
@ -556,4 +576,29 @@ class Controller:
|
||||||
return
|
return
|
||||||
rnd = self.model.add_round(self.selected_campaign_id)
|
rnd = self.model.add_round(self.selected_campaign_id)
|
||||||
self.is_dirty = True
|
self.is_dirty = True
|
||||||
self.refresh_and_select(RefreshScope.WARS_TREE, item_type=ItemType.ROUND, item_id=rnd.id)
|
self.refresh_and_select(RefreshScope.WARS_TREE, item_type=ItemType.ROUND, item_id=rnd.id)
|
||||||
|
|
||||||
|
def edit_round_choice(self, choice_id: str):
|
||||||
|
round_id = self.selected_round_id
|
||||||
|
if not round_id:
|
||||||
|
return
|
||||||
|
camp, rnd, participants, sectors = self.model.get_round_choices_data(round_id)
|
||||||
|
choice = rnd.get_choice(choice_id)
|
||||||
|
if not choice:
|
||||||
|
return
|
||||||
|
participant = camp.participants[choice.participant_id]
|
||||||
|
dialog = ChoicesDialog(
|
||||||
|
self.view,
|
||||||
|
participants=[participant],
|
||||||
|
default_participant_id=participant.id,
|
||||||
|
sectors=sectors,
|
||||||
|
default_priority_id=choice.priority_sector_id,
|
||||||
|
default_secondary_id=choice.secondary_sector_id,
|
||||||
|
)
|
||||||
|
if dialog.exec() != QDialog.DialogCode.Accepted:
|
||||||
|
return
|
||||||
|
rnd.set_choice(
|
||||||
|
participant_id=participant.id,
|
||||||
|
priority_sector_id=dialog.get_priority_id(),
|
||||||
|
secondary_sector_id=dialog.get_secondary_id(),
|
||||||
|
)
|
||||||
|
|
@ -155,9 +155,9 @@ class Sector:
|
||||||
self.id: str = str(uuid4())
|
self.id: str = str(uuid4())
|
||||||
self.name: str = name
|
self.name: str = name
|
||||||
self.round_id: str = round_id
|
self.round_id: str = round_id
|
||||||
self.major_objective_id: str = major_id
|
self.major_objective_id: str | None = major_id # ref to War.objectives
|
||||||
self.minor_objective_id: str = minor_id
|
self.minor_objective_id: str | None = minor_id # ref to War.objectives
|
||||||
self.influence_objective_id: str = influence_id
|
self.influence_objective_id: str | None = influence_id # ref to War.objectives
|
||||||
|
|
||||||
def set_id(self, new_id: str):
|
def set_id(self, new_id: str):
|
||||||
self.id = new_id
|
self.id = new_id
|
||||||
|
|
|
||||||
|
|
@ -290,3 +290,15 @@ class Model:
|
||||||
def remove_round(self, round_id: str):
|
def remove_round(self, round_id: str):
|
||||||
camp = self.get_campaign_by_round(round_id)
|
camp = self.get_campaign_by_round(round_id)
|
||||||
camp.remove_round(round_id)
|
camp.remove_round(round_id)
|
||||||
|
|
||||||
|
# Choices methods
|
||||||
|
|
||||||
|
def get_round_choices_data(self, round_id: str):
|
||||||
|
camp = self.get_campaign_by_round(round_id)
|
||||||
|
rnd = self.get_round(round_id)
|
||||||
|
participants = camp.participants.values()
|
||||||
|
sectors = [
|
||||||
|
s for s in camp.sectors.values()
|
||||||
|
if s.round_id == round_id
|
||||||
|
]
|
||||||
|
return camp, rnd, participants, sectors
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
|
from __future__ import annotations
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
class Round:
|
class Round:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.id: str = str(uuid4())
|
self.id: str = str(uuid4())
|
||||||
self.sectors = {}
|
self.choices: dict[str, RoundChoice] = {}
|
||||||
self.choices = {}
|
|
||||||
self.battles = {}
|
self.battles = {}
|
||||||
self.is_over: bool = False
|
self.is_over: bool = False
|
||||||
|
|
||||||
|
|
@ -14,6 +14,9 @@ class Round:
|
||||||
def set_state(self, new_state: bool):
|
def set_state(self, new_state: bool):
|
||||||
self.is_over = new_state
|
self.is_over = new_state
|
||||||
|
|
||||||
|
def set_choice(self, participant_id: str, priority_sector_id: str | None, secondary_sector_id: str | None):
|
||||||
|
self.choices[participant_id] = RoundChoice(participant_id, priority_sector_id, secondary_sector_id)
|
||||||
|
|
||||||
def toDict(self):
|
def toDict(self):
|
||||||
return {
|
return {
|
||||||
"id": self.id,
|
"id": self.id,
|
||||||
|
|
@ -31,4 +34,16 @@ class Round:
|
||||||
# rnd.choices = data.get("choices", {})
|
# rnd.choices = data.get("choices", {})
|
||||||
# rnd.battles = data.get("battles", {})
|
# rnd.battles = data.get("battles", {})
|
||||||
rnd.set_state(data.get("is_over", False))
|
rnd.set_state(data.get("is_over", False))
|
||||||
return rnd
|
return rnd
|
||||||
|
|
||||||
|
# Choices methods
|
||||||
|
|
||||||
|
def get_choice(self, participant_id: str) -> RoundChoice | None:
|
||||||
|
return self.choices.get(participant_id)
|
||||||
|
|
||||||
|
|
||||||
|
class RoundChoice:
|
||||||
|
def __init__(self, participant_id: str, priority_sector_id: str | None = None, secondary_sector_id: str | None = None):
|
||||||
|
self.participant_id: str = participant_id # ref to Campaign.participants
|
||||||
|
self.priority_sector_id: str | None = priority_sector_id # ref to Campaign.sectors
|
||||||
|
self.secondary_sector_id: str | None = secondary_sector_id # ref to Campaign.sectors
|
||||||
|
|
|
||||||
78
src/warchron/view/ui/ui_battle_result_dialog.py
Normal file
78
src/warchron/view/ui/ui_battle_result_dialog.py
Normal 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())
|
||||||
118
src/warchron/view/ui/ui_battle_result_dialog.ui
Normal file
118
src/warchron/view/ui/ui_battle_result_dialog.ui
Normal 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>
|
||||||
88
src/warchron/view/ui/ui_choices_dialog.py
Normal file
88
src/warchron/view/ui/ui_choices_dialog.py
Normal 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())
|
||||||
132
src/warchron/view/ui/ui_choices_dialog.ui
Normal file
132
src/warchron/view/ui/ui_choices_dialog.ui
Normal 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>
|
||||||
|
|
@ -183,28 +183,6 @@ class Ui_MainWindow(object):
|
||||||
self.gridLayout_4.addItem(spacerItem5, 5, 2, 1, 1)
|
self.gridLayout_4.addItem(spacerItem5, 5, 2, 1, 1)
|
||||||
self.horizontalLayout_12 = QtWidgets.QHBoxLayout()
|
self.horizontalLayout_12 = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout_12.setObjectName("horizontalLayout_12")
|
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 = QtWidgets.QTableWidget(parent=self.pageCampaign)
|
||||||
self.campaignParticipantsTable.setObjectName("campaignParticipantsTable")
|
self.campaignParticipantsTable.setObjectName("campaignParticipantsTable")
|
||||||
self.campaignParticipantsTable.setColumnCount(5)
|
self.campaignParticipantsTable.setColumnCount(5)
|
||||||
|
|
@ -219,10 +197,32 @@ class Ui_MainWindow(object):
|
||||||
self.campaignParticipantsTable.setHorizontalHeaderItem(3, item)
|
self.campaignParticipantsTable.setHorizontalHeaderItem(3, item)
|
||||||
item = QtWidgets.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.campaignParticipantsTable.setHorizontalHeaderItem(4, item)
|
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 = QtWidgets.QPushButton(parent=self.pageCampaign)
|
||||||
self.addCampaignParticipantBtn.setObjectName("addCampaignParticipantBtn")
|
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.gridLayout_4.addLayout(self.horizontalLayout_13, 2, 0, 1, 3)
|
||||||
self.horizontalLayout_11 = QtWidgets.QHBoxLayout()
|
self.horizontalLayout_11 = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout_11.setObjectName("horizontalLayout_11")
|
self.horizontalLayout_11.setObjectName("horizontalLayout_11")
|
||||||
|
|
@ -385,7 +385,7 @@ class Ui_MainWindow(object):
|
||||||
|
|
||||||
self.retranslateUi(MainWindow)
|
self.retranslateUi(MainWindow)
|
||||||
self.tabWidget.setCurrentIndex(1)
|
self.tabWidget.setCurrentIndex(1)
|
||||||
self.selectedDetailsStack.setCurrentIndex(3)
|
self.selectedDetailsStack.setCurrentIndex(2)
|
||||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
def retranslateUi(self, MainWindow):
|
def retranslateUi(self, MainWindow):
|
||||||
|
|
@ -429,17 +429,6 @@ class Ui_MainWindow(object):
|
||||||
self.labelSectors.setText(_translate("MainWindow", "Sectors"))
|
self.labelSectors.setText(_translate("MainWindow", "Sectors"))
|
||||||
self.labelParticipants_2.setText(_translate("MainWindow", "Participants"))
|
self.labelParticipants_2.setText(_translate("MainWindow", "Participants"))
|
||||||
self.endCampaignBtn.setText(_translate("MainWindow", "End campaign"))
|
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 = self.campaignParticipantsTable.horizontalHeaderItem(0)
|
||||||
item.setText(_translate("MainWindow", "Name"))
|
item.setText(_translate("MainWindow", "Name"))
|
||||||
item = self.campaignParticipantsTable.horizontalHeaderItem(1)
|
item = self.campaignParticipantsTable.horizontalHeaderItem(1)
|
||||||
|
|
@ -451,6 +440,17 @@ class Ui_MainWindow(object):
|
||||||
item = self.campaignParticipantsTable.horizontalHeaderItem(4)
|
item = self.campaignParticipantsTable.horizontalHeaderItem(4)
|
||||||
item.setText(_translate("MainWindow", "Theme pts."))
|
item.setText(_translate("MainWindow", "Theme pts."))
|
||||||
self.addCampaignParticipantBtn.setText(_translate("MainWindow", "Add participant"))
|
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.campaignName.setText(_translate("MainWindow", "campaignName"))
|
||||||
self.campaignMonth.setText(_translate("MainWindow", "campaignMonth"))
|
self.campaignMonth.setText(_translate("MainWindow", "campaignMonth"))
|
||||||
self.labelChoices.setText(_translate("MainWindow", "Choices"))
|
self.labelChoices.setText(_translate("MainWindow", "Choices"))
|
||||||
|
|
@ -466,7 +466,7 @@ class Ui_MainWindow(object):
|
||||||
item = self.choicesTable.horizontalHeaderItem(0)
|
item = self.choicesTable.horizontalHeaderItem(0)
|
||||||
item.setText(_translate("MainWindow", "Player"))
|
item.setText(_translate("MainWindow", "Player"))
|
||||||
item = self.choicesTable.horizontalHeaderItem(1)
|
item = self.choicesTable.horizontalHeaderItem(1)
|
||||||
item.setText(_translate("MainWindow", "Prioritary"))
|
item.setText(_translate("MainWindow", "Priority"))
|
||||||
item = self.choicesTable.horizontalHeaderItem(2)
|
item = self.choicesTable.horizontalHeaderItem(2)
|
||||||
item.setText(_translate("MainWindow", "Secondary"))
|
item.setText(_translate("MainWindow", "Secondary"))
|
||||||
self.resolvePairingBtn.setText(_translate("MainWindow", "Resolve pairing"))
|
self.resolvePairingBtn.setText(_translate("MainWindow", "Resolve pairing"))
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="selectedDetailsStack">
|
<widget class="QStackedWidget" name="selectedDetailsStack">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>3</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="pageEmpty">
|
<widget class="QWidget" name="pageEmpty">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
|
@ -379,6 +379,46 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="3">
|
<item row="4" column="0" colspan="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
<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>
|
<item>
|
||||||
<widget class="QTableWidget" name="sectorsTable">
|
<widget class="QTableWidget" name="sectorsTable">
|
||||||
<column>
|
<column>
|
||||||
|
|
@ -420,46 +460,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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">
|
<item row="0" column="0" colspan="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -573,7 +573,7 @@
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Prioritary</string>
|
<string>Priority</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ class Ui_sectorDialog(object):
|
||||||
def setupUi(self, sectorDialog):
|
def setupUi(self, sectorDialog):
|
||||||
sectorDialog.setObjectName("sectorDialog")
|
sectorDialog.setObjectName("sectorDialog")
|
||||||
sectorDialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
|
sectorDialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
|
||||||
sectorDialog.resize(514, 129)
|
sectorDialog.resize(602, 338)
|
||||||
icon = QtGui.QIcon()
|
icon = QtGui.QIcon()
|
||||||
icon.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/warchron_logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
|
icon.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/warchron_logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
|
||||||
sectorDialog.setWindowIcon(icon)
|
sectorDialog.setWindowIcon(icon)
|
||||||
|
|
@ -59,6 +59,13 @@ class Ui_sectorDialog(object):
|
||||||
self.minorComboBox.setSizePolicy(sizePolicy)
|
self.minorComboBox.setSizePolicy(sizePolicy)
|
||||||
self.minorComboBox.setObjectName("minorComboBox")
|
self.minorComboBox.setObjectName("minorComboBox")
|
||||||
self.gridLayout.addWidget(self.minorComboBox, 1, 3, 1, 1)
|
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 = QtWidgets.QLabel(parent=sectorDialog)
|
||||||
self.label_5.setObjectName("label_5")
|
self.label_5.setObjectName("label_5")
|
||||||
self.gridLayout.addWidget(self.label_5, 2, 2, 1, 1)
|
self.gridLayout.addWidget(self.label_5, 2, 2, 1, 1)
|
||||||
|
|
@ -70,11 +77,17 @@ class Ui_sectorDialog(object):
|
||||||
self.influenceComboBox.setSizePolicy(sizePolicy)
|
self.influenceComboBox.setSizePolicy(sizePolicy)
|
||||||
self.influenceComboBox.setObjectName("influenceComboBox")
|
self.influenceComboBox.setObjectName("influenceComboBox")
|
||||||
self.gridLayout.addWidget(self.influenceComboBox, 2, 3, 1, 1)
|
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 = QtWidgets.QDialogButtonBox(parent=sectorDialog)
|
||||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||||
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok)
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok)
|
||||||
self.buttonBox.setObjectName("buttonBox")
|
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.retranslateUi(sectorDialog)
|
||||||
self.buttonBox.accepted.connect(sectorDialog.accept) # type: ignore
|
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_3.setText(_translate("sectorDialog", "Major objective"))
|
||||||
self.label.setText(_translate("sectorDialog", "Round"))
|
self.label.setText(_translate("sectorDialog", "Round"))
|
||||||
self.label_4.setText(_translate("sectorDialog", "Minor opportunity"))
|
self.label_4.setText(_translate("sectorDialog", "Minor opportunity"))
|
||||||
|
self.label_7.setText(_translate("sectorDialog", "Mission"))
|
||||||
self.label_5.setText(_translate("sectorDialog", "Influence"))
|
self.label_5.setText(_translate("sectorDialog", "Influence"))
|
||||||
|
self.label_6.setText(_translate("sectorDialog", "Description"))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>514</width>
|
<width>602</width>
|
||||||
<height>129</height>
|
<height>338</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
@ -86,6 +86,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="2" column="2">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -103,7 +117,17 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ from PyQt6.QtWidgets import QDialog, QFileDialog, QTreeWidgetItem, QMenu
|
||||||
from PyQt6.QtGui import QCloseEvent
|
from PyQt6.QtGui import QCloseEvent
|
||||||
|
|
||||||
from warchron.constants import ROLE_TYPE, ROLE_ID, ItemType
|
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_main_window import Ui_MainWindow
|
||||||
from warchron.view.ui.ui_player_dialog import Ui_playerDialog
|
from warchron.view.ui.ui_player_dialog import Ui_playerDialog
|
||||||
from warchron.view.ui.ui_war_dialog import Ui_warDialog
|
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_war_participant_dialog import Ui_warParticipantDialog
|
||||||
from warchron.view.ui.ui_campaign_participant_dialog import Ui_campaignParticipantDialog
|
from warchron.view.ui.ui_campaign_participant_dialog import Ui_campaignParticipantDialog
|
||||||
from warchron.view.ui.ui_sector_dialog import Ui_sectorDialog
|
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...
|
# utils...
|
||||||
|
|
||||||
|
|
@ -50,6 +51,11 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
self.show_details(None)
|
self.show_details(None)
|
||||||
self.playersTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
self.playersTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
self.playersTable.customContextMenuRequested.connect(self._on_players_table_context_menu)
|
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.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
self.warParticipantsTable.customContextMenuRequested.connect(self._on_war_participants_table_context_menu)
|
self.warParticipantsTable.customContextMenuRequested.connect(self._on_war_participants_table_context_menu)
|
||||||
self.objectivesTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
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.campaignParticipantsTable.customContextMenuRequested.connect(self._on_campaign_participants_table_context_menu)
|
||||||
self.sectorsTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
self.sectorsTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
self.sectorsTable.customContextMenuRequested.connect(self._on_sectors_table_context_menu)
|
self.sectorsTable.customContextMenuRequested.connect(self._on_sectors_table_context_menu)
|
||||||
self.warsTree.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
self.choicesTable.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
self.warsTree.customContextMenuRequested.connect(self._on_wars_tree_context_menu)
|
self.choicesTable.customContextMenuRequested.connect(self._on_choices_table_context_menu)
|
||||||
self.addCampaignBtn.clicked.connect(self._on_add_campaign_clicked)
|
|
||||||
self.addRoundBtn.clicked.connect(self._on_add_round_clicked)
|
|
||||||
|
|
||||||
def _emit_selection_changed(self, current, previous):
|
def _emit_selection_changed(self, current, previous):
|
||||||
if not self.on_tree_selection_changed:
|
if not self.on_tree_selection_changed:
|
||||||
|
|
@ -374,10 +378,35 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
# Round page
|
# 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):
|
def show_round_details(self, *, index: int):
|
||||||
self.roundNb.setText(f"Round {index}")
|
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):
|
class PlayerDialog(QDialog):
|
||||||
def __init__(self, parent=None, *, default_name: str = ""):
|
def __init__(self, parent=None, *, default_name: str = ""):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
@ -504,3 +533,29 @@ class SectorDialog(QDialog):
|
||||||
|
|
||||||
def get_influence_id(self) -> str:
|
def get_influence_id(self) -> str:
|
||||||
return self.ui.influenceComboBox.currentData()
|
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()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue