From d869017646142208fa7b4113d3efc55c429a1a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20R=C3=A9aux?= Date: Thu, 12 Feb 2026 15:12:28 +0100 Subject: [PATCH] show is_over in warsTree & fator resources paths --- src/warchron/constants.py | 67 ++++ .../controller/campaign_controller.py | 7 +- src/warchron/controller/dtos.py | 11 +- .../controller/navigation_controller.py | 8 +- src/warchron/controller/round_controller.py | 15 +- src/warchron/controller/war_controller.py | 1 + src/warchron/view/battle_dialog.py | 2 + src/warchron/view/campaign_dialog.py | 5 +- .../view/campaign_participant_dialog.py | 2 + src/warchron/view/choice_dialog.py | 2 + src/warchron/view/objective_dialog.py | 2 + src/warchron/view/player_dialog.py | 2 + src/warchron/view/sector_dialog.py | 2 + src/warchron/view/ui/ui_battle_dialog.py | 190 ++++++----- src/warchron/view/ui/ui_battle_dialog.ui | 298 ++++++++++++------ src/warchron/view/ui/ui_choice_dialog.py | 62 ++-- src/warchron/view/ui/ui_choice_dialog.ui | 2 +- src/warchron/view/ui/ui_main_window.py | 80 ++--- src/warchron/view/ui/ui_main_window.ui | 133 ++------ src/warchron/view/ui/ui_objective_dialog.py | 14 +- src/warchron/view/ui/ui_objective_dialog.ui | 2 +- src/warchron/view/ui/ui_sector_dialog.py | 104 +++--- src/warchron/view/ui/ui_sector_dialog.ui | 272 +++++++++------- src/warchron/view/ui/ui_war_dialog.py | 14 +- src/warchron/view/ui/ui_war_dialog.ui | 2 +- src/warchron/view/view.py | 108 ++++--- src/warchron/view/war_dialog.py | 2 + src/warchron/view/war_participant_dialog.py | 2 + 28 files changed, 783 insertions(+), 628 deletions(-) diff --git a/src/warchron/constants.py b/src/warchron/constants.py index 9abeec3..670a466 100644 --- a/src/warchron/constants.py +++ b/src/warchron/constants.py @@ -1,12 +1,79 @@ from enum import StrEnum from enum import Enum, auto +from pathlib import Path from PyQt6.QtCore import Qt +from PyQt6.QtGui import QIcon + + +# Paths +PACKAGE_ROOT = Path(__file__).resolve().parent +VIEW_ROOT = PACKAGE_ROOT / "view" +RESOURCES_DIR = VIEW_ROOT / "resources" ROLE_TYPE = Qt.ItemDataRole.UserRole ROLE_ID = Qt.ItemDataRole.UserRole + 1 +class IconName(str, Enum): + UNDO = ("undo",) + REDO = ("redo",) + PAIRING = ("pairing",) + DRAW = ("draw",) + DELETE = ("delete",) + SAVE_AS = ("save_as",) + SAVE = ("save",) + NEW = ("new",) + EXIT = ("exit",) + END = ("end",) + OPEN = ("load",) + ONGOING = ("ongoing",) + EXPORT = ("export",) + EDIT = ("edit",) + ADD = ("add",) + ABOUT = ("about",) + WARS = ("wars",) + DONE = ("done",) + WIN = ("win",) + PLAYERS = ("players",) + WARCHRON = "warchron" + + +class Icons: + _cache: dict[str, QIcon] = {} + + _paths = { + IconName.UNDO: "arrow-curve-180-left", + IconName.REDO: "arrow-curve", + IconName.PAIRING: "arrow-switch", + IconName.DRAW: "balance.png", + IconName.DELETE: "cross.png", + IconName.SAVE_AS: "disk--pencil.png", + IconName.SAVE: "disk.png", + IconName.NEW: "document.png", + IconName.EXIT: "door--arrow.png", + IconName.END: "flag-white.png", + IconName.OPEN: "folder.png", + IconName.ONGOING: "hourglass.png", + IconName.EXPORT: "notebook--arrow.png", + IconName.EDIT: "pencil.png", + IconName.ADD: "plus.png", + IconName.ABOUT: "question.png", + IconName.WARS: "swords-small.png", + IconName.DONE: "tick.png", + IconName.WIN: "trophy.png", + IconName.PLAYERS: "users.png", + IconName.WARCHRON: "warchron_logo.png", + } + + @classmethod + def get(cls, name: IconName) -> QIcon: + if name not in cls._cache: + path = RESOURCES_DIR / cls._paths[name] + cls._cache[name] = QIcon(str(path)) + return cls._cache[name] + + class ItemType(StrEnum): PLAYER = "player" WAR = "war" diff --git a/src/warchron/controller/campaign_controller.py b/src/warchron/controller/campaign_controller.py index e0d37c1..f5ff268 100644 --- a/src/warchron/controller/campaign_controller.py +++ b/src/warchron/controller/campaign_controller.py @@ -124,6 +124,7 @@ class CampaignController: return self.app.is_dirty = True self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS) + self.app.navigation.refresh(RefreshScope.WARS_TREE) # Campaign participant methods @@ -199,7 +200,8 @@ class CampaignController: camp = self.app.model.get_campaign(self.app.navigation.selected_campaign_id) rounds = camp.get_all_rounds() rnd_objs: List[RoundDTO] = [ - RoundDTO(id=rnd.id, index=camp.get_round_index(rnd.id)) for rnd in rounds + RoundDTO(id=rnd.id, index=camp.get_round_index(rnd.id), is_over=rnd.is_over) + for rnd in rounds ] objectives = war.get_all_objectives() obj_dtos: List[ObjectiveDTO] = [ @@ -241,7 +243,8 @@ class CampaignController: war = self.app.model.get_war_by_campaign(camp.id) rounds = camp.get_all_rounds() rnd_dto: List[RoundDTO] = [ - RoundDTO(id=rnd.id, index=i) for i, rnd in enumerate(rounds, start=1) + RoundDTO(id=rnd.id, index=i, is_over=rnd.is_over) + for i, rnd in enumerate(rounds, start=1) ] objectives = war.get_all_objectives() obj_dto: List[ObjectiveDTO] = [ diff --git a/src/warchron/controller/dtos.py b/src/warchron/controller/dtos.py index 573b0c3..0e1b48a 100644 --- a/src/warchron/controller/dtos.py +++ b/src/warchron/controller/dtos.py @@ -1,6 +1,8 @@ from typing import List from dataclasses import dataclass +from PyQt6.QtGui import QIcon + @dataclass(frozen=True) class ParticipantOption: @@ -19,6 +21,7 @@ class WarDTO: id: str name: str year: int + is_over: bool _campaigns: List["CampaignDTO"] | None = None def get_all_campaigns(self) -> List["CampaignDTO"]: @@ -44,6 +47,7 @@ class CampaignDTO: id: str name: str month: int + is_over: bool _rounds: List["RoundDTO"] | None = None def get_all_rounds(self) -> List["RoundDTO"]: @@ -74,6 +78,7 @@ class SectorDTO: class RoundDTO: id: str index: int | None + is_over: bool @dataclass(frozen=True, slots=True) @@ -95,6 +100,6 @@ class BattleDTO: score: str | None victory_condition: str | None comment: str | None - state_icon: str | None - player1_icon: str | None - player2_icon: str | None + state_icon: QIcon | None + player1_icon: QIcon | None + player2_icon: QIcon | None diff --git a/src/warchron/controller/navigation_controller.py b/src/warchron/controller/navigation_controller.py index ad1344d..fe84943 100644 --- a/src/warchron/controller/navigation_controller.py +++ b/src/warchron/controller/navigation_controller.py @@ -36,13 +36,19 @@ class NavigationController: id=w.id, name=w.name, year=w.year, + is_over=w.is_over, _campaigns=[ CampaignDTO( id=c.id, name=c.name, month=c.month, + is_over=c.is_over, _rounds=[ - RoundDTO(id=r.id, index=c.get_round_index(r.id)) + RoundDTO( + id=r.id, + index=c.get_round_index(r.id), + is_over=r.is_over, + ) for r in c.get_all_rounds() ], ) diff --git a/src/warchron/controller/round_controller.py b/src/warchron/controller/round_controller.py index d15c0d9..fcca17e 100644 --- a/src/warchron/controller/round_controller.py +++ b/src/warchron/controller/round_controller.py @@ -2,7 +2,7 @@ from typing import List, TYPE_CHECKING from PyQt6.QtWidgets import QDialog, QMessageBox -from warchron.constants import ItemType, RefreshScope +from warchron.constants import ItemType, RefreshScope, Icons, IconName if TYPE_CHECKING: from warchron.controller.app_controller import AppController @@ -59,9 +59,9 @@ class RoundController: battle = self.app.model.create_battle( round_id=rnd.id, sector_id=sect.id ) - state_icon = ".\\src\\warchron\\view\\ui\\../resources/hourglass.png" + state_icon = Icons.get(IconName.ONGOING) if battle.is_finished(): - state_icon = ".\\src\\warchron\\view\\ui\\../resources/tick.png" + state_icon = Icons.get(IconName.DONE) if battle.player_1_id: camp_part = camp.participants[battle.player_1_id] player_1_name = self.app.model.get_participant_name( @@ -86,13 +86,13 @@ class RoundController: p1_icon = None p2_icon = None if battle.is_draw(): - p1_icon = ".\\src\\warchron\\view\\ui\\../resources/balance.png" - p2_icon = ".\\src\\warchron\\view\\ui\\../resources/balance.png" + p1_icon = Icons.get(IconName.DRAW) + p2_icon = Icons.get(IconName.DRAW) elif battle.winner_id: if battle.winner_id == battle.player_1_id: - p1_icon = ".\\src\\warchron\\view\\ui\\../resources/trophy.png" + p1_icon = Icons.get(IconName.WIN) elif battle.winner_id == battle.player_2_id: - p2_icon = ".\\src\\warchron\\view\\ui\\../resources/trophy.png" + p2_icon = Icons.get(IconName.WIN) battles_for_display.append( BattleDTO( id=battle.sector_id, @@ -141,6 +141,7 @@ class RoundController: return self.app.is_dirty = True self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS) + self.app.navigation.refresh(RefreshScope.WARS_TREE) # Choice methods diff --git a/src/warchron/controller/war_controller.py b/src/warchron/controller/war_controller.py index a29dd16..f360b8b 100644 --- a/src/warchron/controller/war_controller.py +++ b/src/warchron/controller/war_controller.py @@ -109,6 +109,7 @@ class WarController: return self.app.is_dirty = True self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS) + self.app.navigation.refresh(RefreshScope.WARS_TREE) def set_major_value(self, value: int) -> None: war_id = self.app.navigation.selected_war_id diff --git a/src/warchron/view/battle_dialog.py b/src/warchron/view/battle_dialog.py index b131740..8dd4637 100644 --- a/src/warchron/view/battle_dialog.py +++ b/src/warchron/view/battle_dialog.py @@ -2,6 +2,7 @@ from typing import cast, List from PyQt6.QtWidgets import QWidget, QDialog +from warchron.constants import Icons, IconName from warchron.controller.dtos import ParticipantOption, SectorDTO from warchron.view.helpers import select_if_exists from warchron.view.ui.ui_battle_dialog import Ui_battleDialog @@ -45,6 +46,7 @@ class BattleDialog(QDialog): self.ui.score.setText(default_score) self.ui.victoryCondition.setText(default_victory_condition) self.ui.battleComment.setPlainText(default_comment) + self.setWindowIcon(Icons.get(IconName.WARCHRON)) def get_sector_id(self) -> str: return cast(str, self.ui.sectorComboBox.currentData()) diff --git a/src/warchron/view/campaign_dialog.py b/src/warchron/view/campaign_dialog.py index 185203f..4d19265 100644 --- a/src/warchron/view/campaign_dialog.py +++ b/src/warchron/view/campaign_dialog.py @@ -1,7 +1,7 @@ -from PyQt6.QtWidgets import QDialog +from PyQt6.QtWidgets import QDialog, QWidget +from warchron.constants import Icons, IconName from warchron.view.ui.ui_campaign_dialog import Ui_campaignDialog -from PyQt6.QtWidgets import QWidget class CampaignDialog(QDialog): @@ -17,6 +17,7 @@ class CampaignDialog(QDialog): self.ui.campaignName.setText(default_name) if default_month is not None: self.ui.campaignMonth.setValue(default_month) + self.setWindowIcon(Icons.get(IconName.WARCHRON)) def get_campaign_name(self) -> str: return self.ui.campaignName.text().strip() diff --git a/src/warchron/view/campaign_participant_dialog.py b/src/warchron/view/campaign_participant_dialog.py index ae0fd86..37a4ea2 100644 --- a/src/warchron/view/campaign_participant_dialog.py +++ b/src/warchron/view/campaign_participant_dialog.py @@ -2,6 +2,7 @@ from typing import cast, List from PyQt6.QtWidgets import QWidget, QDialog +from warchron.constants import Icons, IconName from warchron.controller.dtos import ParticipantOption from warchron.view.helpers import select_if_exists from warchron.view.ui.ui_campaign_participant_dialog import ( @@ -29,6 +30,7 @@ class CampaignParticipantDialog(QDialog): self.ui.playerComboBox.setEnabled(editable_player) self.ui.leader.setText(default_leader) self.ui.theme.setText(default_theme) + self.setWindowIcon(Icons.get(IconName.WARCHRON)) def get_player_id(self) -> str: return cast(str, self.ui.playerComboBox.currentData()) diff --git a/src/warchron/view/choice_dialog.py b/src/warchron/view/choice_dialog.py index e7d97a5..0e4c429 100644 --- a/src/warchron/view/choice_dialog.py +++ b/src/warchron/view/choice_dialog.py @@ -2,6 +2,7 @@ from typing import cast, List from PyQt6.QtWidgets import QWidget, QDialog +from warchron.constants import Icons, IconName from warchron.controller.dtos import ParticipantOption, SectorDTO from warchron.view.helpers import select_if_exists from warchron.view.ui.ui_choice_dialog import Ui_choiceDialog @@ -34,6 +35,7 @@ class ChoiceDialog(QDialog): select_if_exists(self.ui.priorityComboBox, default_priority_id) select_if_exists(self.ui.secondaryComboBox, default_secondary_id) self.ui.choiceComment.setPlainText(default_comment) + self.setWindowIcon(Icons.get(IconName.WARCHRON)) def get_participant_id(self) -> str: return cast(str, self.ui.playerComboBox.currentData()) diff --git a/src/warchron/view/objective_dialog.py b/src/warchron/view/objective_dialog.py index cd7da62..b8765a0 100644 --- a/src/warchron/view/objective_dialog.py +++ b/src/warchron/view/objective_dialog.py @@ -1,5 +1,6 @@ from PyQt6.QtWidgets import QWidget, QDialog +from warchron.constants import Icons, IconName from warchron.view.ui.ui_objective_dialog import Ui_objectiveDialog @@ -16,6 +17,7 @@ class ObjectiveDialog(QDialog): self.ui.setupUi(self) # type: ignore self.ui.objectiveName.setText(default_name) self.ui.objectiveDescription.setPlainText(default_description) + self.setWindowIcon(Icons.get(IconName.WARCHRON)) def get_objective_name(self) -> str: return self.ui.objectiveName.text().strip() diff --git a/src/warchron/view/player_dialog.py b/src/warchron/view/player_dialog.py index af039e6..0fc7d5c 100644 --- a/src/warchron/view/player_dialog.py +++ b/src/warchron/view/player_dialog.py @@ -1,5 +1,6 @@ from PyQt6.QtWidgets import QWidget, QDialog +from warchron.constants import Icons, IconName from warchron.view.ui.ui_player_dialog import Ui_playerDialog @@ -11,6 +12,7 @@ class PlayerDialog(QDialog): self.ui: Ui_playerDialog = Ui_playerDialog() self.ui.setupUi(self) # type: ignore self.ui.playerName.setText(default_name) + self.setWindowIcon(Icons.get(IconName.WARCHRON)) def get_player_name(self) -> str: return self.ui.playerName.text().strip() diff --git a/src/warchron/view/sector_dialog.py b/src/warchron/view/sector_dialog.py index 783fb12..a930e5c 100644 --- a/src/warchron/view/sector_dialog.py +++ b/src/warchron/view/sector_dialog.py @@ -2,6 +2,7 @@ from typing import cast, List from PyQt6.QtWidgets import QWidget, QDialog +from warchron.constants import Icons, IconName from warchron.controller.dtos import ObjectiveDTO, RoundDTO from warchron.view.helpers import select_if_exists, format_round_label from warchron.view.ui.ui_sector_dialog import Ui_sectorDialog @@ -42,6 +43,7 @@ class SectorDialog(QDialog): select_if_exists(self.ui.influenceComboBox, default_influence_id) self.ui.sectorMission.setText(default_mission) self.ui.sectorDescription.setPlainText(default_description) + self.setWindowIcon(Icons.get(IconName.WARCHRON)) def get_sector_name(self) -> str: return self.ui.sectorName.text().strip() diff --git a/src/warchron/view/ui/ui_battle_dialog.py b/src/warchron/view/ui/ui_battle_dialog.py index 40614cd..7e50a17 100644 --- a/src/warchron/view/ui/ui_battle_dialog.py +++ b/src/warchron/view/ui/ui_battle_dialog.py @@ -1,4 +1,4 @@ -# Form implementation generated from reading ui file '.\src\warchron\view\ui\ui_battle_result_dialog.ui' +# Form implementation generated from reading ui file '.\src\warchron\view\ui\ui_battle_dialog.ui' # # Created by: PyQt6 UI code generator 6.7.1 # @@ -10,138 +10,128 @@ from PyQt6 import QtCore, QtGui, QtWidgets class Ui_battleDialog(object): - def setupUi(self, battleResultDialog): - battleResultDialog.setObjectName("battleResultDialog") - battleResultDialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) - battleResultDialog.resize(668, 317) + def setupUi(self, battleDialog): + battleDialog.setObjectName("battleDialog") + battleDialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) + battleDialog.resize(771, 315) 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.gridLayout = QtWidgets.QGridLayout(battleResultDialog) - self.gridLayout.setObjectName("gridLayout") - self.label_7 = QtWidgets.QLabel(parent=battleResultDialog) + icon.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/warchron_logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) + battleDialog.setWindowIcon(icon) + self.verticalLayout = QtWidgets.QVBoxLayout(battleDialog) + self.verticalLayout.setObjectName("verticalLayout") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.label_7 = QtWidgets.QLabel(parent=battleDialog) self.label_7.setObjectName("label_7") - self.gridLayout.addWidget(self.label_7, 0, 0, 1, 1) - self.sectorComboBox = QtWidgets.QComboBox(parent=battleResultDialog) - sizePolicy = QtWidgets.QSizePolicy( - QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed - ) + self.horizontalLayout.addWidget(self.label_7) + self.sectorComboBox = QtWidgets.QComboBox(parent=battleDialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.sectorComboBox.sizePolicy().hasHeightForWidth() - ) + sizePolicy.setHeightForWidth(self.sectorComboBox.sizePolicy().hasHeightForWidth()) self.sectorComboBox.setSizePolicy(sizePolicy) self.sectorComboBox.setObjectName("sectorComboBox") - self.gridLayout.addWidget(self.sectorComboBox, 0, 1, 1, 1) - self.label_5 = QtWidgets.QLabel(parent=battleResultDialog) + self.horizontalLayout.addWidget(self.sectorComboBox) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.label_5 = QtWidgets.QLabel(parent=battleDialog) self.label_5.setObjectName("label_5") - self.gridLayout.addWidget(self.label_5, 0, 2, 1, 1) - self.player1ComboBox = QtWidgets.QComboBox(parent=battleResultDialog) - sizePolicy = QtWidgets.QSizePolicy( - QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed - ) + self.horizontalLayout.addWidget(self.label_5) + self.player1ComboBox = QtWidgets.QComboBox(parent=battleDialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.player1ComboBox.sizePolicy().hasHeightForWidth() - ) + sizePolicy.setHeightForWidth(self.player1ComboBox.sizePolicy().hasHeightForWidth()) self.player1ComboBox.setSizePolicy(sizePolicy) self.player1ComboBox.setObjectName("player1ComboBox") - self.gridLayout.addWidget(self.player1ComboBox, 0, 3, 1, 1) - self.label_6 = QtWidgets.QLabel(parent=battleResultDialog) + self.horizontalLayout.addWidget(self.player1ComboBox) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout.addItem(spacerItem1) + self.label_6 = QtWidgets.QLabel(parent=battleDialog) self.label_6.setObjectName("label_6") - self.gridLayout.addWidget(self.label_6, 0, 4, 1, 1) - self.player2ComboBox = QtWidgets.QComboBox(parent=battleResultDialog) - sizePolicy = QtWidgets.QSizePolicy( - QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed - ) + self.horizontalLayout.addWidget(self.label_6) + self.player2ComboBox = QtWidgets.QComboBox(parent=battleDialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.player2ComboBox.sizePolicy().hasHeightForWidth() - ) + sizePolicy.setHeightForWidth(self.player2ComboBox.sizePolicy().hasHeightForWidth()) self.player2ComboBox.setSizePolicy(sizePolicy) self.player2ComboBox.setObjectName("player2ComboBox") - self.gridLayout.addWidget(self.player2ComboBox, 0, 5, 1, 1) - spacerItem = QtWidgets.QSpacerItem( - 20, - 40, - QtWidgets.QSizePolicy.Policy.Minimum, - QtWidgets.QSizePolicy.Policy.Expanding, - ) - self.gridLayout.addItem(spacerItem, 1, 1, 1, 1) - self.label = QtWidgets.QLabel(parent=battleResultDialog) + self.horizontalLayout.addWidget(self.player2ComboBox) + spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout.addItem(spacerItem2) + self.verticalLayout.addLayout(self.horizontalLayout) + spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.verticalLayout.addItem(spacerItem3) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.label = QtWidgets.QLabel(parent=battleDialog) self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 2, 0, 1, 1) - self.winnerComboBox = QtWidgets.QComboBox(parent=battleResultDialog) - sizePolicy = QtWidgets.QSizePolicy( - QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed - ) + self.horizontalLayout_2.addWidget(self.label) + self.winnerComboBox = QtWidgets.QComboBox(parent=battleDialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.winnerComboBox.sizePolicy().hasHeightForWidth() - ) + sizePolicy.setHeightForWidth(self.winnerComboBox.sizePolicy().hasHeightForWidth()) self.winnerComboBox.setSizePolicy(sizePolicy) self.winnerComboBox.setObjectName("winnerComboBox") - self.gridLayout.addWidget(self.winnerComboBox, 2, 1, 1, 1) - self.label_2 = QtWidgets.QLabel(parent=battleResultDialog) - self.label_2.setObjectName("label_2") - self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1) - self.score = QtWidgets.QLineEdit(parent=battleResultDialog) - self.score.setObjectName("score") - self.gridLayout.addWidget(self.score, 3, 1, 1, 2) - self.label_3 = QtWidgets.QLabel(parent=battleResultDialog) + self.horizontalLayout_2.addWidget(self.winnerComboBox) + spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout_2.addItem(spacerItem4) + self.label_3 = QtWidgets.QLabel(parent=battleDialog) self.label_3.setObjectName("label_3") - self.gridLayout.addWidget(self.label_3, 3, 3, 1, 1) - self.victoryCondition = QtWidgets.QLineEdit(parent=battleResultDialog) + self.horizontalLayout_2.addWidget(self.label_3) + self.victoryCondition = QtWidgets.QLineEdit(parent=battleDialog) self.victoryCondition.setObjectName("victoryCondition") - self.gridLayout.addWidget(self.victoryCondition, 3, 4, 1, 2) - self.label_4 = QtWidgets.QLabel(parent=battleResultDialog) + self.horizontalLayout_2.addWidget(self.victoryCondition) + spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout_2.addItem(spacerItem5) + self.label_2 = QtWidgets.QLabel(parent=battleDialog) + self.label_2.setObjectName("label_2") + self.horizontalLayout_2.addWidget(self.label_2) + self.score = QtWidgets.QLineEdit(parent=battleDialog) + self.score.setObjectName("score") + self.horizontalLayout_2.addWidget(self.score) + spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout_2.addItem(spacerItem6) + self.verticalLayout.addLayout(self.horizontalLayout_2) + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.label_4 = QtWidgets.QLabel(parent=battleDialog) self.label_4.setObjectName("label_4") - self.gridLayout.addWidget(self.label_4, 4, 0, 1, 1) - self.battleComment = QtWidgets.QPlainTextEdit(parent=battleResultDialog) + self.horizontalLayout_3.addWidget(self.label_4) + self.battleComment = QtWidgets.QPlainTextEdit(parent=battleDialog) self.battleComment.setObjectName("battleComment") - self.gridLayout.addWidget(self.battleComment, 4, 1, 1, 5) - self.buttonBox = QtWidgets.QDialogButtonBox(parent=battleResultDialog) + self.horizontalLayout_3.addWidget(self.battleComment) + self.verticalLayout.addLayout(self.horizontalLayout_3) + self.buttonBox = QtWidgets.QDialogButtonBox(parent=battleDialog) 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.gridLayout.addWidget(self.buttonBox, 5, 4, 1, 2) + self.verticalLayout.addWidget(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) + self.retranslateUi(battleDialog) + self.buttonBox.accepted.connect(battleDialog.accept) # type: ignore + self.buttonBox.rejected.connect(battleDialog.reject) # type: ignore + QtCore.QMetaObject.connectSlotsByName(battleDialog) - def retranslateUi(self, battleResultDialog): + def retranslateUi(self, battleDialog): _translate = QtCore.QCoreApplication.translate - battleResultDialog.setWindowTitle( - _translate("battleResultDialog", "Battle result") - ) - self.label_7.setText(_translate("battleResultDialog", "Sector")) - self.label_5.setText(_translate("battleResultDialog", "Player 1")) - self.label_6.setText(_translate("battleResultDialog", "Player 2")) - 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")) + battleDialog.setWindowTitle(_translate("battleDialog", "Battle result")) + self.label_7.setText(_translate("battleDialog", "Sector")) + self.label_5.setText(_translate("battleDialog", "Player 1")) + self.label_6.setText(_translate("battleDialog", "Player 2")) + self.label.setText(_translate("battleDialog", "Winner")) + self.label_3.setText(_translate("battleDialog", "Victory condition")) + self.label_2.setText(_translate("battleDialog", "Score")) + self.label_4.setText(_translate("battleDialog", "Comment")) if __name__ == "__main__": import sys - app = QtWidgets.QApplication(sys.argv) - battleResultDialog = QtWidgets.QDialog() - ui = Ui_battleResultDialog() - ui.setupUi(battleResultDialog) - battleResultDialog.show() + battleDialog = QtWidgets.QDialog() + ui = Ui_battleDialog() + ui.setupUi(battleDialog) + battleDialog.show() sys.exit(app.exec()) diff --git a/src/warchron/view/ui/ui_battle_dialog.ui b/src/warchron/view/ui/ui_battle_dialog.ui index 5a4bf2f..47c1ffb 100644 --- a/src/warchron/view/ui/ui_battle_dialog.ui +++ b/src/warchron/view/ui/ui_battle_dialog.ui @@ -1,7 +1,7 @@ - battleResultDialog - + battleDialog + Qt::ApplicationModal @@ -9,8 +9,8 @@ 0 0 - 668 - 317 + 771 + 315 @@ -20,59 +20,102 @@ ../resources/warchron_logo.png../resources/warchron_logo.png - - - - - Sector - - + + + + + + + Sector + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Player 1 + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Player 2 + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - - 0 - 0 - - - - - - - - Player 1 - - - - - - - - 0 - 0 - - - - - - - - Player 2 - - - - - - - - 0 - 0 - - - - - + Qt::Vertical @@ -85,54 +128,101 @@ - - - - Winner - - + + + + + + Winner + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Victory condition + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Score + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - - 0 - 0 - - - + + + + + + Comment + + + + + + + - - - - Score - - - - - - - - - - Victory condition - - - - - - - - - - Comment - - - - - - - + Qt::Horizontal @@ -149,7 +239,7 @@ buttonBox accepted() - battleResultDialog + battleDialog accept() @@ -165,7 +255,7 @@ buttonBox rejected() - battleResultDialog + battleDialog reject() diff --git a/src/warchron/view/ui/ui_choice_dialog.py b/src/warchron/view/ui/ui_choice_dialog.py index 19f7026..cffcef6 100644 --- a/src/warchron/view/ui/ui_choice_dialog.py +++ b/src/warchron/view/ui/ui_choice_dialog.py @@ -15,77 +15,58 @@ class Ui_choiceDialog(object): choiceDialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) choiceDialog.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, - ) + icon.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/warchron_logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) choiceDialog.setWindowIcon(icon) - self.gridLayout = QtWidgets.QGridLayout(choiceDialog) - self.gridLayout.setObjectName("gridLayout") + self.formLayout = QtWidgets.QFormLayout(choiceDialog) + self.formLayout.setObjectName("formLayout") self.label = QtWidgets.QLabel(parent=choiceDialog) self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) + self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label) self.playerComboBox = QtWidgets.QComboBox(parent=choiceDialog) - sizePolicy = QtWidgets.QSizePolicy( - QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed - ) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.playerComboBox.sizePolicy().hasHeightForWidth() - ) + sizePolicy.setHeightForWidth(self.playerComboBox.sizePolicy().hasHeightForWidth()) self.playerComboBox.setSizePolicy(sizePolicy) self.playerComboBox.setObjectName("playerComboBox") - self.gridLayout.addWidget(self.playerComboBox, 0, 1, 1, 1) + self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.playerComboBox) self.label_2 = QtWidgets.QLabel(parent=choiceDialog) self.label_2.setObjectName("label_2") - self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_2) self.priorityComboBox = QtWidgets.QComboBox(parent=choiceDialog) - sizePolicy = QtWidgets.QSizePolicy( - QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed - ) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.priorityComboBox.sizePolicy().hasHeightForWidth() - ) + sizePolicy.setHeightForWidth(self.priorityComboBox.sizePolicy().hasHeightForWidth()) self.priorityComboBox.setSizePolicy(sizePolicy) self.priorityComboBox.setObjectName("priorityComboBox") - self.gridLayout.addWidget(self.priorityComboBox, 1, 1, 1, 1) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.priorityComboBox) self.label_3 = QtWidgets.QLabel(parent=choiceDialog) self.label_3.setObjectName("label_3") - self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1) + self.formLayout.setWidget(2, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_3) self.secondaryComboBox = QtWidgets.QComboBox(parent=choiceDialog) - sizePolicy = QtWidgets.QSizePolicy( - QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed - ) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.secondaryComboBox.sizePolicy().hasHeightForWidth() - ) + sizePolicy.setHeightForWidth(self.secondaryComboBox.sizePolicy().hasHeightForWidth()) self.secondaryComboBox.setSizePolicy(sizePolicy) self.secondaryComboBox.setObjectName("secondaryComboBox") - self.gridLayout.addWidget(self.secondaryComboBox, 2, 1, 1, 1) + self.formLayout.setWidget(2, QtWidgets.QFormLayout.ItemRole.FieldRole, self.secondaryComboBox) self.label_4 = QtWidgets.QLabel(parent=choiceDialog) self.label_4.setObjectName("label_4") - self.gridLayout.addWidget(self.label_4, 3, 0, 1, 1) + self.formLayout.setWidget(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_4) self.choiceComment = QtWidgets.QPlainTextEdit(parent=choiceDialog) self.choiceComment.setObjectName("choiceComment") - self.gridLayout.addWidget(self.choiceComment, 3, 1, 1, 1) + self.formLayout.setWidget(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.choiceComment) self.buttonBox = QtWidgets.QDialogButtonBox(parent=choiceDialog) 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.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 2) + self.formLayout.setWidget(4, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.buttonBox) self.retranslateUi(choiceDialog) - self.buttonBox.accepted.connect(choiceDialog.accept) # type: ignore - self.buttonBox.rejected.connect(choiceDialog.reject) # type: ignore + self.buttonBox.accepted.connect(choiceDialog.accept) # type: ignore + self.buttonBox.rejected.connect(choiceDialog.reject) # type: ignore QtCore.QMetaObject.connectSlotsByName(choiceDialog) def retranslateUi(self, choiceDialog): @@ -99,7 +80,6 @@ class Ui_choiceDialog(object): if __name__ == "__main__": import sys - app = QtWidgets.QApplication(sys.argv) choiceDialog = QtWidgets.QDialog() ui = Ui_choiceDialog() diff --git a/src/warchron/view/ui/ui_choice_dialog.ui b/src/warchron/view/ui/ui_choice_dialog.ui index 1a604c4..a6eff58 100644 --- a/src/warchron/view/ui/ui_choice_dialog.ui +++ b/src/warchron/view/ui/ui_choice_dialog.ui @@ -20,7 +20,7 @@ ../resources/warchron_logo.png../resources/warchron_logo.png - + diff --git a/src/warchron/view/ui/ui_main_window.py b/src/warchron/view/ui/ui_main_window.py index a83afc4..9fe6722 100644 --- a/src/warchron/view/ui/ui_main_window.py +++ b/src/warchron/view/ui/ui_main_window.py @@ -29,9 +29,6 @@ class Ui_MainWindow(object): self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.addPlayerBtn = QtWidgets.QPushButton(parent=self.playersTab) - icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/plus.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.addPlayerBtn.setIcon(icon1) self.addPlayerBtn.setObjectName("addPlayerBtn") self.horizontalLayout.addWidget(self.addPlayerBtn) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) @@ -54,9 +51,7 @@ class Ui_MainWindow(object): self.playersTable.setHorizontalHeaderItem(3, item) self.playersTable.horizontalHeader().setStretchLastSection(False) self.gridLayout.addWidget(self.playersTable, 1, 0, 1, 1) - icon2 = QtGui.QIcon() - icon2.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/users.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.tabWidget.addTab(self.playersTab, icon2, "") + self.tabWidget.addTab(self.playersTab, "") self.warsTab = QtWidgets.QWidget() self.warsTab.setObjectName("warsTab") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.warsTab) @@ -64,17 +59,14 @@ class Ui_MainWindow(object): self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.addWarBtn = QtWidgets.QPushButton(parent=self.warsTab) - self.addWarBtn.setIcon(icon1) self.addWarBtn.setObjectName("addWarBtn") self.horizontalLayout_2.addWidget(self.addWarBtn) self.addCampaignBtn = QtWidgets.QPushButton(parent=self.warsTab) self.addCampaignBtn.setEnabled(False) - self.addCampaignBtn.setIcon(icon1) self.addCampaignBtn.setObjectName("addCampaignBtn") self.horizontalLayout_2.addWidget(self.addCampaignBtn) self.addRoundBtn = QtWidgets.QPushButton(parent=self.warsTab) self.addRoundBtn.setEnabled(False) - self.addRoundBtn.setIcon(icon1) self.addRoundBtn.setObjectName("addRoundBtn") self.horizontalLayout_2.addWidget(self.addRoundBtn) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) @@ -125,6 +117,9 @@ class Ui_MainWindow(object): self.horizontalLayout_8.addWidget(self.warYear) self.verticalLayout_10.addLayout(self.horizontalLayout_8) self.groupBox = QtWidgets.QGroupBox(parent=self.pageWar) + font = QtGui.QFont() + font.setPointSize(10) + self.groupBox.setFont(font) self.groupBox.setObjectName("groupBox") self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) self.verticalLayout.setObjectName("verticalLayout") @@ -132,10 +127,6 @@ class Ui_MainWindow(object): self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.addObjectiveBtn = QtWidgets.QPushButton(parent=self.groupBox) self.addObjectiveBtn.setEnabled(True) - font = QtGui.QFont() - font.setPointSize(10) - self.addObjectiveBtn.setFont(font) - self.addObjectiveBtn.setIcon(icon1) self.addObjectiveBtn.setObjectName("addObjectiveBtn") self.horizontalLayout_3.addWidget(self.addObjectiveBtn) spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) @@ -191,13 +182,15 @@ class Ui_MainWindow(object): self.verticalLayout.addWidget(self.objectivesTable) self.verticalLayout_10.addWidget(self.groupBox) self.groupBox_2 = QtWidgets.QGroupBox(parent=self.pageWar) + font = QtGui.QFont() + font.setPointSize(10) + self.groupBox_2.setFont(font) self.groupBox_2.setObjectName("groupBox_2") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_2) self.verticalLayout_2.setObjectName("verticalLayout_2") self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.addWarParticipantBtn = QtWidgets.QPushButton(parent=self.groupBox_2) - self.addWarParticipantBtn.setIcon(icon1) self.addWarParticipantBtn.setObjectName("addWarParticipantBtn") self.horizontalLayout_5.addWidget(self.addWarParticipantBtn) spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) @@ -229,9 +222,6 @@ class Ui_MainWindow(object): self.horizontalLayout_6.addItem(spacerItem10) self.endWarBtn = QtWidgets.QPushButton(parent=self.pageWar) self.endWarBtn.setEnabled(True) - icon3 = QtGui.QIcon() - icon3.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/flag-white.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.endWarBtn.setIcon(icon3) self.endWarBtn.setObjectName("endWarBtn") self.horizontalLayout_6.addWidget(self.endWarBtn) self.verticalLayout_10.addLayout(self.horizontalLayout_6) @@ -258,6 +248,9 @@ class Ui_MainWindow(object): self.horizontalLayout_11.addWidget(self.campaignMonth) self.verticalLayout_7.addLayout(self.horizontalLayout_11) self.groupBox_3 = QtWidgets.QGroupBox(parent=self.pageCampaign) + font = QtGui.QFont() + font.setPointSize(10) + self.groupBox_3.setFont(font) self.groupBox_3.setObjectName("groupBox_3") self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.groupBox_3) self.verticalLayout_5.setObjectName("verticalLayout_5") @@ -265,7 +258,6 @@ class Ui_MainWindow(object): self.horizontalLayout_17.setObjectName("horizontalLayout_17") self.addSectorBtn = QtWidgets.QPushButton(parent=self.groupBox_3) self.addSectorBtn.setEnabled(True) - self.addSectorBtn.setIcon(icon1) self.addSectorBtn.setObjectName("addSectorBtn") self.horizontalLayout_17.addWidget(self.addSectorBtn) spacerItem12 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) @@ -295,13 +287,15 @@ class Ui_MainWindow(object): self.verticalLayout_5.addWidget(self.sectorsTable) self.verticalLayout_7.addWidget(self.groupBox_3) self.groupBox_4 = QtWidgets.QGroupBox(parent=self.pageCampaign) + font = QtGui.QFont() + font.setPointSize(10) + self.groupBox_4.setFont(font) self.groupBox_4.setObjectName("groupBox_4") self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.groupBox_4) self.verticalLayout_6.setObjectName("verticalLayout_6") self.horizontalLayout_18 = QtWidgets.QHBoxLayout() self.horizontalLayout_18.setObjectName("horizontalLayout_18") self.addCampaignParticipantBtn = QtWidgets.QPushButton(parent=self.groupBox_4) - self.addCampaignParticipantBtn.setIcon(icon1) self.addCampaignParticipantBtn.setObjectName("addCampaignParticipantBtn") self.horizontalLayout_18.addWidget(self.addCampaignParticipantBtn) spacerItem13 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) @@ -332,7 +326,6 @@ class Ui_MainWindow(object): self.horizontalLayout_10.addItem(spacerItem14) self.endCampaignBtn = QtWidgets.QPushButton(parent=self.pageCampaign) self.endCampaignBtn.setEnabled(True) - self.endCampaignBtn.setIcon(icon3) self.endCampaignBtn.setObjectName("endCampaignBtn") self.horizontalLayout_10.addWidget(self.endCampaignBtn) self.verticalLayout_7.addLayout(self.horizontalLayout_10) @@ -351,6 +344,9 @@ class Ui_MainWindow(object): self.horizontalLayout_14.addWidget(self.roundNb) self.verticalLayout_8.addLayout(self.horizontalLayout_14) self.groupBox_5 = QtWidgets.QGroupBox(parent=self.pageRound) + font = QtGui.QFont() + font.setPointSize(10) + self.groupBox_5.setFont(font) self.groupBox_5.setObjectName("groupBox_5") self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.groupBox_5) self.horizontalLayout_4.setObjectName("horizontalLayout_4") @@ -376,13 +372,13 @@ class Ui_MainWindow(object): self.horizontalLayout_13.addItem(spacerItem15) self.resolvePairingBtn = QtWidgets.QPushButton(parent=self.pageRound) self.resolvePairingBtn.setEnabled(False) - icon4 = QtGui.QIcon() - icon4.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/arrow-switch.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.resolvePairingBtn.setIcon(icon4) self.resolvePairingBtn.setObjectName("resolvePairingBtn") self.horizontalLayout_13.addWidget(self.resolvePairingBtn) self.verticalLayout_8.addLayout(self.horizontalLayout_13) self.groupBox_6 = QtWidgets.QGroupBox(parent=self.pageRound) + font = QtGui.QFont() + font.setPointSize(10) + self.groupBox_6.setFont(font) self.groupBox_6.setObjectName("groupBox_6") self.horizontalLayout_12 = QtWidgets.QHBoxLayout(self.groupBox_6) self.horizontalLayout_12.setObjectName("horizontalLayout_12") @@ -413,19 +409,16 @@ class Ui_MainWindow(object): self.horizontalLayout_9.addItem(spacerItem16) self.endRoundBtn = QtWidgets.QPushButton(parent=self.pageRound) self.endRoundBtn.setEnabled(True) - self.endRoundBtn.setIcon(icon3) self.endRoundBtn.setObjectName("endRoundBtn") self.horizontalLayout_9.addWidget(self.endRoundBtn) self.verticalLayout_8.addLayout(self.horizontalLayout_9) self.selectedDetailsStack.addWidget(self.pageRound) self.verticalLayout_3.addWidget(self.splitter) - icon5 = QtGui.QIcon() - icon5.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/swords-small.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.tabWidget.addTab(self.warsTab, icon5, "") + self.tabWidget.addTab(self.warsTab, "") self.verticalLayout_9.addWidget(self.tabWidget) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(parent=MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1235, 22)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1235, 21)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(parent=self.menubar) self.menuFile.setObjectName("menuFile") @@ -438,52 +431,25 @@ class Ui_MainWindow(object): self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.actionNew = QtGui.QAction(parent=MainWindow) - icon6 = QtGui.QIcon() - icon6.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/document.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.actionNew.setIcon(icon6) self.actionNew.setObjectName("actionNew") self.actionOpen = QtGui.QAction(parent=MainWindow) - icon7 = QtGui.QIcon() - icon7.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/folder.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.actionOpen.setIcon(icon7) self.actionOpen.setObjectName("actionOpen") self.actionSave = QtGui.QAction(parent=MainWindow) - icon8 = QtGui.QIcon() - icon8.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/disk.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.actionSave.setIcon(icon8) self.actionSave.setObjectName("actionSave") self.actionExit = QtGui.QAction(parent=MainWindow) - icon9 = QtGui.QIcon() - icon9.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/door--arrow.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.actionExit.setIcon(icon9) self.actionExit.setObjectName("actionExit") self.actionUndo = QtGui.QAction(parent=MainWindow) self.actionUndo.setEnabled(False) - icon10 = QtGui.QIcon() - icon10.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/arrow-curve-180-left.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.actionUndo.setIcon(icon10) self.actionUndo.setObjectName("actionUndo") self.actionRedo = QtGui.QAction(parent=MainWindow) self.actionRedo.setEnabled(False) - icon11 = QtGui.QIcon() - icon11.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/arrow-curve.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.actionRedo.setIcon(icon11) self.actionRedo.setObjectName("actionRedo") self.actionAbout = QtGui.QAction(parent=MainWindow) - icon12 = QtGui.QIcon() - icon12.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/question.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.actionAbout.setIcon(icon12) self.actionAbout.setObjectName("actionAbout") self.actionExport = QtGui.QAction(parent=MainWindow) self.actionExport.setEnabled(False) - icon13 = QtGui.QIcon() - icon13.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/notebook--arrow.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.actionExport.setIcon(icon13) self.actionExport.setObjectName("actionExport") self.actionSave_as = QtGui.QAction(parent=MainWindow) - icon14 = QtGui.QIcon() - icon14.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/disk--pencil.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) - self.actionSave_as.setIcon(icon14) self.actionSave_as.setObjectName("actionSave_as") self.menuFile.addAction(self.actionNew) self.menuFile.addAction(self.actionOpen) @@ -604,9 +570,9 @@ class Ui_MainWindow(object): item = self.battlesTable.horizontalHeaderItem(2) item.setText(_translate("MainWindow", "Player 2")) item = self.battlesTable.horizontalHeaderItem(3) - item.setText(_translate("MainWindow", "Score")) - item = self.battlesTable.horizontalHeaderItem(4) item.setText(_translate("MainWindow", "Victory condition")) + item = self.battlesTable.horizontalHeaderItem(4) + item.setText(_translate("MainWindow", "Score")) item = self.battlesTable.horizontalHeaderItem(5) item.setText(_translate("MainWindow", "Comment")) self.endRoundBtn.setText(_translate("MainWindow", "End round")) diff --git a/src/warchron/view/ui/ui_main_window.ui b/src/warchron/view/ui/ui_main_window.ui index 54d1ca3..1039268 100644 --- a/src/warchron/view/ui/ui_main_window.ui +++ b/src/warchron/view/ui/ui_main_window.ui @@ -25,10 +25,6 @@ 1 - - - ../resources/users.png../resources/users.png - Players @@ -40,10 +36,6 @@ Add player - - - ../resources/plus.png../resources/plus.png - @@ -103,10 +95,6 @@ - - - ../resources/swords-small.png../resources/swords-small.png - Wars @@ -118,10 +106,6 @@ Add war - - - ../resources/plus.png../resources/plus.png - @@ -132,10 +116,6 @@ Add Campaign - - - ../resources/plus.png../resources/plus.png - @@ -146,10 +126,6 @@ Add Round - - - ../resources/plus.png../resources/plus.png - @@ -272,6 +248,11 @@ + + + 10 + + Objectives @@ -283,18 +264,9 @@ true - - - 10 - - Add objective - - - ../resources/plus.png../resources/plus.png - @@ -450,6 +422,11 @@ + + + 10 + + Participants @@ -461,10 +438,6 @@ Add participant - - - ../resources/plus.png../resources/plus.png - @@ -552,10 +525,6 @@ End war - - - ../resources/flag-white.png../resources/flag-white.png - @@ -607,6 +576,11 @@ + + + 10 + + Sectors @@ -621,10 +595,6 @@ Add Sector - - - ../resources/plus.png../resources/plus.png - @@ -698,6 +668,11 @@ + + + 10 + + Participants @@ -709,10 +684,6 @@ Add participant - - - ../resources/plus.png../resources/plus.png - @@ -797,10 +768,6 @@ End campaign - - - ../resources/flag-white.png../resources/flag-white.png - @@ -827,6 +794,11 @@ + + + 10 + + Choices @@ -891,16 +863,17 @@ Resolve pairing - - - ../resources/arrow-switch.png../resources/arrow-switch.png - + + + 10 + + Battles @@ -936,12 +909,12 @@ - Score + Victory condition - Victory condition + Score @@ -977,10 +950,6 @@ End round - - - ../resources/flag-white.png../resources/flag-white.png - @@ -1002,7 +971,7 @@ 0 0 1235 - 22 + 21 @@ -1037,10 +1006,6 @@ - - - ../resources/document.png../resources/document.png - New @@ -1049,10 +1014,6 @@ - - - ../resources/folder.png../resources/folder.png - Open @@ -1061,10 +1022,6 @@ - - - ../resources/disk.png../resources/disk.png - Save @@ -1073,10 +1030,6 @@ - - - ../resources/door--arrow.png../resources/door--arrow.png - Exit @@ -1088,10 +1041,6 @@ false - - - ../resources/arrow-curve-180-left.png../resources/arrow-curve-180-left.png - Undo @@ -1103,10 +1052,6 @@ false - - - ../resources/arrow-curve.png../resources/arrow-curve.png - Redo @@ -1115,10 +1060,6 @@ - - - ../resources/question.png../resources/question.png - About @@ -1127,19 +1068,11 @@ false - - - ../resources/notebook--arrow.png../resources/notebook--arrow.png - Export - - - ../resources/disk--pencil.png../resources/disk--pencil.png - Save as... diff --git a/src/warchron/view/ui/ui_objective_dialog.py b/src/warchron/view/ui/ui_objective_dialog.py index 6892af6..b0a5001 100644 --- a/src/warchron/view/ui/ui_objective_dialog.py +++ b/src/warchron/view/ui/ui_objective_dialog.py @@ -17,25 +17,25 @@ class Ui_objectiveDialog(object): icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/warchron_logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) objectiveDialog.setWindowIcon(icon) - self.gridLayout = QtWidgets.QGridLayout(objectiveDialog) - self.gridLayout.setObjectName("gridLayout") + self.formLayout = QtWidgets.QFormLayout(objectiveDialog) + self.formLayout.setObjectName("formLayout") self.label = QtWidgets.QLabel(parent=objectiveDialog) self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) + self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label) self.objectiveName = QtWidgets.QLineEdit(parent=objectiveDialog) self.objectiveName.setObjectName("objectiveName") - self.gridLayout.addWidget(self.objectiveName, 0, 1, 1, 1) + self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.objectiveName) self.label_2 = QtWidgets.QLabel(parent=objectiveDialog) self.label_2.setObjectName("label_2") - self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_2) self.objectiveDescription = QtWidgets.QTextEdit(parent=objectiveDialog) self.objectiveDescription.setObjectName("objectiveDescription") - self.gridLayout.addWidget(self.objectiveDescription, 1, 1, 1, 1) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.objectiveDescription) self.buttonBox = QtWidgets.QDialogButtonBox(parent=objectiveDialog) 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, 2, 0, 1, 2) + self.formLayout.setWidget(2, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.buttonBox) self.retranslateUi(objectiveDialog) self.buttonBox.accepted.connect(objectiveDialog.accept) # type: ignore diff --git a/src/warchron/view/ui/ui_objective_dialog.ui b/src/warchron/view/ui/ui_objective_dialog.ui index 28b0d52..84577e7 100644 --- a/src/warchron/view/ui/ui_objective_dialog.ui +++ b/src/warchron/view/ui/ui_objective_dialog.ui @@ -20,7 +20,7 @@ ../resources/warchron_logo.png../resources/warchron_logo.png - + diff --git a/src/warchron/view/ui/ui_sector_dialog.py b/src/warchron/view/ui/ui_sector_dialog.py index 612be65..fae3035 100644 --- a/src/warchron/view/ui/ui_sector_dialog.py +++ b/src/warchron/view/ui/ui_sector_dialog.py @@ -13,33 +13,34 @@ class Ui_sectorDialog(object): def setupUi(self, sectorDialog): sectorDialog.setObjectName("sectorDialog") sectorDialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) - sectorDialog.resize(602, 338) + sectorDialog.resize(888, 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) - self.gridLayout = QtWidgets.QGridLayout(sectorDialog) - self.gridLayout.setObjectName("gridLayout") + self.verticalLayout_5 = QtWidgets.QVBoxLayout(sectorDialog) + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.horizontalLayout_6 = QtWidgets.QHBoxLayout() + self.horizontalLayout_6.setObjectName("horizontalLayout_6") + self.verticalLayout_4 = QtWidgets.QVBoxLayout() + self.verticalLayout_4.setObjectName("verticalLayout_4") self.label_2 = QtWidgets.QLabel(parent=sectorDialog) self.label_2.setObjectName("label_2") - self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1) + self.verticalLayout_4.addWidget(self.label_2) + self.label = QtWidgets.QLabel(parent=sectorDialog) + self.label.setObjectName("label") + self.verticalLayout_4.addWidget(self.label) + self.label_7 = QtWidgets.QLabel(parent=sectorDialog) + self.label_7.setObjectName("label_7") + self.verticalLayout_4.addWidget(self.label_7) + self.horizontalLayout_6.addLayout(self.verticalLayout_4) + self.verticalLayout_3 = QtWidgets.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") self.sectorName = QtWidgets.QLineEdit(parent=sectorDialog) self.sectorName.setText("") self.sectorName.setObjectName("sectorName") - self.gridLayout.addWidget(self.sectorName, 0, 1, 1, 1) - self.label_3 = QtWidgets.QLabel(parent=sectorDialog) - self.label_3.setObjectName("label_3") - self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1) - self.majorComboBox = QtWidgets.QComboBox(parent=sectorDialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.majorComboBox.sizePolicy().hasHeightForWidth()) - self.majorComboBox.setSizePolicy(sizePolicy) - self.majorComboBox.setObjectName("majorComboBox") - self.gridLayout.addWidget(self.majorComboBox, 0, 3, 1, 1) - self.label = QtWidgets.QLabel(parent=sectorDialog) - self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 1, 0, 1, 1) + self.verticalLayout_3.addWidget(self.sectorName) self.roundComboBox = QtWidgets.QComboBox(parent=sectorDialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -47,10 +48,39 @@ class Ui_sectorDialog(object): sizePolicy.setHeightForWidth(self.roundComboBox.sizePolicy().hasHeightForWidth()) self.roundComboBox.setSizePolicy(sizePolicy) self.roundComboBox.setObjectName("roundComboBox") - self.gridLayout.addWidget(self.roundComboBox, 1, 1, 1, 1) + self.verticalLayout_3.addWidget(self.roundComboBox) + self.sectorMission = QtWidgets.QLineEdit(parent=sectorDialog) + self.sectorMission.setText("") + self.sectorMission.setObjectName("sectorMission") + self.verticalLayout_3.addWidget(self.sectorMission) + self.horizontalLayout_6.addLayout(self.verticalLayout_3) + self.horizontalLayout.addLayout(self.horizontalLayout_6) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.horizontalLayout_5 = QtWidgets.QHBoxLayout() + self.horizontalLayout_5.setObjectName("horizontalLayout_5") + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.label_3 = QtWidgets.QLabel(parent=sectorDialog) + self.label_3.setObjectName("label_3") + self.verticalLayout_2.addWidget(self.label_3) self.label_4 = QtWidgets.QLabel(parent=sectorDialog) self.label_4.setObjectName("label_4") - self.gridLayout.addWidget(self.label_4, 1, 2, 1, 1) + self.verticalLayout_2.addWidget(self.label_4) + self.label_5 = QtWidgets.QLabel(parent=sectorDialog) + self.label_5.setObjectName("label_5") + self.verticalLayout_2.addWidget(self.label_5) + self.horizontalLayout_5.addLayout(self.verticalLayout_2) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.majorComboBox = QtWidgets.QComboBox(parent=sectorDialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.majorComboBox.sizePolicy().hasHeightForWidth()) + self.majorComboBox.setSizePolicy(sizePolicy) + self.majorComboBox.setObjectName("majorComboBox") + self.verticalLayout.addWidget(self.majorComboBox) self.minorComboBox = QtWidgets.QComboBox(parent=sectorDialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -58,17 +88,7 @@ class Ui_sectorDialog(object): sizePolicy.setHeightForWidth(self.minorComboBox.sizePolicy().hasHeightForWidth()) 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) + self.verticalLayout.addWidget(self.minorComboBox) self.influenceComboBox = QtWidgets.QComboBox(parent=sectorDialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -76,18 +96,26 @@ class Ui_sectorDialog(object): sizePolicy.setHeightForWidth(self.influenceComboBox.sizePolicy().hasHeightForWidth()) self.influenceComboBox.setSizePolicy(sizePolicy) self.influenceComboBox.setObjectName("influenceComboBox") - self.gridLayout.addWidget(self.influenceComboBox, 2, 3, 1, 1) + self.verticalLayout.addWidget(self.influenceComboBox) + self.horizontalLayout_5.addLayout(self.verticalLayout) + self.horizontalLayout.addLayout(self.horizontalLayout_5) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout.addItem(spacerItem1) + self.verticalLayout_5.addLayout(self.horizontalLayout) + self.horizontalLayout_4 = QtWidgets.QHBoxLayout() + self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.label_6 = QtWidgets.QLabel(parent=sectorDialog) self.label_6.setObjectName("label_6") - self.gridLayout.addWidget(self.label_6, 3, 0, 1, 1) + self.horizontalLayout_4.addWidget(self.label_6) self.sectorDescription = QtWidgets.QPlainTextEdit(parent=sectorDialog) self.sectorDescription.setObjectName("sectorDescription") - self.gridLayout.addWidget(self.sectorDescription, 3, 1, 1, 3) + self.horizontalLayout_4.addWidget(self.sectorDescription) + self.verticalLayout_5.addLayout(self.horizontalLayout_4) 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, 4, 2, 1, 2) + self.verticalLayout_5.addWidget(self.buttonBox) self.retranslateUi(sectorDialog) self.buttonBox.accepted.connect(sectorDialog.accept) # type: ignore @@ -98,10 +126,10 @@ class Ui_sectorDialog(object): _translate = QtCore.QCoreApplication.translate sectorDialog.setWindowTitle(_translate("sectorDialog", "Sector")) self.label_2.setText(_translate("sectorDialog", "Name")) - 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_3.setText(_translate("sectorDialog", "Major objective")) + self.label_4.setText(_translate("sectorDialog", "Minor opportunity")) self.label_5.setText(_translate("sectorDialog", "Influence")) self.label_6.setText(_translate("sectorDialog", "Description")) diff --git a/src/warchron/view/ui/ui_sector_dialog.ui b/src/warchron/view/ui/ui_sector_dialog.ui index 10bf9e6..86146cc 100644 --- a/src/warchron/view/ui/ui_sector_dialog.ui +++ b/src/warchron/view/ui/ui_sector_dialog.ui @@ -9,7 +9,7 @@ 0 0 - 602 + 888 338 @@ -20,114 +20,172 @@ ../resources/warchron_logo.png../resources/warchron_logo.png - - - - - Name - - + + + + + + + + + + + Name + + + + + + + Round + + + + + + + Mission + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Major objective + + + + + + + Minor opportunity + + + + + + + Influence + + + + + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - - - + + + + + + Description + + + + + + + - - - - Major objective - - - - - - - - 0 - 0 - - - - - - - - Round - - - - - - - - 0 - 0 - - - - - - - - Minor opportunity - - - - - - - - 0 - 0 - - - - - - - - Mission - - - - - - - - - - - - - - Influence - - - - - - - - 0 - 0 - - - - - - - - Description - - - - - - - + Qt::Horizontal diff --git a/src/warchron/view/ui/ui_war_dialog.py b/src/warchron/view/ui/ui_war_dialog.py index ed59c38..1d83655 100644 --- a/src/warchron/view/ui/ui_war_dialog.py +++ b/src/warchron/view/ui/ui_war_dialog.py @@ -17,27 +17,27 @@ class Ui_warDialog(object): icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(".\\src\\warchron\\view\\ui\\../resources/warchron_logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) warDialog.setWindowIcon(icon) - self.gridLayout = QtWidgets.QGridLayout(warDialog) - self.gridLayout.setObjectName("gridLayout") + self.formLayout = QtWidgets.QFormLayout(warDialog) + self.formLayout.setObjectName("formLayout") self.label = QtWidgets.QLabel(parent=warDialog) self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) + self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label) self.warName = QtWidgets.QLineEdit(parent=warDialog) self.warName.setObjectName("warName") - self.gridLayout.addWidget(self.warName, 0, 1, 1, 1) + self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.warName) self.label_2 = QtWidgets.QLabel(parent=warDialog) self.label_2.setObjectName("label_2") - self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_2) self.warYear = QtWidgets.QSpinBox(parent=warDialog) self.warYear.setMinimum(1970) self.warYear.setMaximum(3000) self.warYear.setObjectName("warYear") - self.gridLayout.addWidget(self.warYear, 1, 1, 1, 1) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.warYear) self.buttonBox = QtWidgets.QDialogButtonBox(parent=warDialog) 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, 2, 0, 1, 2) + self.formLayout.setWidget(2, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.buttonBox) self.retranslateUi(warDialog) self.buttonBox.accepted.connect(warDialog.accept) # type: ignore diff --git a/src/warchron/view/ui/ui_war_dialog.ui b/src/warchron/view/ui/ui_war_dialog.ui index b8fe0f9..a7c6f0d 100644 --- a/src/warchron/view/ui/ui_war_dialog.ui +++ b/src/warchron/view/ui/ui_war_dialog.ui @@ -20,7 +20,7 @@ ../resources/warchron_logo.png../resources/warchron_logo.png - + diff --git a/src/warchron/view/view.py b/src/warchron/view/view.py index 005c090..caf73ae 100644 --- a/src/warchron/view/view.py +++ b/src/warchron/view/view.py @@ -1,3 +1,4 @@ +from __future__ import annotations from typing import Callable, List from pathlib import Path import calendar @@ -5,9 +6,9 @@ import calendar from PyQt6 import QtWidgets from PyQt6.QtCore import Qt, QPoint from PyQt6.QtWidgets import QWidget, QFileDialog, QTreeWidgetItem, QMenu -from PyQt6.QtGui import QCloseEvent, QIcon +from PyQt6.QtGui import QCloseEvent -from warchron.constants import ROLE_TYPE, ROLE_ID, ItemType +from warchron.constants import ROLE_TYPE, ROLE_ID, ItemType, Icons, IconName from warchron.controller.dtos import ( ParticipantOption, TreeSelection, @@ -56,6 +57,7 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): ) 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 @@ -89,6 +91,37 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): ) self.majorValue.valueChanged.connect(self._on_major_changed) self.minorValue.valueChanged.connect(self._on_minor_changed) + self._apply_icons() + + def _apply_icons(self) -> None: + # Window + self.setWindowIcon(Icons.get(IconName.WARCHRON)) + # Menu bar + self.actionNew.setIcon(Icons.get(IconName.NEW)) + self.actionOpen.setIcon(Icons.get(IconName.OPEN)) + self.actionSave.setIcon(Icons.get(IconName.SAVE)) + self.actionSave_as.setIcon(Icons.get(IconName.SAVE_AS)) + self.actionExit.setIcon(Icons.get(IconName.EXIT)) + self.actionUndo.setIcon(Icons.get(IconName.UNDO)) + self.actionRedo.setIcon(Icons.get(IconName.REDO)) + self.actionExport.setIcon(Icons.get(IconName.EXPORT)) + self.actionAbout.setIcon(Icons.get(IconName.ABOUT)) + # Tabs + self.tabWidget.setTabIcon(0, Icons.get(IconName.PLAYERS)) + self.tabWidget.setTabIcon(1, Icons.get(IconName.WARS)) + # Buttons + self.addPlayerBtn.setIcon(Icons.get(IconName.ADD)) + self.addWarBtn.setIcon(Icons.get(IconName.ADD)) + self.addCampaignBtn.setIcon(Icons.get(IconName.ADD)) + self.addRoundBtn.setIcon(Icons.get(IconName.ADD)) + self.addObjectiveBtn.setIcon(Icons.get(IconName.ADD)) + self.addWarParticipantBtn.setIcon(Icons.get(IconName.ADD)) + self.endWarBtn.setIcon(Icons.get(IconName.END)) + self.addSectorBtn.setIcon(Icons.get(IconName.ADD)) + self.addCampaignParticipantBtn.setIcon(Icons.get(IconName.ADD)) + self.endCampaignBtn.setIcon(Icons.get(IconName.END)) + self.resolvePairingBtn.setIcon(Icons.get(IconName.PAIRING)) + self.endRoundBtn.setIcon(Icons.get(IconName.END)) def _emit_selection_changed(self, current: QTreeWidgetItem | None) -> None: if not self.on_tree_selection_changed: @@ -147,12 +180,8 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): return player_id = name_item.data(Qt.ItemDataRole.UserRole) menu = QMenu(self) - edit_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/pencil.png"), "Edit" - ) - delete_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/cross.png"), "Delete" - ) + edit_action = menu.addAction(Icons.get(IconName.EDIT), "Edit") + delete_action = menu.addAction(Icons.get(IconName.DELETE), "Delete") viewport = self.playersTable.viewport() assert viewport is not None action = menu.exec(viewport.mapToGlobal(pos)) @@ -195,12 +224,8 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): menu = QMenu(self) edit_action = None if item_type != ItemType.ROUND: - edit_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/pencil.png"), "Edit" - ) - delete_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/cross.png"), "Delete" - ) + edit_action = menu.addAction(Icons.get(IconName.EDIT), "Edit") + delete_action = menu.addAction(Icons.get(IconName.DELETE), "Delete") viewport = self.warsTree.viewport() assert viewport is not None action = menu.exec(viewport.mapToGlobal(pos)) @@ -216,18 +241,23 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): tree.clear() tree.setColumnCount(1) tree.setHeaderLabels(["Wars"]) + hourglass = Icons.get(IconName.ONGOING) + check = Icons.get(IconName.DONE) for war in wars: war_item = QTreeWidgetItem([format_war_label(war)]) + war_item.setIcon(0, check if war.is_over else hourglass) war_item.setData(0, ROLE_TYPE, ItemType.WAR) war_item.setData(0, ROLE_ID, war.id) tree.addTopLevelItem(war_item) for camp in war.get_all_campaigns(): camp_item = QTreeWidgetItem([format_campaign_label(camp)]) + camp_item.setIcon(0, check if camp.is_over else hourglass) camp_item.setData(0, ROLE_TYPE, ItemType.CAMPAIGN) camp_item.setData(0, ROLE_ID, camp.id) war_item.addChild(camp_item) for index, rnd in enumerate(camp.get_all_rounds(), start=1): rnd_item = QTreeWidgetItem([format_round_label(index)]) + rnd_item.setIcon(0, check if rnd.is_over else hourglass) rnd_item.setData(0, ROLE_TYPE, ItemType.ROUND) rnd_item.setData(0, ROLE_ID, rnd.id) camp_item.addChild(rnd_item) @@ -283,12 +313,8 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): return objective_id = name_item.data(Qt.ItemDataRole.UserRole) menu = QMenu(self) - edit_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/pencil.png"), "Edit" - ) - delete_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/cross.png"), "Delete" - ) + edit_action = menu.addAction(Icons.get(IconName.EDIT), "Edit") + delete_action = menu.addAction(Icons.get(IconName.DELETE), "Delete") viewport = self.objectivesTable.viewport() assert viewport is not None action = menu.exec(viewport.mapToGlobal(pos)) @@ -307,12 +333,8 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): return participant_id = name_item.data(Qt.ItemDataRole.UserRole) menu = QMenu(self) - edit_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/pencil.png"), "Edit" - ) - delete_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/cross.png"), "Delete" - ) + edit_action = menu.addAction(Icons.get(IconName.EDIT), "Edit") + delete_action = menu.addAction(Icons.get(IconName.DELETE), "Delete") viewport = self.warParticipantsTable.viewport() assert viewport is not None action = menu.exec(viewport.mapToGlobal(pos)) @@ -380,12 +402,8 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): return sector_id = name_item.data(Qt.ItemDataRole.UserRole) menu = QMenu(self) - edit_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/pencil.png"), "Edit" - ) - delete_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/cross.png"), "Delete" - ) + edit_action = menu.addAction(Icons.get(IconName.EDIT), "Edit") + delete_action = menu.addAction(Icons.get(IconName.DELETE), "Delete") viewport = self.sectorsTable.viewport() assert viewport is not None action = menu.exec(viewport.mapToGlobal(pos)) @@ -404,12 +422,8 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): return participant_id = name_item.data(Qt.ItemDataRole.UserRole) menu = QMenu(self) - edit_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/pencil.png"), "Edit" - ) - delete_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/cross.png"), "Delete" - ) + edit_action = menu.addAction(Icons.get(IconName.EDIT), "Edit") + delete_action = menu.addAction(Icons.get(IconName.DELETE), "Delete") viewport = self.campaignParticipantsTable.viewport() assert viewport is not None action = menu.exec(viewport.mapToGlobal(pos)) @@ -476,9 +490,7 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): if choice_id is None: return menu = QMenu(self) - edit_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/pencil.png"), "Edit" - ) + edit_action = menu.addAction(Icons.get(IconName.EDIT), "Edit") viewport = self.choicesTable.viewport() assert viewport is not None action = menu.exec(viewport.mapToGlobal(pos)) @@ -497,9 +509,7 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): if battle_id is None: return menu = QMenu(self) - edit_action = menu.addAction( - QIcon(".\\src\\warchron\\view\\ui\\../resources/pencil.png"), "Edit" - ) + edit_action = menu.addAction(Icons.get(IconName.EDIT), "Edit") viewport = self.battlesTable.viewport() assert viewport is not None action = menu.exec(viewport.mapToGlobal(pos)) @@ -530,13 +540,13 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): for row, battle in enumerate(sectors): sector_item = QtWidgets.QTableWidgetItem(battle.sector_name) if battle.state_icon: - sector_item.setIcon(QIcon(battle.state_icon)) + sector_item.setIcon(battle.state_icon) player_1_item = QtWidgets.QTableWidgetItem(battle.player_1) if battle.player1_icon: - player_1_item.setIcon(QIcon(battle.player1_icon)) + player_1_item.setIcon(battle.player1_icon) player_2_item = QtWidgets.QTableWidgetItem(battle.player_2) if battle.player2_icon: - player_2_item.setIcon(QIcon(battle.player2_icon)) + player_2_item.setIcon(battle.player2_icon) score_item = QtWidgets.QTableWidgetItem(battle.score) vp_item = QtWidgets.QTableWidgetItem(battle.victory_condition) comment_item = QtWidgets.QTableWidgetItem(battle.comment) @@ -544,7 +554,7 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow): table.setItem(row, 0, sector_item) table.setItem(row, 1, player_1_item) table.setItem(row, 2, player_2_item) - table.setItem(row, 3, score_item) - table.setItem(row, 4, vp_item) + table.setItem(row, 3, vp_item) + table.setItem(row, 4, score_item) table.setItem(row, 5, comment_item) table.resizeColumnsToContents() diff --git a/src/warchron/view/war_dialog.py b/src/warchron/view/war_dialog.py index 3d17a3f..084166f 100644 --- a/src/warchron/view/war_dialog.py +++ b/src/warchron/view/war_dialog.py @@ -1,5 +1,6 @@ from PyQt6.QtWidgets import QWidget, QDialog +from warchron.constants import Icons, IconName from warchron.view.ui.ui_war_dialog import Ui_warDialog @@ -16,6 +17,7 @@ class WarDialog(QDialog): self.ui.warName.setText(default_name) if default_year is not None: self.ui.warYear.setValue(default_year) + self.setWindowIcon(Icons.get(IconName.WARCHRON)) def get_war_name(self) -> str: return self.ui.warName.text().strip() diff --git a/src/warchron/view/war_participant_dialog.py b/src/warchron/view/war_participant_dialog.py index 9718602..fbe588b 100644 --- a/src/warchron/view/war_participant_dialog.py +++ b/src/warchron/view/war_participant_dialog.py @@ -2,6 +2,7 @@ from typing import cast, List from PyQt6.QtWidgets import QWidget, QDialog +from warchron.constants import Icons, IconName from warchron.controller.dtos import ParticipantOption from warchron.view.helpers import select_if_exists from warchron.view.ui.ui_war_participant_dialog import Ui_warParticipantDialog @@ -25,6 +26,7 @@ class WarParticipantDialog(QDialog): select_if_exists(self.ui.playerComboBox, default_player_id) self.ui.playerComboBox.setEnabled(editable_player) self.ui.faction.setText(default_faction) + self.setWindowIcon(Icons.get(IconName.WARCHRON)) def get_player_id(self) -> str: return cast(str, self.ui.playerComboBox.currentData())