display tokens in participant tables
This commit is contained in:
parent
71e987304b
commit
81626171c8
4 changed files with 18 additions and 4 deletions
|
|
@ -111,6 +111,7 @@ class CampaignController:
|
||||||
theme=camp_part.theme or "",
|
theme=camp_part.theme or "",
|
||||||
victory_points=score.victory_points,
|
victory_points=score.victory_points,
|
||||||
narrative_points=dict(score.narrative_points),
|
narrative_points=dict(score.narrative_points),
|
||||||
|
tokens=war.get_influence_tokens(war_part.id),
|
||||||
rank_icon=icon_map.get(war_part_id),
|
rank_icon=icon_map.get(war_part_id),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -185,6 +186,7 @@ class CampaignController:
|
||||||
RefreshScope.WARS_TREE, item_type=ItemType.CAMPAIGN, item_id=campaign_id
|
RefreshScope.WARS_TREE, item_type=ItemType.CAMPAIGN, item_id=campaign_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# TODO fix spent tokens on tie cancel
|
||||||
def resolve_ties(
|
def resolve_ties(
|
||||||
self, war: War, contexts: List[TieContext]
|
self, war: War, contexts: List[TieContext]
|
||||||
) -> Dict[str, Dict[str, bool]]:
|
) -> Dict[str, Dict[str, bool]]:
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,7 @@ class CampaignParticipantScoreDTO:
|
||||||
theme: str
|
theme: str
|
||||||
victory_points: int
|
victory_points: int
|
||||||
narrative_points: Dict[str, int]
|
narrative_points: Dict[str, int]
|
||||||
|
tokens: int
|
||||||
rank_icon: QIcon | None = None
|
rank_icon: QIcon | None = None
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -135,4 +136,5 @@ class WarParticipantScoreDTO:
|
||||||
faction: str
|
faction: str
|
||||||
victory_points: int
|
victory_points: int
|
||||||
narrative_points: Dict[str, int]
|
narrative_points: Dict[str, int]
|
||||||
|
tokens: int
|
||||||
rank_icon: QIcon | None = None
|
rank_icon: QIcon | None = None
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ class WarController:
|
||||||
faction=war_part.faction or "",
|
faction=war_part.faction or "",
|
||||||
victory_points=score.victory_points,
|
victory_points=score.victory_points,
|
||||||
narrative_points=dict(score.narrative_points),
|
narrative_points=dict(score.narrative_points),
|
||||||
|
tokens=war.get_influence_tokens(war_part.id),
|
||||||
rank_icon=icon_map.get(war_part.id),
|
rank_icon=icon_map.get(war_part.id),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -160,6 +161,7 @@ class WarController:
|
||||||
RefreshScope.WARS_TREE, item_type=ItemType.WAR, item_id=war_id
|
RefreshScope.WARS_TREE, item_type=ItemType.WAR, item_id=war_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# TODO fix spent tokens on tie cancel
|
||||||
def resolve_ties(
|
def resolve_ties(
|
||||||
self, war: War, contexts: List[TieContext]
|
self, war: War, contexts: List[TieContext]
|
||||||
) -> Dict[str, Dict[str, bool]]:
|
) -> Dict[str, Dict[str, bool]]:
|
||||||
|
|
|
||||||
|
|
@ -369,8 +369,10 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
) -> None:
|
) -> None:
|
||||||
table = self.warParticipantsTable
|
table = self.warParticipantsTable
|
||||||
table.clearContents()
|
table.clearContents()
|
||||||
base_cols = ["Player", "Faction", "Victory"]
|
base_cols = ["Player", "Faction", "Victory pts"]
|
||||||
headers = base_cols + [obj.name for obj in objectives]
|
headers = (
|
||||||
|
base_cols + [str(obj.name + " pts") for obj in objectives] + ["Tokens"]
|
||||||
|
)
|
||||||
table.setColumnCount(len(headers))
|
table.setColumnCount(len(headers))
|
||||||
table.setHorizontalHeaderLabels(headers)
|
table.setHorizontalHeaderLabels(headers)
|
||||||
table.setRowCount(len(participants))
|
table.setRowCount(len(participants))
|
||||||
|
|
@ -382,6 +384,7 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
faction_item = QtWidgets.QTableWidgetItem(part.faction)
|
faction_item = QtWidgets.QTableWidgetItem(part.faction)
|
||||||
VP_item = QtWidgets.QTableWidgetItem(str(part.victory_points))
|
VP_item = QtWidgets.QTableWidgetItem(str(part.victory_points))
|
||||||
name_item.setData(Qt.ItemDataRole.UserRole, part.war_participant_id)
|
name_item.setData(Qt.ItemDataRole.UserRole, part.war_participant_id)
|
||||||
|
token_item = QtWidgets.QTableWidgetItem(str(part.tokens))
|
||||||
table.setItem(row, 0, name_item)
|
table.setItem(row, 0, name_item)
|
||||||
table.setItem(row, 1, faction_item)
|
table.setItem(row, 1, faction_item)
|
||||||
table.setItem(row, 2, VP_item)
|
table.setItem(row, 2, VP_item)
|
||||||
|
|
@ -391,6 +394,7 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
NP_item = QtWidgets.QTableWidgetItem(str(value))
|
NP_item = QtWidgets.QTableWidgetItem(str(value))
|
||||||
table.setItem(row, col, NP_item)
|
table.setItem(row, col, NP_item)
|
||||||
col += 1
|
col += 1
|
||||||
|
table.setItem(row, col, token_item)
|
||||||
table.resizeColumnsToContents()
|
table.resizeColumnsToContents()
|
||||||
|
|
||||||
def _on_major_changed(self, value: int) -> None:
|
def _on_major_changed(self, value: int) -> None:
|
||||||
|
|
@ -489,8 +493,10 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
) -> None:
|
) -> None:
|
||||||
table = self.campaignParticipantsTable
|
table = self.campaignParticipantsTable
|
||||||
table.clearContents()
|
table.clearContents()
|
||||||
base_cols = ["Player", "Leader", "Theme", "Victory"]
|
base_cols = ["Player", "Leader", "Theme", "Victory pts"]
|
||||||
headers = base_cols + [obj.name for obj in objectives]
|
headers = (
|
||||||
|
base_cols + [str(obj.name + " pts") for obj in objectives] + ["Tokens"]
|
||||||
|
)
|
||||||
table.setColumnCount(len(headers))
|
table.setColumnCount(len(headers))
|
||||||
table.setHorizontalHeaderLabels(headers)
|
table.setHorizontalHeaderLabels(headers)
|
||||||
table.setRowCount(len(participants))
|
table.setRowCount(len(participants))
|
||||||
|
|
@ -502,6 +508,7 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
lead_item = QtWidgets.QTableWidgetItem(part.leader)
|
lead_item = QtWidgets.QTableWidgetItem(part.leader)
|
||||||
theme_item = QtWidgets.QTableWidgetItem(part.theme)
|
theme_item = QtWidgets.QTableWidgetItem(part.theme)
|
||||||
VP_item = QtWidgets.QTableWidgetItem(str(part.victory_points))
|
VP_item = QtWidgets.QTableWidgetItem(str(part.victory_points))
|
||||||
|
token_item = QtWidgets.QTableWidgetItem(str(part.tokens))
|
||||||
name_item.setData(Qt.ItemDataRole.UserRole, part.campaign_participant_id)
|
name_item.setData(Qt.ItemDataRole.UserRole, part.campaign_participant_id)
|
||||||
table.setItem(row, 0, name_item)
|
table.setItem(row, 0, name_item)
|
||||||
table.setItem(row, 1, lead_item)
|
table.setItem(row, 1, lead_item)
|
||||||
|
|
@ -513,6 +520,7 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
NP_item = QtWidgets.QTableWidgetItem(str(value))
|
NP_item = QtWidgets.QTableWidgetItem(str(value))
|
||||||
table.setItem(row, col, NP_item)
|
table.setItem(row, col, NP_item)
|
||||||
col += 1
|
col += 1
|
||||||
|
table.setItem(row, col, token_item)
|
||||||
table.resizeColumnsToContents()
|
table.resizeColumnsToContents()
|
||||||
|
|
||||||
# Round page
|
# Round page
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue