show is_over in warsTree & fator resources paths

This commit is contained in:
Maxime Réaux 2026-02-12 15:12:28 +01:00
parent a9cd4c9e27
commit d869017646
28 changed files with 783 additions and 628 deletions

View file

@ -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] = [

View file

@ -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

View file

@ -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()
],
)

View file

@ -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

View file

@ -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