exceptions adding in closed elements

This commit is contained in:
Maxime Réaux 2026-02-13 15:44:28 +01:00
parent 88bd28e949
commit a2b6c7c684
10 changed files with 179 additions and 82 deletions

View file

@ -3,6 +3,7 @@ from typing import List, TYPE_CHECKING
from PyQt6.QtWidgets import QDialog, QMessageBox
from warchron.constants import ItemType, RefreshScope, Icons, IconName
from warchron.model.round import Round
if TYPE_CHECKING:
from warchron.controller.app_controller import AppController
@ -111,14 +112,11 @@ class RoundController:
self.app.view.display_round_battles(battles_for_display)
self.app.view.endRoundBtn.setEnabled(not rnd.is_over)
def add_round(self) -> None:
if not self.app.navigation.selected_campaign_id:
return
rnd = self.app.model.add_round(self.app.navigation.selected_campaign_id)
self.app.is_dirty = True
self.app.navigation.refresh_and_select(
RefreshScope.WARS_TREE, item_type=ItemType.ROUND, item_id=rnd.id
)
def create_round(self) -> Round | None:
campaign_id = self.app.navigation.selected_campaign_id
if not campaign_id:
return None
return self.app.model.add_round(campaign_id)
def close_round(self) -> None:
round_id = self.app.navigation.selected_round_id