2026-11-14 04:25:51 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2026-11-26 22:50:56 +00:00
|
|
|
# view/assets/assets_manager.py
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
2026-11-14 04:25:51 +00:00
|
|
|
from pathlib import Path
|
2026-11-26 22:50:56 +00:00
|
|
|
import sys
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
import tkinter as tk
|
2026-11-26 22:50:56 +00:00
|
|
|
from PIL import Image, ImageOps, ImageTk
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
|
2026-11-14 04:25:51 +00:00
|
|
|
from models.resource_manager import ResourceManager
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
from resources.code_res.game_constants import (
|
|
|
|
|
FONT_COLOR_BODY_DEFAULT,
|
|
|
|
|
FONT_LETTER_SPACING_PX,
|
|
|
|
|
FONT_OUTLINE_THICKNESS_PX,
|
|
|
|
|
FONT_SHADOW_OFFSET_DEFAULT,
|
|
|
|
|
OUTCOME_GIF_SIZE,
|
|
|
|
|
PLAYING_CARD_SIZE,
|
|
|
|
|
)
|
2026-11-26 22:50:56 +00:00
|
|
|
from view.assets.asset_preloader import run_startup_preload
|
|
|
|
|
from view.assets.nine_slice_scaler import NineSliceScaler, clean_box_matte_fast
|
|
|
|
|
from view.typography.goth_text_renderer import GothTextRenderer
|
2026-11-19 21:47:35 +00:00
|
|
|
|
|
|
|
|
|
2026-11-14 04:25:51 +00:00
|
|
|
class AssetManager:
|
|
|
|
|
def __init__(self, root_dir: Path):
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
self.root_dir = root_dir
|
2026-11-14 04:25:51 +00:00
|
|
|
self.res = ResourceManager(root_dir)
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
|
2026-11-19 21:47:35 +00:00
|
|
|
self._tk_cache: dict = {}
|
|
|
|
|
self._pil_cache: dict = {}
|
|
|
|
|
self._raw_card_cache: dict[str, Image.Image | None] = {}
|
2026-11-26 22:50:56 +00:00
|
|
|
self._bg_scaled_key: tuple[bool, bool, int, int] | None = None
|
2026-11-19 21:47:35 +00:00
|
|
|
self._bg_scaled_pil: Image.Image | None = None
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
self._text_renderer = GothTextRenderer(root_dir, self._pil_cache, self._tk_cache)
|
2026-11-19 21:47:35 +00:00
|
|
|
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
self.raw_bg_horizontal = self._load_ui_flexible("bg_horizontal", "background_horizontal")
|
|
|
|
|
self.raw_bg_vertical = self._load_ui_flexible("bg_vertical", "background_vertical")
|
2026-11-26 22:50:56 +00:00
|
|
|
self.raw_mobile_bg_horizontal = self._load_pil(
|
|
|
|
|
self.res.get_ui_image_path("mobile_bg_horizontal")
|
|
|
|
|
)
|
|
|
|
|
self.raw_mobile_bg_vertical = self._load_pil(
|
|
|
|
|
self.res.get_ui_image_path("mobile_bg_vertical")
|
|
|
|
|
)
|
|
|
|
|
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
self.raw_bg = self.raw_bg_horizontal or self._load_ui_flexible("background", "background")
|
|
|
|
|
self.raw_title = self._load_ui_flexible("title", "title")
|
2026-11-19 21:47:35 +00:00
|
|
|
self.raw_general_table = None
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
self.raw_poker_table = self._load_ui_flexible("poker_table", "poker_table")
|
|
|
|
|
|
|
|
|
|
self.raw_btn_default = self._load_ui_flexible("btn_default", "button")
|
|
|
|
|
self.raw_btn_purple = self._load_ui_flexible("btn_purple", "button_highlighted_purple")
|
|
|
|
|
self.raw_btn_fire = self._load_ui_flexible("btn_fire", "button_highlighted_fire")
|
|
|
|
|
|
|
|
|
|
self.raw_boxes: dict[str, Image.Image | None] = {
|
2026-11-26 22:50:56 +00:00
|
|
|
"box_big": clean_box_matte_fast(
|
2026-11-19 21:47:35 +00:00
|
|
|
self._load_ui_flexible("box_big", "box_big"), hollow_center=True
|
|
|
|
|
),
|
2026-11-26 22:50:56 +00:00
|
|
|
"box_gold_small": clean_box_matte_fast(
|
2026-11-19 21:47:35 +00:00
|
|
|
self._load_ui_flexible("box_gold_small", "box_gold_smal", "box_gold_small"), hollow_center=True
|
|
|
|
|
),
|
2026-11-26 22:50:56 +00:00
|
|
|
"box_gold_double": clean_box_matte_fast(
|
2026-11-19 21:47:35 +00:00
|
|
|
self._load_ui_flexible("box_gold_double", "box_gold_small_double"), hollow_center=True
|
|
|
|
|
),
|
2026-11-26 22:50:56 +00:00
|
|
|
"box_purple": clean_box_matte_fast(
|
2026-11-19 21:47:35 +00:00
|
|
|
self._load_ui_flexible("box_purple", "box_small_purple"), hollow_center=True
|
|
|
|
|
),
|
2026-11-26 22:50:56 +00:00
|
|
|
"dropdown_box": clean_box_matte_fast(
|
2026-11-19 21:47:35 +00:00
|
|
|
self._load_ui_flexible("dropdown_box", "dropdown_box"), hollow_center=False
|
|
|
|
|
),
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
}
|
|
|
|
|
self.raw_chat_frame = self.raw_boxes["box_big"]
|
|
|
|
|
|
|
|
|
|
self.raw_input = self._load_ui_flexible("input_field", "input")
|
|
|
|
|
self.raw_dropdown_closed = self._load_ui_flexible("dropdown_closed", "dropdown_closed")
|
|
|
|
|
self.raw_dropdown_closed_btn = self._load_ui_flexible("dropdown_closed_btn", "dropdown_closed_button")
|
|
|
|
|
self.raw_dropdown_open = self._load_ui_flexible(
|
|
|
|
|
"dropdown_open", "dropdown_box_hightlighted", "dropdown_box_highlighted"
|
|
|
|
|
)
|
|
|
|
|
self.raw_dropdown_open_btn = self._load_ui_flexible(
|
|
|
|
|
"dropdown_open_btn", "dropdown_box_hightlighted_button", "dropdown_box_highlighted_button"
|
|
|
|
|
)
|
|
|
|
|
self.raw_dropdown_box = self.raw_boxes["dropdown_box"]
|
|
|
|
|
self.raw_dropdown_selection = self._load_ui_flexible("dropdown_selection", "dropdown_selection")
|
|
|
|
|
|
2026-11-19 21:47:35 +00:00
|
|
|
self._optimize_raw_for_display()
|
|
|
|
|
|
|
|
|
|
self.raw_btn = self.raw_btn_fire or self.raw_btn_default
|
|
|
|
|
self.raw_btn_active = self.raw_btn_fire or self.raw_btn_purple
|
|
|
|
|
self.raw_sel = self.raw_btn_default
|
|
|
|
|
self.raw_sel_active = self.raw_btn_purple or self.raw_btn_default
|
2026-11-14 04:25:51 +00:00
|
|
|
|
|
|
|
|
@staticmethod
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
def _load_pil(path: Path | None) -> Image.Image | None:
|
|
|
|
|
if path and path.is_file():
|
2026-11-14 04:25:51 +00:00
|
|
|
try:
|
|
|
|
|
return Image.open(path).convert("RGBA")
|
|
|
|
|
except Exception:
|
|
|
|
|
return None
|
|
|
|
|
return None
|
|
|
|
|
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
def _load_ui_flexible(self, ui_key: str, *stem_fallbacks: str) -> Image.Image | None:
|
|
|
|
|
try:
|
|
|
|
|
p = self.res.get_ui_image_path(ui_key)
|
|
|
|
|
pil = self._load_pil(p)
|
|
|
|
|
if pil is not None:
|
|
|
|
|
return pil
|
|
|
|
|
except Exception:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
img_dir = self.root_dir / "resources" / "images"
|
|
|
|
|
for stem in stem_fallbacks:
|
|
|
|
|
for ext in (".png", ".jpg", ".jpeg"):
|
|
|
|
|
cand = img_dir / f"{stem}{ext}"
|
|
|
|
|
if cand.is_file():
|
|
|
|
|
loaded = self._load_pil(cand)
|
|
|
|
|
if loaded is not None:
|
|
|
|
|
return loaded
|
|
|
|
|
return None
|
|
|
|
|
|
2026-11-19 21:47:35 +00:00
|
|
|
def _optimize_raw_for_display(self):
|
|
|
|
|
try:
|
|
|
|
|
r = tk._default_root
|
|
|
|
|
sw = r.winfo_screenwidth() if r else 1920
|
|
|
|
|
sh = r.winfo_screenheight() if r else 1080
|
|
|
|
|
except Exception:
|
|
|
|
|
sw, sh = 1920, 1080
|
|
|
|
|
|
|
|
|
|
btn_cap_h = 200 if max(sw, sh) >= 2500 else 130
|
|
|
|
|
for attr in ("raw_btn_default", "raw_btn_purple", "raw_btn_fire"):
|
|
|
|
|
img = getattr(self, attr, None)
|
|
|
|
|
if img is not None and img.height > btn_cap_h:
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
nw = max(1, int(round(img.width * (btn_cap_h / img.height))))
|
2026-11-19 21:47:35 +00:00
|
|
|
setattr(self, attr, img.resize((nw, btn_cap_h), Image.Resampling.LANCZOS))
|
|
|
|
|
|
|
|
|
|
if max(sw, sh) >= 2500:
|
|
|
|
|
return
|
|
|
|
|
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
max_bg_w, max_bg_h = int(sw * 1.15), int(sh * 1.15)
|
2026-11-26 22:50:56 +00:00
|
|
|
for attr in (
|
|
|
|
|
"raw_bg_horizontal", "raw_bg_vertical",
|
|
|
|
|
"raw_mobile_bg_horizontal", "raw_mobile_bg_vertical",
|
|
|
|
|
"raw_bg", "raw_poker_table",
|
|
|
|
|
):
|
2026-11-19 21:47:35 +00:00
|
|
|
img = getattr(self, attr, None)
|
|
|
|
|
if img is not None and (img.width > max_bg_w or img.height > max_bg_h):
|
|
|
|
|
ratio = min(max_bg_w / img.width, max_bg_h / img.height)
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
nw, nh = max(1, int(round(img.width * ratio))), max(1, int(round(img.height * ratio)))
|
2026-11-19 21:47:35 +00:00
|
|
|
setattr(self, attr, img.resize((nw, nh), Image.Resampling.LANCZOS))
|
|
|
|
|
|
|
|
|
|
def get_window_bg_pil(self, rw: int, rh: int) -> Image.Image | None:
|
2026-11-26 22:50:56 +00:00
|
|
|
from view.layout_mode import LayoutMode
|
|
|
|
|
|
2026-11-19 21:47:35 +00:00
|
|
|
rw, rh = max(64, int(rw)), max(64, int(rh))
|
2026-11-26 22:50:56 +00:00
|
|
|
compact = LayoutMode.is_compact(rw, rh)
|
|
|
|
|
is_vert = bool(rh > rw)
|
|
|
|
|
key = (compact, is_vert, rw, rh)
|
2026-11-19 21:47:35 +00:00
|
|
|
if key == self._bg_scaled_key and self._bg_scaled_pil is not None:
|
|
|
|
|
return self._bg_scaled_pil
|
|
|
|
|
|
2026-11-26 22:50:56 +00:00
|
|
|
if compact:
|
|
|
|
|
src = (
|
|
|
|
|
(self.raw_mobile_bg_vertical or self.raw_mobile_bg_horizontal)
|
|
|
|
|
if is_vert
|
|
|
|
|
else (self.raw_mobile_bg_horizontal or self.raw_mobile_bg_vertical)
|
|
|
|
|
)
|
|
|
|
|
if src is None:
|
|
|
|
|
src = self.raw_bg_vertical if (is_vert and self.raw_bg_vertical) else (self.raw_bg_horizontal or self.raw_bg)
|
|
|
|
|
if src is None:
|
|
|
|
|
return None
|
|
|
|
|
rgb_src = src.convert("RGB") if src.mode != "RGB" else src
|
|
|
|
|
self._bg_scaled_pil = ImageOps.fit(
|
|
|
|
|
rgb_src, (rw, rh), method=Image.Resampling.BILINEAR, centering=(0.5, 0.5)
|
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
src = self.raw_bg_vertical if (is_vert and self.raw_bg_vertical) else (self.raw_bg_horizontal or self.raw_bg)
|
|
|
|
|
if src is None:
|
|
|
|
|
return None
|
|
|
|
|
rgb_src = src.convert("RGB") if src.mode != "RGB" else src
|
|
|
|
|
self._bg_scaled_pil = rgb_src.resize((rw, rh), Image.Resampling.BILINEAR)
|
2026-11-19 21:47:35 +00:00
|
|
|
|
|
|
|
|
self._bg_scaled_key = key
|
|
|
|
|
return self._bg_scaled_pil
|
|
|
|
|
|
2026-11-26 22:50:56 +00:00
|
|
|
def get_bg_patch_photo(
|
|
|
|
|
self, rw: int, rh: int, ox: int, oy: int, w: int, h: int
|
|
|
|
|
) -> ImageTk.PhotoImage | None:
|
|
|
|
|
from view.layout_mode import LayoutMode
|
|
|
|
|
|
2026-11-19 21:47:35 +00:00
|
|
|
w, h = max(1, int(w)), max(1, int(h))
|
|
|
|
|
rw, rh = max(w, int(rw)), max(h, int(rh))
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
ox, oy = max(0, min(rw - w, int(ox))), max(0, min(rh - h, int(oy)))
|
2026-11-26 22:50:56 +00:00
|
|
|
compact = LayoutMode.is_compact(rw, rh)
|
2026-11-19 21:47:35 +00:00
|
|
|
|
2026-11-26 22:50:56 +00:00
|
|
|
tk_key = ("bg_patch", compact, rw, rh, ox, oy, w, h)
|
2026-11-19 21:47:35 +00:00
|
|
|
if tk_key in self._tk_cache:
|
|
|
|
|
return self._tk_cache[tk_key]
|
|
|
|
|
|
|
|
|
|
base = self.get_window_bg_pil(rw, rh)
|
|
|
|
|
if base is None:
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
if len(self._tk_cache) > 360:
|
|
|
|
|
stale = [k for k in self._tk_cache if isinstance(k, tuple) and k and k[0] == "bg_patch"]
|
|
|
|
|
for k in stale[:-12]:
|
|
|
|
|
self._tk_cache.pop(k, None)
|
|
|
|
|
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
photo = ImageTk.PhotoImage(base.crop((ox, oy, ox + w, oy + h)))
|
2026-11-19 21:47:35 +00:00
|
|
|
self._tk_cache[tk_key] = photo
|
|
|
|
|
return photo
|
|
|
|
|
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
def get_dim_veil_photo(self, width: int, height: int, alpha: int = 148) -> ImageTk.PhotoImage:
|
feat(solitaire,ui): add Z-order card hover peek, single-tap move setting, ModalVeil, and EndgameFxOverlay
Solitaire UX & Bedienhilfen:
- CardHoverZoom (games/solitaire/base/card_hover_zoom.py) eingeführt: Hebt offene Karten beim Überfahren dezent an und vergrößert sie leicht unter Beibehaltung der exakten Z-Order im Stapel, sodass aufliegende Folgekarten sichtbar bleiben (inkl. 3er-Ablagefächer in Klondike und blockierter Zwischenkarten in FreeCell/Spider).
- Persistente Einstellung "Einfacher Klick zum Schieben" / "Single tap to move" (games/solitaire/base/solitaire_tap_prefs.py) ergänzt: Kurze Einzelklicks (<= 0.28s) führen automatisch Züge aus, während längeres Halten ignoriert wird und Drag & Drop uneingeschränkt erhalten bleibt.
- AudioSettingsDialog (view/dialogs/audio_settings_dialog.py) um den neuen GothSwitch erweitert, Layout auf 768p-Kompatibilität (DLG_H = 656) optimiert und alle Dialogtexte sauber auf base_i18n (01_allgemein.sql) umgestellt.
- FreeCellTableView, KlondikeTableView und SpiderTableView auf CardHoverZoom, Single-Tap-Steuerung, zentrale GothTopbar-Statistik-Endpunkte und SolitaireBottomBar-Overflow-Buttons aktualisiert.
Überarbeitetes Spielende & Modal-Architektur:
- ModalVeil (view/widgets/modal_veil.py) implementiert: Dunkelt das gesperrte Spielfeld halbtransparent ab, hebt aktive Dialoge garantiert über alle UI-Leisten und blockiert Eingaben sowie Tastenkürzel im Hintergrund.
- EndgameFxOverlay (view/widgets/endgame_fx_overlay.py) implementiert: Spielt vor dem Ergebnis-Dialog auf dem gesperrten Tisch Alpha-Kanal-Animationen ab (Sieg: firework_start.gif unten links + zufällig verteilte bat_explosion.gif / pumpkin_explosion.gif; Niederlage: zufällig verteilte foul_pumpkin.gif) und wechselt erst per Klick zum Result-Screen.
- ResourceManager und AssetManager um den Pfad resources/images/win_lose/, RGBA-GIF-Sequenz-Caching inkl. Original-Frame-Dauern, abgedunkelte Veil-Texturen und Startup-Preloading erweitert.
- Eingebettete GIF-Animationen aus SolitaireModalDialog, BlackjackResultDialog und PokerResultDialog vollständig entfernt und alle drei Ergebnis-Fenster auf ModalVeil umgestellt.
2026-11-21 23:02:21 +00:00
|
|
|
w, h = max(8, int(width)), max(8, int(height))
|
|
|
|
|
a = max(0, min(240, int(alpha)))
|
|
|
|
|
tk_key = ("dim_veil", w, h, a)
|
|
|
|
|
if tk_key not in self._tk_cache:
|
|
|
|
|
stale = [k for k in self._tk_cache if isinstance(k, tuple) and k and k[0] == "dim_veil"]
|
|
|
|
|
for k in stale[:-6]:
|
|
|
|
|
self._tk_cache.pop(k, None)
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
self._tk_cache[tk_key] = ImageTk.PhotoImage(Image.new("RGBA", (w, h), (10, 8, 16, a)))
|
feat(solitaire,ui): add Z-order card hover peek, single-tap move setting, ModalVeil, and EndgameFxOverlay
Solitaire UX & Bedienhilfen:
- CardHoverZoom (games/solitaire/base/card_hover_zoom.py) eingeführt: Hebt offene Karten beim Überfahren dezent an und vergrößert sie leicht unter Beibehaltung der exakten Z-Order im Stapel, sodass aufliegende Folgekarten sichtbar bleiben (inkl. 3er-Ablagefächer in Klondike und blockierter Zwischenkarten in FreeCell/Spider).
- Persistente Einstellung "Einfacher Klick zum Schieben" / "Single tap to move" (games/solitaire/base/solitaire_tap_prefs.py) ergänzt: Kurze Einzelklicks (<= 0.28s) führen automatisch Züge aus, während längeres Halten ignoriert wird und Drag & Drop uneingeschränkt erhalten bleibt.
- AudioSettingsDialog (view/dialogs/audio_settings_dialog.py) um den neuen GothSwitch erweitert, Layout auf 768p-Kompatibilität (DLG_H = 656) optimiert und alle Dialogtexte sauber auf base_i18n (01_allgemein.sql) umgestellt.
- FreeCellTableView, KlondikeTableView und SpiderTableView auf CardHoverZoom, Single-Tap-Steuerung, zentrale GothTopbar-Statistik-Endpunkte und SolitaireBottomBar-Overflow-Buttons aktualisiert.
Überarbeitetes Spielende & Modal-Architektur:
- ModalVeil (view/widgets/modal_veil.py) implementiert: Dunkelt das gesperrte Spielfeld halbtransparent ab, hebt aktive Dialoge garantiert über alle UI-Leisten und blockiert Eingaben sowie Tastenkürzel im Hintergrund.
- EndgameFxOverlay (view/widgets/endgame_fx_overlay.py) implementiert: Spielt vor dem Ergebnis-Dialog auf dem gesperrten Tisch Alpha-Kanal-Animationen ab (Sieg: firework_start.gif unten links + zufällig verteilte bat_explosion.gif / pumpkin_explosion.gif; Niederlage: zufällig verteilte foul_pumpkin.gif) und wechselt erst per Klick zum Result-Screen.
- ResourceManager und AssetManager um den Pfad resources/images/win_lose/, RGBA-GIF-Sequenz-Caching inkl. Original-Frame-Dauern, abgedunkelte Veil-Texturen und Startup-Preloading erweitert.
- Eingebettete GIF-Animationen aus SolitaireModalDialog, BlackjackResultDialog und PokerResultDialog vollständig entfernt und alle drei Ergebnis-Fenster auf ModalVeil umgestellt.
2026-11-21 23:02:21 +00:00
|
|
|
return self._tk_cache[tk_key]
|
|
|
|
|
|
2026-11-25 21:55:44 +00:00
|
|
|
def on_font_changed(self) -> None:
|
|
|
|
|
for cache_d in (self._pil_cache, self._tk_cache):
|
2026-11-26 22:50:56 +00:00
|
|
|
stale = [k for k in cache_d if isinstance(k, tuple) and k and str(k[0]).startswith("goth_txt")]
|
2026-11-25 21:55:44 +00:00
|
|
|
for k in stale:
|
|
|
|
|
cache_d.pop(k, None)
|
|
|
|
|
|
|
|
|
|
for mod_name in (
|
2026-11-26 22:50:56 +00:00
|
|
|
"view.widgets.buttons.button_art_compositor",
|
|
|
|
|
"view.widgets.buttons.image_button",
|
|
|
|
|
"view.widgets.dropdown.goth_dropdown",
|
|
|
|
|
"view.widgets.dropdown.goth_dropdown_popup",
|
2026-11-25 21:55:44 +00:00
|
|
|
):
|
2026-11-26 22:50:56 +00:00
|
|
|
mod = sys.modules.get(mod_name)
|
|
|
|
|
if mod is not None:
|
|
|
|
|
for attr_name, attr_val in vars(mod).items():
|
|
|
|
|
if isinstance(attr_val, dict) and "cache" in attr_name.lower():
|
|
|
|
|
attr_val.clear()
|
2026-11-25 21:55:44 +00:00
|
|
|
|
|
|
|
|
root = tk._default_root
|
|
|
|
|
if root is not None:
|
2026-11-26 22:50:56 +00:00
|
|
|
from view.typography.font_loader import FontLoader
|
2026-11-25 21:55:44 +00:00
|
|
|
|
|
|
|
|
def _walk(wgt: tk.Misc):
|
|
|
|
|
for child in wgt.winfo_children():
|
|
|
|
|
cls_name = type(child).__name__
|
|
|
|
|
try:
|
|
|
|
|
if cls_name == "ImageButton" and hasattr(child, "_rebuild_state_photos"):
|
|
|
|
|
child._rebuild_state_photos()
|
|
|
|
|
child.set_enabled(child._enabled)
|
|
|
|
|
elif cls_name == "GothDropdown" and hasattr(child, "_render_closed"):
|
|
|
|
|
child._render_closed()
|
|
|
|
|
elif cls_name == "GothEntry" and hasattr(child, "entry"):
|
|
|
|
|
px = getattr(child, "_base_font_px", 18)
|
|
|
|
|
child.entry.configure(font=FontLoader.title_font(px - 3))
|
|
|
|
|
except Exception:
|
|
|
|
|
pass
|
|
|
|
|
_walk(child)
|
|
|
|
|
|
|
|
|
|
_walk(root)
|
|
|
|
|
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
sanitize_goth_case = staticmethod(GothTextRenderer.sanitize_goth_case)
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
def get_pil_font(self, size_px: int, alternate: bool = False):
|
|
|
|
|
return self._text_renderer.get_pil_font(size_px, alternate=alternate)
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
|
|
|
|
|
def render_goth_text_pil(
|
2026-11-26 22:50:56 +00:00
|
|
|
self, text: str, size_px: int, color: str = FONT_COLOR_BODY_DEFAULT,
|
|
|
|
|
max_width: int | None = None, align: str = "center",
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
shadow_offset: tuple[int, int] | None = FONT_SHADOW_OFFSET_DEFAULT,
|
|
|
|
|
outline_px: int = FONT_OUTLINE_THICKNESS_PX,
|
|
|
|
|
letter_spacing: int = FONT_LETTER_SPACING_PX,
|
2026-11-26 22:50:56 +00:00
|
|
|
alternate: bool = False, uncached: bool = False,
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
) -> Image.Image:
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
return self._text_renderer.render_pil(
|
|
|
|
|
text, size_px, color, max_width, align, shadow_offset, outline_px, letter_spacing, alternate, uncached
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def get_goth_text_photo(
|
2026-11-26 22:50:56 +00:00
|
|
|
self, text: str, size_px: int, color: str = FONT_COLOR_BODY_DEFAULT,
|
|
|
|
|
max_width: int | None = None, align: str = "center",
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
shadow_offset: tuple[int, int] | None = FONT_SHADOW_OFFSET_DEFAULT,
|
|
|
|
|
outline_px: int = FONT_OUTLINE_THICKNESS_PX,
|
2026-11-26 22:50:56 +00:00
|
|
|
letter_spacing: int = FONT_LETTER_SPACING_PX, alternate: bool = False,
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
) -> ImageTk.PhotoImage:
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
return self._text_renderer.get_photo(
|
|
|
|
|
text, size_px, color, max_width, align, shadow_offset, outline_px, letter_spacing, alternate
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def get_9slice_pil(
|
2026-11-26 22:50:56 +00:00
|
|
|
self, box_key: str, target_size: tuple[int, int],
|
|
|
|
|
corner_ratio: float | None = None, border_scale: float = 1.0,
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
) -> Image.Image | None:
|
2026-11-26 22:50:56 +00:00
|
|
|
return NineSliceScaler.get_9slice_pil(
|
|
|
|
|
self.raw_boxes, self._pil_cache, box_key, target_size, corner_ratio, border_scale
|
|
|
|
|
)
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
|
|
|
|
|
def get_box_photo(
|
2026-11-26 22:50:56 +00:00
|
|
|
self, box_key: str, size: tuple[int, int],
|
|
|
|
|
corner_ratio: float | None = None, border_scale: float = 1.0,
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
) -> ImageTk.PhotoImage | None:
|
2026-11-26 22:50:56 +00:00
|
|
|
return NineSliceScaler.get_box_photo(
|
|
|
|
|
self.raw_boxes, self._pil_cache, self._tk_cache, box_key, size, corner_ratio, border_scale
|
|
|
|
|
)
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
|
2026-11-19 21:47:35 +00:00
|
|
|
def _get_raw_card_pil(self, path: Path | None) -> Image.Image | None:
|
|
|
|
|
if not path:
|
|
|
|
|
return None
|
|
|
|
|
key = str(path)
|
|
|
|
|
if key not in self._raw_card_cache:
|
|
|
|
|
pil = self._load_pil(path)
|
|
|
|
|
if pil is not None and pil.width > 340:
|
|
|
|
|
nh = max(1, int(round(pil.height * (340.0 / pil.width))))
|
|
|
|
|
pil = pil.resize((340, nh), Image.Resampling.LANCZOS)
|
|
|
|
|
self._raw_card_cache[key] = pil
|
|
|
|
|
return self._raw_card_cache[key]
|
|
|
|
|
|
2026-11-24 19:50:08 +00:00
|
|
|
def get_card_photo(
|
|
|
|
|
self, card_filename: str, size=PLAYING_CARD_SIZE, theme: str | None = None
|
|
|
|
|
) -> ImageTk.PhotoImage | None:
|
|
|
|
|
eff_theme = theme or self.res.card_theme
|
|
|
|
|
key = ("card", eff_theme, card_filename, size)
|
2026-11-14 04:25:51 +00:00
|
|
|
if key not in self._tk_cache:
|
2026-11-26 22:50:56 +00:00
|
|
|
pil = self._get_raw_card_pil(self.res.get_card_path(card_filename, theme=eff_theme))
|
2026-11-14 04:25:51 +00:00
|
|
|
if pil:
|
2026-11-26 22:50:56 +00:00
|
|
|
self._tk_cache[key] = ImageTk.PhotoImage(pil.resize(size, Image.Resampling.BILINEAR))
|
2026-11-14 04:25:51 +00:00
|
|
|
return self._tk_cache.get(key)
|
|
|
|
|
|
2026-11-24 19:50:08 +00:00
|
|
|
def get_card_back_photo(
|
|
|
|
|
self, color: str = "Black", size=PLAYING_CARD_SIZE, theme: str | None = None
|
|
|
|
|
) -> ImageTk.PhotoImage | None:
|
|
|
|
|
eff_theme = theme or self.res.card_theme
|
|
|
|
|
key = ("card_back", eff_theme, color, size)
|
2026-11-14 04:25:51 +00:00
|
|
|
if key not in self._tk_cache:
|
2026-11-26 22:50:56 +00:00
|
|
|
pil = self._get_raw_card_pil(self.res.get_card_back_path(color, theme=eff_theme))
|
2026-11-14 04:25:51 +00:00
|
|
|
if pil:
|
2026-11-26 22:50:56 +00:00
|
|
|
self._tk_cache[key] = ImageTk.PhotoImage(pil.resize(size, Image.Resampling.BILINEAR))
|
2026-11-14 04:25:51 +00:00
|
|
|
return self._tk_cache.get(key)
|
|
|
|
|
|
feat(ui): overhaul menus, stats & dialogs to custom canvas-based Gothic UI
- Add ui_typography.py and update game_constants.py for Old London typography and new image assets
- Upgrade AssetManager with downscaled 9-slice box rendering and PIL Old London text engine
- Convert ResizingBG to full-window Canvas with automatic horizontal/vertical background switching
- Add GothEntry and two-part GothDropdown with proportional arrow cap, mousewheel scrolling, and scroll indicators
- Update ImageButton with 3-slice side caps, frame-aware auto-width, and automatic icon stripping
- Refactor GothTopbar, LoginView, MainMenuView (hover zoom), StatisticsView, StatsBoardWidget, BotSetupWidget, and AudioSettingsDialog
- Migrate Blackjack, Poker, FreeCell, Klondike, and Spider menu/stats views plus BlackjackResultDialog to frameless canvas layouts
- Fix Crostini shelf icon matching via exact X11 WM_CLASS and absolute pixmap path
2026-11-17 21:31:02 +00:00
|
|
|
def get_scaled_photo(self, name: str, pil_img, size: tuple[int, int]) -> ImageTk.PhotoImage | None:
|
2026-11-14 04:25:51 +00:00
|
|
|
if not pil_img:
|
|
|
|
|
return None
|
|
|
|
|
key = (name, size)
|
|
|
|
|
if key not in self._tk_cache:
|
|
|
|
|
self._tk_cache[key] = ImageTk.PhotoImage(pil_img.resize(size, Image.Resampling.LANCZOS))
|
|
|
|
|
return self._tk_cache[key]
|
|
|
|
|
|
2026-11-14 21:47:38 +00:00
|
|
|
def get_proportional_photo(self, name: str, pil_img, target_width: int) -> ImageTk.PhotoImage | None:
|
|
|
|
|
if not pil_img or target_width <= 10:
|
|
|
|
|
return None
|
|
|
|
|
src_w, src_h = pil_img.size
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
return self.get_scaled_photo(name, pil_img, (target_width, max(1, int(round(target_width * (src_h / src_w))))))
|
2026-11-14 21:47:38 +00:00
|
|
|
|
2026-11-25 21:55:44 +00:00
|
|
|
def invalidate_avatar_cache(self) -> None:
|
|
|
|
|
for cache_d in (self._pil_cache, self._tk_cache):
|
2026-11-26 22:50:56 +00:00
|
|
|
stale = [k for k in cache_d if isinstance(k, tuple) and k and k[0] in ("avatar_pil", "avatar_tk")]
|
2026-11-25 21:55:44 +00:00
|
|
|
for k in stale:
|
|
|
|
|
cache_d.pop(k, None)
|
|
|
|
|
|
|
|
|
|
def get_avatar_photo(self, avatar_ref: str | None, size_px: int = 52) -> ImageTk.PhotoImage:
|
|
|
|
|
from models.avatar_composer import AvatarComposer, DEFAULT_AVATAR_FILENAME
|
|
|
|
|
|
|
|
|
|
ref = (avatar_ref or "").strip() or DEFAULT_AVATAR_FILENAME
|
|
|
|
|
sz = max(24, int(size_px))
|
|
|
|
|
tk_key = ("avatar_tk", ref, sz)
|
|
|
|
|
if tk_key not in self._tk_cache:
|
|
|
|
|
pil_key = ("avatar_pil", ref)
|
|
|
|
|
if pil_key not in self._pil_cache:
|
|
|
|
|
self._pil_cache[pil_key] = AvatarComposer.load_avatar_pil(self.res, ref)
|
2026-11-26 22:50:56 +00:00
|
|
|
self._tk_cache[tk_key] = ImageTk.PhotoImage(
|
|
|
|
|
self._pil_cache[pil_key].resize((sz, sz), Image.Resampling.LANCZOS)
|
|
|
|
|
)
|
2026-11-25 21:55:44 +00:00
|
|
|
return self._tk_cache[tk_key]
|
|
|
|
|
|
2026-11-14 04:25:51 +00:00
|
|
|
def get_gif_frames(self, key_or_filename: str, size=OUTCOME_GIF_SIZE) -> list[ImageTk.PhotoImage]:
|
|
|
|
|
cache_key = ("gif", key_or_filename, size)
|
|
|
|
|
if cache_key not in self._tk_cache:
|
feat(solitaire,ui): add Z-order card hover peek, single-tap move setting, ModalVeil, and EndgameFxOverlay
Solitaire UX & Bedienhilfen:
- CardHoverZoom (games/solitaire/base/card_hover_zoom.py) eingeführt: Hebt offene Karten beim Überfahren dezent an und vergrößert sie leicht unter Beibehaltung der exakten Z-Order im Stapel, sodass aufliegende Folgekarten sichtbar bleiben (inkl. 3er-Ablagefächer in Klondike und blockierter Zwischenkarten in FreeCell/Spider).
- Persistente Einstellung "Einfacher Klick zum Schieben" / "Single tap to move" (games/solitaire/base/solitaire_tap_prefs.py) ergänzt: Kurze Einzelklicks (<= 0.28s) führen automatisch Züge aus, während längeres Halten ignoriert wird und Drag & Drop uneingeschränkt erhalten bleibt.
- AudioSettingsDialog (view/dialogs/audio_settings_dialog.py) um den neuen GothSwitch erweitert, Layout auf 768p-Kompatibilität (DLG_H = 656) optimiert und alle Dialogtexte sauber auf base_i18n (01_allgemein.sql) umgestellt.
- FreeCellTableView, KlondikeTableView und SpiderTableView auf CardHoverZoom, Single-Tap-Steuerung, zentrale GothTopbar-Statistik-Endpunkte und SolitaireBottomBar-Overflow-Buttons aktualisiert.
Überarbeitetes Spielende & Modal-Architektur:
- ModalVeil (view/widgets/modal_veil.py) implementiert: Dunkelt das gesperrte Spielfeld halbtransparent ab, hebt aktive Dialoge garantiert über alle UI-Leisten und blockiert Eingaben sowie Tastenkürzel im Hintergrund.
- EndgameFxOverlay (view/widgets/endgame_fx_overlay.py) implementiert: Spielt vor dem Ergebnis-Dialog auf dem gesperrten Tisch Alpha-Kanal-Animationen ab (Sieg: firework_start.gif unten links + zufällig verteilte bat_explosion.gif / pumpkin_explosion.gif; Niederlage: zufällig verteilte foul_pumpkin.gif) und wechselt erst per Klick zum Result-Screen.
- ResourceManager und AssetManager um den Pfad resources/images/win_lose/, RGBA-GIF-Sequenz-Caching inkl. Original-Frame-Dauern, abgedunkelte Veil-Texturen und Startup-Preloading erweitert.
- Eingebettete GIF-Animationen aus SolitaireModalDialog, BlackjackResultDialog und PokerResultDialog vollständig entfernt und alle drei Ergebnis-Fenster auf ModalVeil umgestellt.
2026-11-21 23:02:21 +00:00
|
|
|
frames: list[ImageTk.PhotoImage] = []
|
2026-11-14 04:25:51 +00:00
|
|
|
path = self.res.get_ui_image_path(key_or_filename)
|
|
|
|
|
if path.is_file():
|
|
|
|
|
try:
|
|
|
|
|
with Image.open(path) as gif:
|
|
|
|
|
idx = 0
|
|
|
|
|
while True:
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
frames.append(ImageTk.PhotoImage(gif.copy().convert("RGBA").resize(size, Image.Resampling.BILINEAR)))
|
2026-11-14 04:25:51 +00:00
|
|
|
idx += 1
|
|
|
|
|
gif.seek(idx)
|
2026-11-26 22:50:56 +00:00
|
|
|
except (EOFError, Exception):
|
2026-11-14 04:25:51 +00:00
|
|
|
pass
|
|
|
|
|
self._tk_cache[cache_key] = frames
|
2026-11-19 21:47:35 +00:00
|
|
|
return self._tk_cache[cache_key]
|
|
|
|
|
|
feat(solitaire,ui): add Z-order card hover peek, single-tap move setting, ModalVeil, and EndgameFxOverlay
Solitaire UX & Bedienhilfen:
- CardHoverZoom (games/solitaire/base/card_hover_zoom.py) eingeführt: Hebt offene Karten beim Überfahren dezent an und vergrößert sie leicht unter Beibehaltung der exakten Z-Order im Stapel, sodass aufliegende Folgekarten sichtbar bleiben (inkl. 3er-Ablagefächer in Klondike und blockierter Zwischenkarten in FreeCell/Spider).
- Persistente Einstellung "Einfacher Klick zum Schieben" / "Single tap to move" (games/solitaire/base/solitaire_tap_prefs.py) ergänzt: Kurze Einzelklicks (<= 0.28s) führen automatisch Züge aus, während längeres Halten ignoriert wird und Drag & Drop uneingeschränkt erhalten bleibt.
- AudioSettingsDialog (view/dialogs/audio_settings_dialog.py) um den neuen GothSwitch erweitert, Layout auf 768p-Kompatibilität (DLG_H = 656) optimiert und alle Dialogtexte sauber auf base_i18n (01_allgemein.sql) umgestellt.
- FreeCellTableView, KlondikeTableView und SpiderTableView auf CardHoverZoom, Single-Tap-Steuerung, zentrale GothTopbar-Statistik-Endpunkte und SolitaireBottomBar-Overflow-Buttons aktualisiert.
Überarbeitetes Spielende & Modal-Architektur:
- ModalVeil (view/widgets/modal_veil.py) implementiert: Dunkelt das gesperrte Spielfeld halbtransparent ab, hebt aktive Dialoge garantiert über alle UI-Leisten und blockiert Eingaben sowie Tastenkürzel im Hintergrund.
- EndgameFxOverlay (view/widgets/endgame_fx_overlay.py) implementiert: Spielt vor dem Ergebnis-Dialog auf dem gesperrten Tisch Alpha-Kanal-Animationen ab (Sieg: firework_start.gif unten links + zufällig verteilte bat_explosion.gif / pumpkin_explosion.gif; Niederlage: zufällig verteilte foul_pumpkin.gif) und wechselt erst per Klick zum Result-Screen.
- ResourceManager und AssetManager um den Pfad resources/images/win_lose/, RGBA-GIF-Sequenz-Caching inkl. Original-Frame-Dauern, abgedunkelte Veil-Texturen und Startup-Preloading erweitert.
- Eingebettete GIF-Animationen aus SolitaireModalDialog, BlackjackResultDialog und PokerResultDialog vollständig entfernt und alle drei Ergebnis-Fenster auf ModalVeil umgestellt.
2026-11-21 23:02:21 +00:00
|
|
|
def get_win_lose_gif_sequence(
|
|
|
|
|
self, stem_or_filename: str, size: tuple[int, int]
|
|
|
|
|
) -> tuple[list[ImageTk.PhotoImage], list[int]]:
|
|
|
|
|
tw, th = max(24, int(size[0])), max(24, int(size[1]))
|
|
|
|
|
cache_key = ("win_lose_gif", stem_or_filename, (tw, th))
|
|
|
|
|
if cache_key in self._tk_cache:
|
|
|
|
|
return self._tk_cache[cache_key]
|
|
|
|
|
|
|
|
|
|
raw_pil_key = ("win_lose_raw_pil", stem_or_filename)
|
|
|
|
|
if raw_pil_key not in self._pil_cache:
|
2026-11-26 22:50:56 +00:00
|
|
|
raw_frames, raw_durs = [], []
|
feat(solitaire,ui): add Z-order card hover peek, single-tap move setting, ModalVeil, and EndgameFxOverlay
Solitaire UX & Bedienhilfen:
- CardHoverZoom (games/solitaire/base/card_hover_zoom.py) eingeführt: Hebt offene Karten beim Überfahren dezent an und vergrößert sie leicht unter Beibehaltung der exakten Z-Order im Stapel, sodass aufliegende Folgekarten sichtbar bleiben (inkl. 3er-Ablagefächer in Klondike und blockierter Zwischenkarten in FreeCell/Spider).
- Persistente Einstellung "Einfacher Klick zum Schieben" / "Single tap to move" (games/solitaire/base/solitaire_tap_prefs.py) ergänzt: Kurze Einzelklicks (<= 0.28s) führen automatisch Züge aus, während längeres Halten ignoriert wird und Drag & Drop uneingeschränkt erhalten bleibt.
- AudioSettingsDialog (view/dialogs/audio_settings_dialog.py) um den neuen GothSwitch erweitert, Layout auf 768p-Kompatibilität (DLG_H = 656) optimiert und alle Dialogtexte sauber auf base_i18n (01_allgemein.sql) umgestellt.
- FreeCellTableView, KlondikeTableView und SpiderTableView auf CardHoverZoom, Single-Tap-Steuerung, zentrale GothTopbar-Statistik-Endpunkte und SolitaireBottomBar-Overflow-Buttons aktualisiert.
Überarbeitetes Spielende & Modal-Architektur:
- ModalVeil (view/widgets/modal_veil.py) implementiert: Dunkelt das gesperrte Spielfeld halbtransparent ab, hebt aktive Dialoge garantiert über alle UI-Leisten und blockiert Eingaben sowie Tastenkürzel im Hintergrund.
- EndgameFxOverlay (view/widgets/endgame_fx_overlay.py) implementiert: Spielt vor dem Ergebnis-Dialog auf dem gesperrten Tisch Alpha-Kanal-Animationen ab (Sieg: firework_start.gif unten links + zufällig verteilte bat_explosion.gif / pumpkin_explosion.gif; Niederlage: zufällig verteilte foul_pumpkin.gif) und wechselt erst per Klick zum Result-Screen.
- ResourceManager und AssetManager um den Pfad resources/images/win_lose/, RGBA-GIF-Sequenz-Caching inkl. Original-Frame-Dauern, abgedunkelte Veil-Texturen und Startup-Preloading erweitert.
- Eingebettete GIF-Animationen aus SolitaireModalDialog, BlackjackResultDialog und PokerResultDialog vollständig entfernt und alle drei Ergebnis-Fenster auf ModalVeil umgestellt.
2026-11-21 23:02:21 +00:00
|
|
|
path = self.res.get_win_lose_gif_path(stem_or_filename)
|
|
|
|
|
if path.is_file():
|
|
|
|
|
try:
|
|
|
|
|
with Image.open(path) as gif:
|
|
|
|
|
idx = 0
|
|
|
|
|
while True:
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
dur = max(35, min(200, int(gif.info.get("duration", 65) or 65)))
|
feat(solitaire,ui): add Z-order card hover peek, single-tap move setting, ModalVeil, and EndgameFxOverlay
Solitaire UX & Bedienhilfen:
- CardHoverZoom (games/solitaire/base/card_hover_zoom.py) eingeführt: Hebt offene Karten beim Überfahren dezent an und vergrößert sie leicht unter Beibehaltung der exakten Z-Order im Stapel, sodass aufliegende Folgekarten sichtbar bleiben (inkl. 3er-Ablagefächer in Klondike und blockierter Zwischenkarten in FreeCell/Spider).
- Persistente Einstellung "Einfacher Klick zum Schieben" / "Single tap to move" (games/solitaire/base/solitaire_tap_prefs.py) ergänzt: Kurze Einzelklicks (<= 0.28s) führen automatisch Züge aus, während längeres Halten ignoriert wird und Drag & Drop uneingeschränkt erhalten bleibt.
- AudioSettingsDialog (view/dialogs/audio_settings_dialog.py) um den neuen GothSwitch erweitert, Layout auf 768p-Kompatibilität (DLG_H = 656) optimiert und alle Dialogtexte sauber auf base_i18n (01_allgemein.sql) umgestellt.
- FreeCellTableView, KlondikeTableView und SpiderTableView auf CardHoverZoom, Single-Tap-Steuerung, zentrale GothTopbar-Statistik-Endpunkte und SolitaireBottomBar-Overflow-Buttons aktualisiert.
Überarbeitetes Spielende & Modal-Architektur:
- ModalVeil (view/widgets/modal_veil.py) implementiert: Dunkelt das gesperrte Spielfeld halbtransparent ab, hebt aktive Dialoge garantiert über alle UI-Leisten und blockiert Eingaben sowie Tastenkürzel im Hintergrund.
- EndgameFxOverlay (view/widgets/endgame_fx_overlay.py) implementiert: Spielt vor dem Ergebnis-Dialog auf dem gesperrten Tisch Alpha-Kanal-Animationen ab (Sieg: firework_start.gif unten links + zufällig verteilte bat_explosion.gif / pumpkin_explosion.gif; Niederlage: zufällig verteilte foul_pumpkin.gif) und wechselt erst per Klick zum Result-Screen.
- ResourceManager und AssetManager um den Pfad resources/images/win_lose/, RGBA-GIF-Sequenz-Caching inkl. Original-Frame-Dauern, abgedunkelte Veil-Texturen und Startup-Preloading erweitert.
- Eingebettete GIF-Animationen aus SolitaireModalDialog, BlackjackResultDialog und PokerResultDialog vollständig entfernt und alle drei Ergebnis-Fenster auf ModalVeil umgestellt.
2026-11-21 23:02:21 +00:00
|
|
|
raw_frames.append(gif.copy().convert("RGBA"))
|
|
|
|
|
raw_durs.append(dur)
|
|
|
|
|
idx += 1
|
|
|
|
|
gif.seek(idx)
|
2026-11-26 22:50:56 +00:00
|
|
|
except (EOFError, Exception):
|
feat(solitaire,ui): add Z-order card hover peek, single-tap move setting, ModalVeil, and EndgameFxOverlay
Solitaire UX & Bedienhilfen:
- CardHoverZoom (games/solitaire/base/card_hover_zoom.py) eingeführt: Hebt offene Karten beim Überfahren dezent an und vergrößert sie leicht unter Beibehaltung der exakten Z-Order im Stapel, sodass aufliegende Folgekarten sichtbar bleiben (inkl. 3er-Ablagefächer in Klondike und blockierter Zwischenkarten in FreeCell/Spider).
- Persistente Einstellung "Einfacher Klick zum Schieben" / "Single tap to move" (games/solitaire/base/solitaire_tap_prefs.py) ergänzt: Kurze Einzelklicks (<= 0.28s) führen automatisch Züge aus, während längeres Halten ignoriert wird und Drag & Drop uneingeschränkt erhalten bleibt.
- AudioSettingsDialog (view/dialogs/audio_settings_dialog.py) um den neuen GothSwitch erweitert, Layout auf 768p-Kompatibilität (DLG_H = 656) optimiert und alle Dialogtexte sauber auf base_i18n (01_allgemein.sql) umgestellt.
- FreeCellTableView, KlondikeTableView und SpiderTableView auf CardHoverZoom, Single-Tap-Steuerung, zentrale GothTopbar-Statistik-Endpunkte und SolitaireBottomBar-Overflow-Buttons aktualisiert.
Überarbeitetes Spielende & Modal-Architektur:
- ModalVeil (view/widgets/modal_veil.py) implementiert: Dunkelt das gesperrte Spielfeld halbtransparent ab, hebt aktive Dialoge garantiert über alle UI-Leisten und blockiert Eingaben sowie Tastenkürzel im Hintergrund.
- EndgameFxOverlay (view/widgets/endgame_fx_overlay.py) implementiert: Spielt vor dem Ergebnis-Dialog auf dem gesperrten Tisch Alpha-Kanal-Animationen ab (Sieg: firework_start.gif unten links + zufällig verteilte bat_explosion.gif / pumpkin_explosion.gif; Niederlage: zufällig verteilte foul_pumpkin.gif) und wechselt erst per Klick zum Result-Screen.
- ResourceManager und AssetManager um den Pfad resources/images/win_lose/, RGBA-GIF-Sequenz-Caching inkl. Original-Frame-Dauern, abgedunkelte Veil-Texturen und Startup-Preloading erweitert.
- Eingebettete GIF-Animationen aus SolitaireModalDialog, BlackjackResultDialog und PokerResultDialog vollständig entfernt und alle drei Ergebnis-Fenster auf ModalVeil umgestellt.
2026-11-21 23:02:21 +00:00
|
|
|
pass
|
|
|
|
|
self._pil_cache[raw_pil_key] = (raw_frames, raw_durs)
|
|
|
|
|
|
|
|
|
|
src_frames, src_durs = self._pil_cache[raw_pil_key]
|
2026-11-26 22:50:56 +00:00
|
|
|
self._tk_cache[cache_key] = (
|
|
|
|
|
[ImageTk.PhotoImage(fr.resize((tw, th), Image.Resampling.LANCZOS)) for fr in src_frames],
|
|
|
|
|
list(src_durs),
|
|
|
|
|
)
|
refactor(arch,ui,stats): modularize codebase (<500 LOC/file), unify stats hub & refine win FX
Großes Architektur-, Deduplizierungs- & UI-Release:
- Strikte Modularisierung (<500 Zeilen pro Datei, 1 Klasse pro Modul, pyscn Health Score 97/100).
- Gemeinsame Basis-Klassen extrahiert: SolitaireMenuBase, SolitaireTableController, SolitaireSessionGuard, SolitaireCanvasInput, SolitaireOutcomeFlow, LuckPouchMenuBase, CasinoArenaBase & CasinoResultDialogBase.
- UnifiedStatsView: kategorisierter Statistik-Hub (Glück, Solitaire, Bayerische Spiele, Gesellschaft) ohne Äpfel-mit-Birnen-Gesamtansicht.
- PokerResultDialog auf das Gothic-Canvas-Rahmendesign gehoben.
- EndgameFxOverlay: Feuerwerksraketen entfernt, direkter Spawn von Fledermaus- und Kürbis-Explosionen.
2026-11-22 22:07:57 +00:00
|
|
|
return self._tk_cache[cache_key]
|
feat(solitaire,ui): add Z-order card hover peek, single-tap move setting, ModalVeil, and EndgameFxOverlay
Solitaire UX & Bedienhilfen:
- CardHoverZoom (games/solitaire/base/card_hover_zoom.py) eingeführt: Hebt offene Karten beim Überfahren dezent an und vergrößert sie leicht unter Beibehaltung der exakten Z-Order im Stapel, sodass aufliegende Folgekarten sichtbar bleiben (inkl. 3er-Ablagefächer in Klondike und blockierter Zwischenkarten in FreeCell/Spider).
- Persistente Einstellung "Einfacher Klick zum Schieben" / "Single tap to move" (games/solitaire/base/solitaire_tap_prefs.py) ergänzt: Kurze Einzelklicks (<= 0.28s) führen automatisch Züge aus, während längeres Halten ignoriert wird und Drag & Drop uneingeschränkt erhalten bleibt.
- AudioSettingsDialog (view/dialogs/audio_settings_dialog.py) um den neuen GothSwitch erweitert, Layout auf 768p-Kompatibilität (DLG_H = 656) optimiert und alle Dialogtexte sauber auf base_i18n (01_allgemein.sql) umgestellt.
- FreeCellTableView, KlondikeTableView und SpiderTableView auf CardHoverZoom, Single-Tap-Steuerung, zentrale GothTopbar-Statistik-Endpunkte und SolitaireBottomBar-Overflow-Buttons aktualisiert.
Überarbeitetes Spielende & Modal-Architektur:
- ModalVeil (view/widgets/modal_veil.py) implementiert: Dunkelt das gesperrte Spielfeld halbtransparent ab, hebt aktive Dialoge garantiert über alle UI-Leisten und blockiert Eingaben sowie Tastenkürzel im Hintergrund.
- EndgameFxOverlay (view/widgets/endgame_fx_overlay.py) implementiert: Spielt vor dem Ergebnis-Dialog auf dem gesperrten Tisch Alpha-Kanal-Animationen ab (Sieg: firework_start.gif unten links + zufällig verteilte bat_explosion.gif / pumpkin_explosion.gif; Niederlage: zufällig verteilte foul_pumpkin.gif) und wechselt erst per Klick zum Result-Screen.
- ResourceManager und AssetManager um den Pfad resources/images/win_lose/, RGBA-GIF-Sequenz-Caching inkl. Original-Frame-Dauern, abgedunkelte Veil-Texturen und Startup-Preloading erweitert.
- Eingebettete GIF-Animationen aus SolitaireModalDialog, BlackjackResultDialog und PokerResultDialog vollständig entfernt und alle drei Ergebnis-Fenster auf ModalVeil umgestellt.
2026-11-21 23:02:21 +00:00
|
|
|
|
2026-11-19 21:47:35 +00:00
|
|
|
def preload_startup_assets(self, init_win_size: tuple[int, int] = (1280, 760), on_step=None):
|
2026-11-26 22:50:56 +00:00
|
|
|
run_startup_preload(self, init_win_size=init_win_size, on_step=on_step)
|