Add section toggles, simplify Customize, scope header to Match
- Customize menu: a "Sections" group to show/hide each Match panel (You, Match, Opponent, Turn stats, My deck, Preview, Opponent's cards); rows collapse when all their panels are hidden. Player panel details follow, then Arrange. The submenus duplicating Arrange are gone. - The top bar's match summary only shows on the Match tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e82f8d1858
commit
5f3c7c13d0
4 files changed
+69
-23
No files matched your search
@@ -214,7 +214,8 @@ class MatchView(QWidget):
|
||||
grid.addWidget(w, row, 0, Qt.AlignmentFlag.AlignHCenter)
|
||||
grid.setRowStretch(7, 1)
|
||||
|
||||
top = QWidget()
|
||||
self.turn_view = turn_view
|
||||
top = self.top = QWidget()
|
||||
top_lay = QHBoxLayout(top)
|
||||
top_lay.setContentsMargins(0, 0, 0, 0)
|
||||
top_lay.addWidget(self.me, 3)
|
||||
@@ -233,11 +234,26 @@ class MatchView(QWidget):
|
||||
lay = QVBoxLayout(self)
|
||||
lay.setContentsMargins(0, 0, 0, 0)
|
||||
lay.addWidget(self.split)
|
||||
self._panels = {"you": True, "match": True, "opponent": True}
|
||||
self._has_game = False
|
||||
|
||||
def show_panels(self, you: bool, match: bool, opponent: bool, turns: bool) -> None:
|
||||
"""Hide/show panels; a row with every panel hidden collapses out of the splitter."""
|
||||
self._panels = {"you": you, "match": match, "opponent": opponent}
|
||||
self.top.setVisible(you or match or opponent)
|
||||
self.turn_view.setVisible(turns)
|
||||
self._apply_panels()
|
||||
|
||||
def _apply_panels(self) -> None:
|
||||
# render() toggles these for "no game yet", so combine both conditions.
|
||||
self.me.setVisible(self._has_game and self._panels["you"])
|
||||
self.info.setVisible(self._has_game and self._panels["match"])
|
||||
self.opp.setVisible(self._has_game and self._panels["opponent"])
|
||||
|
||||
def render(self, t: MatchTracker, now_ms: int) -> None:
|
||||
g = t.game
|
||||
for w in (self.me, self.opp, self.info):
|
||||
w.setVisible(g is not None)
|
||||
self._has_game = g is not None
|
||||
self._apply_panels()
|
||||
if g is None:
|
||||
return
|
||||
self.me.render(g, g.my_seat, "You", now_ms)
|
||||
|
||||
Reference in new issue
Block a user