fix inluence_token setting auto cleanup and fix is_dirty

This commit is contained in:
Maxime Réaux 2026-02-24 15:40:24 +01:00
parent 789756d586
commit 3c54a8d4a7
5 changed files with 114 additions and 18 deletions

View file

@ -11,7 +11,11 @@ from warchron.constants import (
IconName,
RANK_TO_ICON,
)
from warchron.model.exception import DomainError, ForbiddenOperation
from warchron.model.exception import (
DomainError,
ForbiddenOperation,
RequiresConfirmation,
)
if TYPE_CHECKING:
from warchron.controller.app_controller import AppController
@ -152,9 +156,10 @@ class WarController:
except DomainError as e:
QMessageBox.warning(
self.app.view,
"Deletion forbidden",
"Closure forbidden",
str(e),
)
return
self.app.is_dirty = True
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
self.app.navigation.refresh_and_select(
@ -200,6 +205,7 @@ class WarController:
"Setting forbidden",
str(e),
)
return
self.app.is_dirty = True
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
@ -215,6 +221,7 @@ class WarController:
"Setting forbidden",
str(e),
)
return
self.app.is_dirty = True
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
@ -230,8 +237,23 @@ class WarController:
"Setting forbidden",
str(e),
)
return
except RequiresConfirmation as e:
reply = QMessageBox.question(
self.app.view,
"Confirm update",
str(e),
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,
)
if reply == QMessageBox.StandardButton.Yes:
e.action()
else:
return
self.app.is_dirty = True
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
self.app.navigation.refresh_and_select(
RefreshScope.WARS_TREE, item_type=ItemType.WAR, item_id=war_id
)
# Objective methods