fix propagate player update to participant views
This commit is contained in:
parent
7792a76f8e
commit
dd886802f4
6 changed files with 24 additions and 21 deletions
|
|
@ -157,22 +157,22 @@ class AppController:
|
|||
)
|
||||
elif item_type == ItemType.OBJECTIVE:
|
||||
self.wars.edit_objective(item_id)
|
||||
self.navigation.refresh(RefreshScope.WAR_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
elif item_type == ItemType.WAR_PARTICIPANT:
|
||||
self.wars.edit_war_participant(item_id)
|
||||
self.navigation.refresh(RefreshScope.WAR_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
elif item_type == ItemType.SECTOR:
|
||||
self.campaigns.edit_sector(item_id)
|
||||
self.navigation.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
elif item_type == ItemType.CAMPAIGN_PARTICIPANT:
|
||||
self.campaigns.edit_campaign_participant(item_id)
|
||||
self.navigation.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
elif item_type == ItemType.CHOICE:
|
||||
self.rounds.edit_round_choice(item_id)
|
||||
self.navigation.refresh(RefreshScope.ROUND_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
elif item_type == ItemType.BATTLE:
|
||||
self.rounds.edit_round_battle(item_id)
|
||||
self.navigation.refresh(RefreshScope.ROUND_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
self.is_dirty = True
|
||||
except UpdateRequiresConfirmation as e:
|
||||
reply = QMessageBox.question(
|
||||
|
|
@ -183,7 +183,7 @@ class AppController:
|
|||
)
|
||||
if reply == QMessageBox.StandardButton.Yes:
|
||||
e.apply_update()
|
||||
self.navigation.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
|
||||
def delete_item(self, item_type: str, item_id: str) -> None:
|
||||
reply = QMessageBox.question(
|
||||
|
|
@ -210,16 +210,16 @@ class AppController:
|
|||
)
|
||||
elif item_type == ItemType.OBJECTIVE:
|
||||
self.model.remove_objective(item_id)
|
||||
self.navigation.refresh(RefreshScope.WAR_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
elif item_type == ItemType.WAR_PARTICIPANT:
|
||||
self.model.remove_war_participant(item_id)
|
||||
self.navigation.refresh(RefreshScope.WAR_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
elif item_type == ItemType.SECTOR:
|
||||
self.model.remove_sector(item_id)
|
||||
self.navigation.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
elif item_type == ItemType.CAMPAIGN_PARTICIPANT:
|
||||
self.model.remove_campaign_participant(item_id)
|
||||
self.navigation.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
elif item_type == ItemType.ROUND:
|
||||
camp = self.model.get_campaign_by_round(item_id)
|
||||
camp_id = camp.id
|
||||
|
|
@ -243,4 +243,4 @@ class AppController:
|
|||
)
|
||||
if reply == QMessageBox.StandardButton.Yes:
|
||||
e.cleanup_action()
|
||||
self.navigation.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||
self.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class CampaignController:
|
|||
self.app.navigation.selected_campaign_id, player_id, leader, theme
|
||||
)
|
||||
self.app.is_dirty = True
|
||||
self.app.navigation.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
|
||||
def edit_campaign_participant(self, participant_id: str) -> None:
|
||||
camp_part = self.app.model.get_campaign_participant(participant_id)
|
||||
|
|
@ -198,7 +198,7 @@ class CampaignController:
|
|||
influence_id,
|
||||
)
|
||||
self.app.is_dirty = True
|
||||
self.app.navigation.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
|
||||
def edit_sector(self, sector_id: str) -> None:
|
||||
sect = self.app.model.get_sector(sector_id)
|
||||
|
|
|
|||
|
|
@ -59,18 +59,18 @@ class NavigationController:
|
|||
self.app.navigation.refresh_players_view()
|
||||
case RefreshScope.WARS_TREE:
|
||||
self.app.navigation.refresh_wars_view()
|
||||
case RefreshScope.WAR_DETAILS:
|
||||
case RefreshScope.CURRENT_SELECTION_DETAILS:
|
||||
if self.selected_war_id:
|
||||
self.app.view.show_details(ItemType.WAR)
|
||||
self.app.wars._fill_war_details(self.selected_war_id)
|
||||
case RefreshScope.CAMPAIGN_DETAILS:
|
||||
if self.selected_campaign_id:
|
||||
elif self.selected_campaign_id:
|
||||
self.app.view.show_details(ItemType.CAMPAIGN)
|
||||
self.app.campaigns._fill_campaign_details(self.selected_campaign_id)
|
||||
case RefreshScope.ROUND_DETAILS:
|
||||
if self.selected_round_id:
|
||||
elif self.selected_round_id:
|
||||
self.app.view.show_details(ItemType.ROUND)
|
||||
self.app.rounds._fill_round_details(self.selected_round_id)
|
||||
else:
|
||||
self.app.view.show_details(None)
|
||||
self.app.update_window_title()
|
||||
|
||||
def refresh_and_select(
|
||||
|
|
|
|||
|
|
@ -40,3 +40,5 @@ class PlayerController:
|
|||
if not self._validate_player_inputs(name):
|
||||
return
|
||||
self.app.model.update_player(player_id, name=name)
|
||||
# Propagate update to participants
|
||||
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class WarController:
|
|||
self.app.navigation.selected_war_id, name, description
|
||||
)
|
||||
self.app.is_dirty = True
|
||||
self.app.navigation.refresh(RefreshScope.WAR_DETAILS)
|
||||
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
|
||||
def edit_objective(self, objective_id: str) -> None:
|
||||
obj = self.app.model.get_objective(objective_id)
|
||||
|
|
@ -143,7 +143,7 @@ class WarController:
|
|||
self.app.navigation.selected_war_id, player_id, faction
|
||||
)
|
||||
self.app.is_dirty = True
|
||||
self.app.navigation.refresh(RefreshScope.WAR_DETAILS)
|
||||
self.app.navigation.refresh(RefreshScope.CURRENT_SELECTION_DETAILS)
|
||||
|
||||
def edit_war_participant(self, participant_id: str) -> None:
|
||||
war_part = self.app.model.get_war_participant(participant_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue