mirror of
https://github.com/yusufipk/deste-hearthstone-linux-tracker.git
synced 2026-09-11 10:46:12 +00:00
Match history and win rate
Every finished match goes into a small sqlite database: mode, deck, both classes, result, turn count and who started. The result tag arrives in the last turn of the match, so the record is written then, not when the game object is closed (that only happens once the next match starts). The unique key is the session directory plus the match start time, so importing old session logs into the same database can be repeated without duplicates. The new window (from the menu) shows the totals, the win rate by deck and by opponent class, and the recent matches. Classes are drawn as hero portraits cut from the card render, with the class colour as a placeholder until the image is downloaded. Every table sorts by any column: the sort key is hidden data, not the visible text, so dates, turn counts and results sort correctly, and numeric columns start descending. tools/import_history.py backfills the database from the session logs already on disk, tests/test_history.py covers the date handling, the idempotency and the win rate maths.
This commit is contained in:
+31
@@ -14,6 +14,9 @@ MANA_BLUE = "#1f4e8c"
|
||||
WIN = "#5fbf6a"
|
||||
LOSS = "#d0605a"
|
||||
|
||||
# Maç sonucu: yazı yerine işaret. Hem panelde hem maç geçmişinde aynı dil.
|
||||
RESULT_MARKS = {"WON": ("✓", WIN), "LOST": ("✗", LOSS), "TIED": ("=", TEXT_DIM)}
|
||||
|
||||
RARITY_COLORS = {
|
||||
"COMMON": "#c9cedb",
|
||||
"FREE": "#c9cedb",
|
||||
@@ -131,3 +134,31 @@ QScrollBar::handle:vertical:hover {{ background: {TEXT_DIM}; }}
|
||||
QScrollBar::add-line, QScrollBar::sub-line {{ height: 0; }}
|
||||
QScrollBar::add-page, QScrollBar::sub-page {{ background: transparent; }}
|
||||
"""
|
||||
|
||||
# Maç geçmişi penceresi. Panelin aksine saydam değil: oyunun üstünde değil,
|
||||
# yanında okunan bir pencere.
|
||||
TABLE_STYLESHEET = f"""
|
||||
QWidget#history {{ background: {BACKGROUND}; }}
|
||||
QLabel#title {{ font-size: 15px; font-weight: 600; }}
|
||||
QLabel#total {{ color: {TEXT_DIM}; font-size: 12px; }}
|
||||
QTableWidget {{
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
}}
|
||||
QTableWidget::item {{ padding: 2px 6px; border: none; }}
|
||||
QTableWidget::item:selected {{ background: {SURFACE_ALT}; color: {TEXT}; }}
|
||||
QHeaderView::section {{
|
||||
background: transparent;
|
||||
color: {TEXT_DIM};
|
||||
border: none;
|
||||
border-bottom: 1px solid {BORDER};
|
||||
padding: 4px 6px;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 1px;
|
||||
}}
|
||||
/* Başlıklar tıklanınca sıralıyor, imleç üstüne gelince belli olsun. */
|
||||
QHeaderView::section:hover {{ color: {TEXT}; }}
|
||||
QHeaderView::down-arrow, QHeaderView::up-arrow {{ width: 9px; height: 9px; }}
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user