Merge views into Match, expand history, and polish the UI
- Match page now holds players/match info, turn stats with a turn picker, and the deck lists (My deck · Preview · Opponent); the Deck and Turn tabs are gone. Section heights are draggable and remembered. - History: sortable, resizable columns; deck and commander columns; right-click to show only or hide games with a value, with filter chips; stats tiles (win rate overall, last 10/100, last 7 days, play/draw, average length and turns) that follow the filters. Commanders are backfilled for games recorded before they were stored. - Deck panel shows copies per zone against the deck total (e.g. 2/5). - Preview can be cleared with ✕, a click on the image, or Esc. - Customize menu stays open while toggling; Arrange covers deck sections and turn stats together. - Fix squeezed nav buttons and the header pushing controls off-screen. - Fix known opponent cards being double-counted when also revealed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b3c8c8e63
commit
b3325e8ecc
15 files changed
+760
-183
No files matched your search
@@ -2,15 +2,17 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from PySide6.QtCore import QSize, Qt
|
||||
from PySide6.QtGui import QPixmap, QResizeEvent
|
||||
from PySide6.QtWidgets import QLabel, QSizePolicy, QVBoxLayout, QWidget
|
||||
from PySide6.QtCore import QSize, Qt, Signal
|
||||
from PySide6.QtGui import QMouseEvent, QPixmap, QResizeEvent
|
||||
from PySide6.QtWidgets import QHBoxLayout, QLabel, QSizePolicy, QToolButton, QVBoxLayout, QWidget
|
||||
|
||||
from ..carddb import CardDB
|
||||
from ..images import ImageCache
|
||||
|
||||
|
||||
class CardPreview(QWidget):
|
||||
cleared = Signal()
|
||||
|
||||
def __init__(self, cards: CardDB, images: ImageCache, parent=None):
|
||||
super().__init__(parent)
|
||||
self.cards = cards
|
||||
@@ -26,18 +28,44 @@ class CardPreview(QWidget):
|
||||
self.caption.setWordWrap(True)
|
||||
self.caption.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
|
||||
self.close_btn = QToolButton()
|
||||
self.close_btn.setText("✕")
|
||||
self.close_btn.setToolTip("Stop previewing this card (Esc, or click the image)")
|
||||
self.close_btn.clicked.connect(self.clear)
|
||||
top = QHBoxLayout()
|
||||
top.addStretch(1)
|
||||
top.addWidget(self.close_btn)
|
||||
|
||||
lay = QVBoxLayout(self)
|
||||
lay.setContentsMargins(4, 4, 4, 4)
|
||||
lay.addLayout(top)
|
||||
lay.addWidget(self.image, 1)
|
||||
lay.addWidget(self.caption)
|
||||
|
||||
images.image_ready.connect(self._on_image_ready)
|
||||
self.clear()
|
||||
|
||||
def clear(self) -> None:
|
||||
"""Back to the empty state."""
|
||||
was_showing = self.grp_id is not None
|
||||
self.grp_id = None
|
||||
self.caption.setText("")
|
||||
self._show_placeholder("Hover a card to preview it")
|
||||
self.close_btn.setVisible(False)
|
||||
if was_showing:
|
||||
self.cleared.emit()
|
||||
|
||||
def mousePressEvent(self, event: QMouseEvent) -> None:
|
||||
if event.button() == Qt.MouseButton.LeftButton and self.grp_id is not None:
|
||||
self.clear()
|
||||
return
|
||||
super().mousePressEvent(event)
|
||||
|
||||
def show_card(self, grp_id: int) -> None:
|
||||
if grp_id == self.grp_id:
|
||||
return
|
||||
self.grp_id = grp_id
|
||||
self.close_btn.setVisible(True)
|
||||
info = self.cards.get(grp_id)
|
||||
details = [info.type_line]
|
||||
if info.power or info.toughness:
|
||||
|
||||
Reference in new issue
Block a user