2026-11-14 04:25:51 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
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
|
|
|
# view/widgets/resizing_bg.py
|
2026-11-14 04:25:51 +00:00
|
|
|
import tkinter as tk
|
|
|
|
|
from PIL import Image, 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
|
|
|
class ResizingBG(tk.Canvas):
|
|
|
|
|
"""
|
|
|
|
|
Vollbild-Hintergrund-Canvas:
|
|
|
|
|
Wechselt je nach Seitenverhältnis automatisch zwischen background_horizontal.jpg (w >= h)
|
|
|
|
|
und background_vertical.jpg (h > w) und dient gleichzeitig als rahmenlose Zeichenfläche.
|
|
|
|
|
"""
|
|
|
|
|
def __init__(self, parent, pil_horizontal, pil_vertical=None, **kwargs):
|
|
|
|
|
kwargs.setdefault("highlightthickness", 0)
|
|
|
|
|
kwargs.setdefault("bd", 0)
|
|
|
|
|
super().__init__(parent, **kwargs)
|
|
|
|
|
self.raw_horiz = pil_horizontal
|
|
|
|
|
self.raw_vert = pil_vertical or pil_horizontal
|
2026-11-14 04:25:51 +00:00
|
|
|
self._photo = None
|
|
|
|
|
self._resize_job = 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._last_size = (0, 0)
|
|
|
|
|
self.bind("<Configure>", self._on_resize, add="+")
|
|
|
|
|
|
|
|
|
|
def _pick_source_image(self, w: int, h: int):
|
|
|
|
|
if h > w and self.raw_vert is not None:
|
|
|
|
|
return self.raw_vert
|
|
|
|
|
return self.raw_horiz or self.raw_vert
|
2026-11-14 04:25:51 +00:00
|
|
|
|
|
|
|
|
def _on_resize(self, event):
|
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
|
|
|
if event.widget != self:
|
|
|
|
|
return
|
2026-11-14 04:25:51 +00:00
|
|
|
w, h = max(1, event.width), max(1, event.height)
|
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
|
|
|
if (w, h) == self._last_size:
|
|
|
|
|
return
|
|
|
|
|
if self._resize_job:
|
|
|
|
|
try:
|
|
|
|
|
self.after_cancel(self._resize_job)
|
|
|
|
|
except Exception:
|
|
|
|
|
pass
|
|
|
|
|
if self._photo is None:
|
|
|
|
|
self._render(w, h)
|
|
|
|
|
else:
|
|
|
|
|
self._resize_job = self.after(45, lambda: self._render(w, h))
|
2026-11-14 04:25:51 +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
|
|
|
def _render(self, w: int, h: int):
|
|
|
|
|
self._resize_job = None
|
|
|
|
|
src = self._pick_source_image(w, h)
|
|
|
|
|
if not self.winfo_exists() or src is None:
|
|
|
|
|
return
|
|
|
|
|
self._last_size = (w, h)
|
|
|
|
|
resized = src.resize((w, h), Image.Resampling.LANCZOS)
|
2026-11-14 04:25:51 +00:00
|
|
|
self._photo = ImageTk.PhotoImage(resized)
|
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.delete("bg_img")
|
|
|
|
|
self.create_image(0, 0, image=self._photo, anchor="nw", tags="bg_img")
|
|
|
|
|
self.tag_lower("bg_img")
|