feat(build,blackjack,docs): add cross-platform single-file build scripts, full Blackjack showdown reveal & updated READMEs

This commit is contained in:
thw 2026-11-15 00:28:01 +01:00
parent c08e2e17fd
commit 5929831402
9 changed files with 744 additions and 185 deletions

View File

@ -1,87 +1,122 @@
@echo off
setlocal EnableDelayedExpansion
REM =============================================================================
REM The Goth Cardgame Collection - One-File Build Script (Windows)
REM The Goth Cardgame Collection - One-File Build Script (Windows + WSL)
REM Output: dist\windows\TheGothCardgameCollection.exe
REM Usage: build_scripts\build.bat [--current | --all | --clean]
REM =============================================================================
set "SCRIPT_FILE=%~f0"
cd /d "%~dp0.."
set "PROJECT_ROOT=%CD%"
set "APP_NAME=TheGothCardgameCollection"
set "MAIN_FILE=main.py"
set "RES_DIR=resources"
set "GAMES_DIR=games"
set "MODE=%~1"
if "%MODE%"=="" set "MODE=--current"
if /I "%MODE%"=="--clean" (
echo [CLEAN] Entferne temporaere Build-Ordner...
if exist "build" rmdir /s /q "build"
if exist ".venv_build_win" rmdir /s /q ".venv_build_win"
echo [OK] Aufgeraeumt ^(dist\ blieb erhalten^).
del /q "*.spec" 2>nul
echo [OK] Temporaere Build-Dateien bereinigt.
exit /b 0
)
echo ============================================================
echo Building %APP_NAME%.exe ^(Single-File^) -^> dist\windows\
echo ============================================================
REM ----------------------------------------------------
REM 0. ADMIN-RECHTE PRUEFEN (net session)
REM ----------------------------------------------------
set "IS_ADMIN=0"
net session >nul 2>nul
if not errorlevel 1 set "IS_ADMIN=1"
set "PY_CMD="
where python >nul 2>nul && (
python -c "import sys; sys.exit(0)" >nul 2>nul && set "PY_CMD=python"
)
if "%PY_CMD%"=="" (
where py >nul 2>nul && (
py -3 -c "import sys; sys.exit(0)" >nul 2>nul && set "PY_CMD=py -3"
)
)
if "%PY_CMD%"=="" (
where python3 >nul 2>nul && (
python3 -c "import sys; sys.exit(0)" >nul 2>nul && set "PY_CMD=python3"
)
REM Kaputte Altlast-Venvs vorab bereinigen
if exist ".venv_build_win" (
if not exist ".venv_build_win\Scripts\python.exe" rmdir /s /q ".venv_build_win"
)
if "%PY_CMD%"=="" (
echo [ERROR] Keine funktionierende Python-3-Installation im PATH gefunden!
pause
REM Vorhandenes Python ermitteln
call :FIND_PYTHON
REM Pruefen, ob System-Installationen noetig sind (Python fehlt oder WSL-Distro fehlt bei --all)
set "NEEDS_ADMIN=0"
if "%WIN_PY%"=="" set "NEEDS_ADMIN=1"
set "WSL_DISTRO="
if /I "%MODE%"=="--all" (
call :FIND_WSL_DISTRO
if "!WSL_DISTRO!"=="" set "NEEDS_ADMIN=1"
)
REM Falls etwas auf Systemebene installiert werden muss und KEINE Admin-Rechte vorliegen -> UAC anfordern!
if "%NEEDS_ADMIN%"=="1" if "%IS_ADMIN%"=="0" (
if /I "%~2"=="--elevated" (
echo [ERROR] Administrator-Rechte wurden verweigert oder konnten nicht erlangt werden!
echo Bitte starte die Konsole / PowerShell explizit "Als Administrator".
pause
exit /b 1
)
echo [ADMIN] Fehlende Systemkomponenten erkannt ^(Python oder WSL^).
echo Fordere Administrator-Rechte ueber Windows-UAC an...
powershell -NoProfile -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/k \"\"%SCRIPT_FILE%\" %MODE% --elevated\"' -Verb RunAs"
exit /b 0
)
echo ====================================================
echo Starte Build fuer %APP_NAME% ^(Modus: %MODE% ^| Admin: %IS_ADMIN%^)
echo ====================================================
REM Falls Python fehlte -> jetzt mit garantierten Admin-Rechten systemweit installieren
if "%WIN_PY%"=="" (
echo [BOOTSTRAP] Installiere Python 3.11 via winget ^(Administrator^)...
winget install -e --id Python.Python.3.11 --scope machine --accept-source-agreements --accept-package-agreements
for %%P in (
"%ProgramFiles%\Python311"
"%LocalAppData%\Programs\Python\Python311"
"C:\Python311"
) do (
if exist "%%~P\python.exe" set "PATH=%%~P;%%~P\Scripts;!PATH!"
)
call :FIND_PYTHON
)
if "%WIN_PY%"=="" (
echo [ERROR] Python 3.11+ konnte nicht gefunden oder installiert werden!
exit /b 1
)
set "VENV_DIR=%PROJECT_ROOT%\.venv_build_win"
if not exist "%VENV_DIR%\Scripts\python.exe" (
echo [1/3] Erstelle isolierte Build-Umgebung ^(.venv_build_win^)...
%PY_CMD% -m venv "%VENV_DIR%"
if errorlevel 1 exit /b 1
REM ----------------------------------------------------
REM TEIL 1: WINDOWS .EXE BAUEN
REM ----------------------------------------------------
echo.
echo ---^> [1] Baue Windows .exe mit %WIN_PY%...
REM Ohne Admin-Rechte & ausserhalb einer Venv installieren wir Pakete sauber mit --user
set "PIP_EXTRA="
if "%IS_ADMIN%"=="0" if "%USING_VENV%"=="0" set "PIP_EXTRA=--user"
%WIN_PY% -m pip install --upgrade pip
%WIN_PY% -m pip install %PIP_EXTRA% --upgrade pillow pygame pyinstaller
if errorlevel 1 (
echo [ERROR] Konnte Python-Pakete ^(PyInstaller/Pillow/Pygame^) nicht installieren!
exit /b 1
)
set "VENV_PY=%VENV_DIR%\Scripts\python.exe"
echo [2/3] Pruefe ^& aktualisiere Build-Abhaengigkeiten ^(PyInstaller, Pillow, Pygame^)...
"%VENV_PY%" -m pip install --upgrade --quiet pip
"%VENV_PY%" -m pip install --quiet pyinstaller pillow pygame
if errorlevel 1 exit /b 1
set "DIST_DIR=%PROJECT_ROOT%\dist\windows"
set "WORK_DIR=%PROJECT_ROOT%\build\windows"
if not exist "%DIST_DIR%" mkdir "%DIST_DIR%"
if not exist "%WORK_DIR%" mkdir "%WORK_DIR%"
set "ICON_ARG="
if exist "%PROJECT_ROOT%\resources\images\game_icon.ico" (
set "ICON_ARG=--icon %PROJECT_ROOT%\resources\images\game_icon.ico"
)
if exist "resources\images\game_icon.ico" set "ICON_ARG=--icon resources\images\game_icon.ico"
echo [3/3] Kompiliere kompakte Einzeldatei mit absoluten Ressourcen-Pfaden...
"%VENV_PY%" -m PyInstaller ^
%WIN_PY% -m PyInstaller ^
--noconfirm ^
--clean ^
--noconsole ^
--onefile ^
--windowed ^
--name "%APP_NAME%" ^
--distpath "%DIST_DIR%" ^
--workpath "%WORK_DIR%" ^
--specpath "%WORK_DIR%" ^
--clean ^
--distpath "dist\windows" ^
--workpath "build\windows" ^
--specpath "build\windows" ^
%ICON_ARG% ^
--add-data "%PROJECT_ROOT%\resources;resources" ^
--add-data "%PROJECT_ROOT%\games;games" ^
--add-data "%RES_DIR%;%RES_DIR%" ^
--add-data "%GAMES_DIR%;%GAMES_DIR%" ^
--collect-submodules games ^
--collect-submodules controller ^
--collect-submodules models ^
@ -92,35 +127,95 @@ echo [3/3] Kompiliere kompakte Einzeldatei mit absoluten Ressourcen-Pfaden...
--hidden-import tkinter.font ^
--hidden-import sqlite3 ^
--hidden-import PIL._tkinter_finder ^
--exclude-module matplotlib ^
--exclude-module numpy ^
--exclude-module scipy ^
--exclude-module pandas ^
--exclude-module pytest ^
--exclude-module unittest ^
--exclude-module pydoc ^
"%PROJECT_ROOT%\main.py"
--name "%APP_NAME%" ^
"%MAIN_FILE%"
if errorlevel 1 (
echo [ERROR] PyInstaller-Build fehlgeschlagen!
echo [ERROR] Windows-Build fehlgeschlagen!
exit /b 1
)
if exist "build\windows" rmdir /s /q "build\windows"
echo [OK] Windows-Build fertig: dist\windows\%APP_NAME%.exe
if exist "%WORK_DIR%" rmdir /s /q "%WORK_DIR%"
echo.
echo [DONE] Fertige ausfuehrbare Datei liegt bereit unter:
echo dist\windows\%APP_NAME%.exe
REM ----------------------------------------------------
REM TEIL 2: LINUX EXECUTABLE VIA WSL (nur bei --all)
REM ----------------------------------------------------
if /I "%MODE%"=="--all" (
where wsl >nul 2>nul
if not errorlevel 1 (
echo [WSL] Starte Linux-Build -^> dist/linux/%APP_NAME% ...
wsl bash ./build_scripts/build.sh --current
) else (
echo [SKIP] WSL nicht verfuegbar - ueberspringe Linux-Build.
echo.
echo ---^> [2] Baue Linux Executable ^(via WSL^)...
call :FIND_WSL_DISTRO
if "!WSL_DISTRO!"=="" (
echo [BOOTSTRAP] Keine Linux-Distribution in WSL gefunden. Installiere Ubuntu ^(als Administrator^)...
wsl.exe --install -d Ubuntu --no-launch
call :FIND_WSL_DISTRO
if "!WSL_DISTRO!"=="" (
echo [HINWEIS] WSL/Ubuntu wurde vorbereitet. Windows erfordert einmalig einen System-Neustart,
echo bevor Linux-Builds in WSL ausgefuehrt werden koennen!
goto :SUMMARY
)
)
echo [WSL] Nutze Distribution: !WSL_DISTRO! ^(als root fuer Paket-Rechte^)
set "WSL_PROJ_PATH="
for /f "usebackq delims=" %%P in (`wsl.exe -d "!WSL_DISTRO!" -u root -- wslpath -a "%PROJECT_ROOT%" 2^>nul`) do (
set "WSL_PROJ_PATH=%%P"
)
if "!WSL_PROJ_PATH!"=="" (
echo [ERROR] Konnte Projektpfad "%PROJECT_ROOT%" in WSL nicht aufloesen.
exit /b 1
)
REM Fuehrt build.sh in WSL direkt als root (-u root) aus -> keine Passwort-Abfrage & volle apt-Rechte!
wsl.exe -d "!WSL_DISTRO!" -u root -- bash -lc "cd '!WSL_PROJ_PATH!' && sed -i 's/\r$//' build_scripts/build.sh && chmod +x build_scripts/build.sh && ./build_scripts/build.sh --current"
if errorlevel 1 (
echo [ERROR] Linux-Build in WSL fehlgeschlagen!
exit /b 1
)
)
:SUMMARY
echo.
echo ====================================================
echo BUILD ABGESCHLOSSEN!
if exist "dist\windows\%APP_NAME%.exe" echo Windows: dist\windows\%APP_NAME%.exe
if exist "dist\linux\%APP_NAME%" echo Linux: dist\linux\%APP_NAME%
echo ====================================================
endlocal
exit /b 0
REM ====================================================
REM HILFSROUTINEN
REM ====================================================
:FIND_PYTHON
set "WIN_PY="
set "USING_VENV=0"
if exist ".venv\Scripts\python.exe" (
".venv\Scripts\python.exe" -m pip --version >nul 2>nul && (
set "WIN_PY=.venv\Scripts\python.exe"
set "USING_VENV=1"
)
)
if "%WIN_PY%"=="" (
where python >nul 2>nul && (
python -c "import sys, tkinter; sys.exit(0)" >nul 2>nul && set "WIN_PY=python"
)
)
if "%WIN_PY%"=="" (
where py >nul 2>nul && (
py -3 -c "import sys, tkinter; sys.exit(0)" >nul 2>nul && set "WIN_PY=py -3"
)
)
exit /b 0
:FIND_WSL_DISTRO
set "WSL_DISTRO="
where wsl.exe >nul 2>nul
if errorlevel 1 exit /b 0
for /f "usebackq delims=" %%L in (`powershell -NoProfile -Command "$d = (wsl.exe -l -q 2>$null) -replace '\x00','' | ForEach-Object { $_.Trim() } | Where-Object { $_ -and $_ -notmatch '^docker-desktop' }; if ($d) { $d | Select-Object -First 1 }"`) do (
if "!WSL_DISTRO!"=="" set "WSL_DISTRO=%%L"
)
exit /b 0

View File

@ -5,106 +5,162 @@
# Output: dist/<os>/TheGothCardgameCollection
# Usage: ./build_scripts/build.sh [--current | --all | --clean]
# =============================================================================
set -euo pipefail
set -e
# Immer ins Projekt-Hauptverzeichnis wechseln
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${PROJECT_ROOT}"
APP_NAME="TheGothCardgameCollection"
MAIN_FILE="main.py"
RES_DIR="resources"
GAMES_DIR="games"
ICON_FILE="resources/images/game_icon.ico"
MODE="${1:---current}"
if [[ "${MODE}" == "--clean" ]]; then
echo "[CLEAN] Entferne temporäre Build-Ordner..."
rm -rf build .venv_build_linux .venv_build_macos
echo "[OK] Aufgeräumt (dist/ blieb erhalten)."
if [ "$MODE" = "--clean" ]; then
echo "🧹 Räume temporäre Build-Ordner auf..."
rm -rf build .venv_build_* *.spec
exit 0
fi
# Ziel-OS automatisch erkennen
UNAME_OUT="$(uname -s)"
case "${UNAME_OUT}" in
Linux*) OS_NAME="linux" ;;
Darwin*) OS_NAME="macos" ;;
*) echo "[ERROR] Unbekanntes Unix-System: ${UNAME_OUT}"; exit 1 ;;
*) echo "❌ Unbekanntes Unix-System: ${UNAME_OUT}"; exit 1 ;;
esac
echo "============================================================"
echo " Building ${APP_NAME} (Single-File) -> dist/${OS_NAME}/"
echo "============================================================"
if ! command -v python3 >/dev/null 2>&1; then
echo "[ERROR] python3 nicht gefunden."
exit 1
# ----------------------------------------------------
# 0. ROOT / SUDO RECHTE-CHECK FÜR SYSTEM-INSTALLATIONEN
# ----------------------------------------------------
NEEDS_SYS_INSTALL=0
if ! command -v python3 &>/dev/null || ! python3 -c "import tkinter" &>/dev/null; then
NEEDS_SYS_INSTALL=1
fi
if [ "$MODE" = "--all" ] && [ "$OS_NAME" = "linux" ] && ! command -v wine &>/dev/null; then
NEEDS_SYS_INSTALL=1
fi
# Automatische Installation von python3-venv / python3-tk auf Linux/Ubuntu/Debian falls fehlend
if [[ "${OS_NAME}" == "linux" ]]; then
if ! python3 -c "import venv" >/dev/null 2>&1; then
echo "[INFO] Python venv Modul fehlt. Versuche automatische Installation..."
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update && sudo apt-get install -y python3-venv python3-tk || true
elif command -v dnf >/dev/null 2>&1; then
sudo dnf install -y python3-virtualenv python3-tkinter || true
elif command -v pacman >/dev/null 2>&1; then
sudo pacman -S --noconfirm python-virtualenv tk || true
if [ "$OS_NAME" = "linux" ] && [ "$NEEDS_SYS_INSTALL" -eq 1 ]; then
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
echo "🔒 Es fehlen Systempakete (z.B. python3-tk oder wine), für deren Installation Root-Rechte nötig sind."
if command -v sudo &>/dev/null; then
echo "🔑 Fordere Root-Rechte via sudo an und starte Skript neu..."
exec sudo -E bash "$SCRIPT_PATH" "$@"
else
echo "❌ FEHLER: Keine Root-Rechte (EUID != 0) und 'sudo' ist nicht installiert!"
echo " Bitte führe das Skript als root aus: su -c '$SCRIPT_PATH $MODE'"
exit 1
fi
fi
fi
if ! python3 -c "import tkinter" >/dev/null 2>&1; then
echo "[WARNING] Das Python-Modul 'tkinter' scheint zu fehlen."
echo " Bitte installieren: z.B. 'sudo apt install python3-tk' (Debian/Ubuntu/ChromeOS)"
# Echten User ermitteln (wichtig, falls Skript via sudo/root läuft, damit Wine & Dateirechte stimmen!)
if [ "${EUID:-$(id -u)}" -eq 0 ] && [ -n "${SUDO_USER:-}" ]; then
REAL_USER="$SUDO_USER"
REAL_HOME="$(getent passwd "$SUDO_USER" | cut -d: -f6)"
WINE_RUNNER=(sudo -u "$REAL_USER" HOME="$REAL_HOME")
else
REAL_USER="$(whoami)"
REAL_HOME="$HOME"
WINE_RUNNER=()
fi
# Isolierte Build-Venv anlegen & Dependencies automatisch installieren
VENV_DIR="${PROJECT_ROOT}/.venv_build_${OS_NAME}"
if [[ ! -d "${VENV_DIR}" ]]; then
echo "[1/3] Erstelle isolierte Build-Umgebung (${VENV_DIR})..."
if ! python3 -m venv "${VENV_DIR}"; then
echo "[ERROR] Konnte die virtuelle Umgebung nicht erstellen."
echo " Bitte installiere manuell: sudo apt install python3-venv (Ubuntu/Debian/ChromeOS)"
echo "===================================================="
echo " 🦇 Starte Build für $APP_NAME (OS: $OS_NAME | Modus: $MODE)"
echo "===================================================="
# ----------------------------------------------------
# SYSTEMPAKETE INSTALLIEREN (läuft garantiert als root!)
# ----------------------------------------------------
install_linux_pkgs() {
if command -v apt-get &>/dev/null; then
apt-get update -qq
apt-get install -y "$@"
elif command -v dnf &>/dev/null; then
dnf install -y "$@"
elif command -v yum &>/dev/null; then
yum install -y "$@"
elif command -v zypper &>/dev/null; then
zypper --non-interactive install "$@"
elif command -v pacman &>/dev/null; then
pacman -Sy --noconfirm --needed "$@"
else
echo "❌ Kein unterstützter Paketmanager (apt/dnf/yum/zypper/pacman) gefunden!"
exit 1
fi
}
if [ "$OS_NAME" = "linux" ] && { ! command -v python3 &>/dev/null || ! python3 -c "import tkinter" &>/dev/null; }; then
echo "⚙️ Installiere fehlende Python-/Tkinter-Systempakete..."
if command -v apt-get &>/dev/null; then
install_linux_pkgs python3 python3-pip python3-venv python3-tk wget
elif command -v dnf &>/dev/null || command -v yum &>/dev/null; then
install_linux_pkgs python3 python3-pip python3-tkinter wget
elif command -v zypper &>/dev/null; then
install_linux_pkgs python3 python3-pip python3-tk wget
elif command -v pacman &>/dev/null; then
install_linux_pkgs python python-pip tk wget
fi
elif [ "$OS_NAME" = "macos" ] && { ! command -v python3 &>/dev/null || ! python3 -c "import tkinter" &>/dev/null; }; then
if [ "${EUID:-$(id -u)}" -eq 0 ]; then
echo "❌ Unter macOS darf Homebrew nicht als root ausgeführt werden. Bitte ohne sudo starten."
exit 1
fi
if command -v brew &>/dev/null; then
brew install python@3.11 python-tk@3.11
else
echo "❌ Python3/Tkinter fehlt und Homebrew ist nicht installiert."
exit 1
fi
fi
# shellcheck disable=SC1091
source "${VENV_DIR}/bin/activate"
# ----------------------------------------------------
# TEIL 1: LINUX / MACOS EXECUTABLE BAUEN
# ----------------------------------------------------
echo ""
echo "---> [1] Baue ${OS_NAME} Executable..."
echo "[2/3] Prüfe & aktualisiere Build-Abhängigkeiten (PyInstaller, Pillow, Pygame)..."
python -m pip install --upgrade --quiet pip
python -m pip install --quiet pyinstaller pillow pygame
# Defekte Venvs automatisch bereinigen
for VDIR in ".venv_build_${OS_NAME}" ".venv" "venv"; do
if [ -d "$VDIR" ] && [ ! -x "$VDIR/bin/python3" ]; then
echo "🧹 Entferne defektes Venv: $VDIR"
rm -rf "$VDIR"
fi
done
# Ziel- & Arbeitsverzeichnisse vorbereiten
DIST_DIR="${PROJECT_ROOT}/dist/${OS_NAME}"
WORK_DIR="${PROJECT_ROOT}/build/${OS_NAME}"
mkdir -p "${DIST_DIR}" "${WORK_DIR}"
ICON_ARGS=()
if [[ -f "${PROJECT_ROOT}/resources/images/game_icon.ico" ]]; then
ICON_ARGS=(--icon "${PROJECT_ROOT}/resources/images/game_icon.ico")
if [ -x ".venv/bin/python3" ]; then
LINUX_PY=".venv/bin/python3"
elif [ -x "venv/bin/python3" ]; then
LINUX_PY="venv/bin/python3"
else
LINUX_PY="python3"
fi
STRIP_ARGS=()
if command -v strip >/dev/null 2>&1; then
STRIP_ARGS=(--strip)
# Falls wir nicht root sind und kein Venv nutzen, pip mit --user ausführen, damit es keine Permission-Errors gibt
PIP_USER_FLAG=()
if [ "$LINUX_PY" = "python3" ] && [ "${EUID:-$(id -u)}" -ne 0 ]; then
PIP_USER_FLAG=(--user)
fi
echo "[3/3] Kompiliere kompakte Einzeldatei mit absoluten Pfaden..."
python -m PyInstaller \
$LINUX_PY -m pip install "${PIP_USER_FLAG[@]}" --upgrade pillow pygame pyinstaller --break-system-packages 2>/dev/null \
|| $LINUX_PY -m pip install "${PIP_USER_FLAG[@]}" --upgrade pillow pygame pyinstaller
ICON_ARG=()
[ -f "$ICON_FILE" ] && ICON_ARG=(--icon "$ICON_FILE")
$LINUX_PY -m PyInstaller \
--noconfirm \
--clean \
--noconsole \
--onefile \
--windowed \
"${STRIP_ARGS[@]}" \
--name "${APP_NAME}" \
--distpath "${DIST_DIR}" \
--workpath "${WORK_DIR}" \
--specpath "${WORK_DIR}" \
"${ICON_ARGS[@]}" \
--add-data "${PROJECT_ROOT}/resources:resources" \
--add-data "${PROJECT_ROOT}/games:games" \
--clean \
--distpath "dist/${OS_NAME}" \
--workpath "build/${OS_NAME}" \
--specpath "build/${OS_NAME}" \
"${ICON_ARG[@]}" \
--add-data "${RES_DIR}:${RES_DIR}" \
--add-data "${GAMES_DIR}:${GAMES_DIR}" \
--collect-submodules games \
--collect-submodules controller \
--collect-submodules models \
@ -115,34 +171,96 @@ python -m PyInstaller \
--hidden-import tkinter.font \
--hidden-import sqlite3 \
--hidden-import PIL._tkinter_finder \
--exclude-module matplotlib \
--exclude-module numpy \
--exclude-module scipy \
--exclude-module pandas \
--exclude-module pytest \
--exclude-module unittest \
--exclude-module pydoc \
"${PROJECT_ROOT}/main.py"
--name "${APP_NAME}" \
"$MAIN_FILE"
deactivate
chmod +x "dist/${OS_NAME}/${APP_NAME}"
rm -rf "build/${OS_NAME}"
echo "✔ ${OS_NAME}-Build fertig: dist/${OS_NAME}/${APP_NAME}"
chmod +x "${DIST_DIR}/${APP_NAME}" 2>/dev/null || true
rm -rf "${WORK_DIR}"
# ----------------------------------------------------
# TEIL 2: WINDOWS .EXE BAUEN VIA WINE (nur bei --all unter Linux)
# ----------------------------------------------------
if [ "$MODE" = "--all" ] && [ "$OS_NAME" = "linux" ]; then
echo ""
echo "---> [2] Baue Windows .exe (via Wine)..."
if ! command -v wine &>/dev/null; then
echo "⚙️ Installiere 'wine' und 'wget' (Root-Rechte bereits geprüft)..."
if command -v apt-get &>/dev/null; then
dpkg --add-architecture amd64 2>/dev/null || true
install_linux_pkgs wine wget
else
install_linux_pkgs wine wget
fi
fi
if ! command -v wine &>/dev/null; then
echo "❌ 'wine' konnte nicht installiert werden!"
exit 1
fi
WINE_DRIVE_C="${REAL_HOME}/.wine/drive_c"
WINE_PY=$(find "$WINE_DRIVE_C" -iname "python.exe" 2>/dev/null | grep -i "Python3" | head -n 1 || true)
if [ -z "$WINE_PY" ]; then
echo "⚙️ Windows-Python in Wine (${WINE_DRIVE_C}) nicht gefunden. Installiere Python 3.11.9 automatisch..."
INSTALLER="/tmp/python-3.11.9-amd64.exe"
if [ ! -f "$INSTALLER" ]; then
wget -O "$INSTALLER" https://www.python.org/ftp/python/3.11.9/python-3.11.9-amd64.exe
fi
"${WINE_RUNNER[@]}" wine "$INSTALLER" /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
"${WINE_RUNNER[@]}" wineserver -w || true
rm -f "$INSTALLER"
WINE_PY=$(find "$WINE_DRIVE_C" -iname "python.exe" 2>/dev/null | grep -i "Python3" | head -n 1 || true)
fi
if [ -z "$WINE_PY" ]; then
echo "❌ Konnte python.exe in ${WINE_DRIVE_C} nicht finden!"
exit 1
fi
echo "✔ Nutze Wine-Python: $WINE_PY"
"${WINE_RUNNER[@]}" wine "$WINE_PY" -m pip install --upgrade pip pillow pygame pyinstaller
"${WINE_RUNNER[@]}" wine "$WINE_PY" -m PyInstaller \
--noconfirm \
--noconsole \
--onefile \
--clean \
--distpath "dist/windows" \
--workpath "build/windows" \
--specpath "build/windows" \
"${ICON_ARG[@]}" \
--add-data "${RES_DIR};${RES_DIR}" \
--add-data "${GAMES_DIR};${GAMES_DIR}" \
--collect-submodules games \
--collect-submodules controller \
--collect-submodules models \
--collect-submodules view \
--collect-submodules resources \
--hidden-import tkinter \
--hidden-import tkinter.ttk \
--hidden-import tkinter.font \
--hidden-import sqlite3 \
--hidden-import PIL._tkinter_finder \
--name "${APP_NAME}" \
"$MAIN_FILE"
rm -rf "build/windows"
echo "✔ Windows-Build fertig: dist/windows/${APP_NAME}.exe"
fi
# Falls via sudo gestartet, Besitzrechte von dist/ wieder auf den normalen User übertragen
if [ "${EUID:-$(id -u)}" -eq 0 ] && [ -n "${SUDO_USER:-}" ]; then
chown -R "$SUDO_USER:$SUDO_USER" dist/ 2>/dev/null || true
fi
echo ""
echo "[DONE] Fertige ausführbare Datei liegt bereit under:"
echo " dist/${OS_NAME}/${APP_NAME}"
# Optionaler Cross-Build via Wine (falls --all übergeben wurde und Wine + Python installiert ist)
if [[ "${MODE}" == "--all" && "${OS_NAME}" == "linux" ]]; then
echo ""
echo "------------------------------------------------------------"
echo " Prüfe optionalen Windows-Cross-Build via Wine..."
echo "------------------------------------------------------------"
if command -v wine >/dev/null 2>&1 && wine python --version >/dev/null 2>&1; then
echo "[WINE] Starte Windows-Build -> dist/windows/${APP_NAME}.exe ..."
wine cmd /c "build_scripts\\build.bat --current"
else
echo "[SKIP] Wine mit Windows-Python nicht gefunden – überspringe Windows-Cross-Build."
fi
fi
echo "===================================================="
echo " ✅ BUILD ERFOLGREICH ABGESCHLOSSEN!"
[ -f "dist/${OS_NAME}/${APP_NAME}" ] && echo " 🐧 ${OS_NAME}-Version: dist/${OS_NAME}/${APP_NAME}"
[ -f "dist/windows/${APP_NAME}.exe" ] && echo " 🪟 Windows-Version: dist/windows/${APP_NAME}.exe"
echo "===================================================="

View File

@ -343,9 +343,14 @@ class BlackjackTableView:
self._photo_refs.append(photo)
tk.Label(cards_f, image=photo, bg=CELL_BG, bd=0).pack(side="left", padx=2)
if reveal_opponents and bot.hand and bot.is_active_in_pot:
if reveal_opponents and bot.hand:
b_val, _ = HandEvaluator.evaluate(bot.hand)
info_txt = t("bj_bot_showdown_val", b_val, bot.bet_in_pot)
if bot.folded:
info_txt = t("bj_rank_folded", b_val)
elif bot.busted:
info_txt = t("bj_rank_busted", b_val)
else:
info_txt = t("bj_bot_showdown_val", b_val, bot.bet_in_pot)
elif bot.status_text:
info_txt = bot.status_text
elif bot.hand:
@ -929,11 +934,120 @@ class BlackjackTableView:
)
return xp_gained, (new_lvl if new_lvl > old_lvl else None)
@staticmethod
def _format_hand_rank_label(
cards, is_split: bool = False, busted: bool = False, folded: bool = False
) -> str:
val, _ = HandEvaluator.evaluate(cards)
if folded:
return t("bj_rank_folded", val)
if busted or val > 21:
return t("bj_rank_busted", val)
if HandEvaluator.is_triple_seven(cards):
return t("bj_rank_777")
if not is_split and HandEvaluator.is_natural_blackjack(cards):
return t("bj_rank_natural_bj")
if val == 21:
return t("bj_rank_split_21") if is_split else t("bj_rank_multi_21", len(cards))
return t("bj_rank_points", val, len(cards))
def _collect_showdown_snapshot(self, instant_777_winner: str | None = None) -> list[dict]:
"""Serialisiert alle Tischhände JSON-sicher für Popup & Devil's-Deal-Save."""
snapshot: list[dict] = []
# 1. Haus-Dealer
d_cards = self.engine.dealer_hand
d_val, _ = HandEvaluator.evaluate(d_cards)
d_rank = self.engine._hand_rank(d_cards)
snapshot.append({
"role": "DEALER",
"name": "",
"hand_no": 0,
"card_images": [c.image_filename for c in d_cards],
"cards_raw": [[c.suit, c.rank] for c in d_cards],
"is_split": False,
"busted": d_val > 21,
"folded": False,
"rank_tuple": list(d_rank),
})
# 2. Spieler-Hand / Split-Hände
multi_p = len(self.engine.player_hands) > 1
for idx, h in enumerate(self.engine.player_hands):
hr = self.engine._hand_rank(h.cards, is_split=h.is_split_hand) if h.is_active_in_pot else (0, 0)
snapshot.append({
"role": "PLAYER",
"name": "",
"hand_no": (idx + 1) if multi_p else 0,
"card_images": [c.image_filename for c in h.cards],
"cards_raw": [[c.suit, c.rank] for c in h.cards],
"is_split": h.is_split_hand,
"busted": h.busted,
"folded": h.folded,
"rank_tuple": list(hr),
})
# 3. Alle Bots am Tisch
for b in self.bots:
br = self.engine._hand_rank(b.hand) if b.is_active_in_pot else (0, 0)
snapshot.append({
"role": "BOT",
"name": b.name,
"hand_no": 0,
"card_images": [c.image_filename for c in b.hand],
"cards_raw": [[c.suit, c.rank] for c in b.hand],
"is_split": False,
"busted": b.busted,
"folded": b.folded,
"rank_tuple": list(br),
})
# Gewinner-Markierung anhand derselben Showdown-Regeln wie BlackjackEngine
contenders = [s for s in snapshot if s["role"] != "DEALER" and not s["busted"] and not s["folded"]]
dealer_entry = snapshot[0]
if instant_777_winner is not None:
for s in snapshot:
if instant_777_winner == "PLAYER" and s["role"] == "PLAYER" and s["rank_tuple"] == [3, 21]:
s["is_winner"] = True
elif s["role"] == "BOT" and s["name"] == instant_777_winner and s["rank_tuple"] == [3, 21]:
s["is_winner"] = True
else:
s["is_winner"] = False
return snapshot
if not contenders:
dealer_entry["is_winner"] = True
for s in snapshot[1:]:
s["is_winner"] = False
return snapshot
best_contender = max(tuple(s["rank_tuple"]) for s in contenders)
d_rnk = tuple(dealer_entry["rank_tuple"])
if d_rnk > best_contender:
dealer_entry["is_winner"] = True
for s in snapshot[1:]:
s["is_winner"] = False
elif d_rnk == best_contender:
dealer_entry["is_winner"] = True
for s in snapshot[1:]:
s["is_winner"] = (not s["busted"] and not s["folded"] and tuple(s["rank_tuple"]) == best_contender)
else:
dealer_entry["is_winner"] = False
for s in snapshot[1:]:
s["is_winner"] = (not s["busted"] and not s["folded"] and tuple(s["rank_tuple"]) == best_contender)
return snapshot
def _trigger_instant_777_win(self, winner_is_player: bool, winning_bot: BlackjackBotSeat | None):
self.engine.state = "SHOWDOWN"
self._count_all_table_cards()
pot_total = self.engine.pot
total_p_bet = self.engine.total_player_bet
snap = self._collect_showdown_snapshot(
instant_777_winner="PLAYER" if winner_is_player else winning_bot.name
)
if winner_is_player:
payout = pot_total + (total_p_bet if not self.bots else 0)
@ -944,12 +1058,14 @@ class BlackjackTableView:
payload = {
"winner_type": "PLAYER",
"winner_names": [],
"instant_777": "PLAYER",
"player_won": True,
"player_net": net,
"bank_gain": 0,
"bot_gains": [],
"xp_gained": xp,
"leveled_to": leveled_to,
"showdown_snapshot": snap,
}
else:
winning_bot.gold += pot_total
@ -959,12 +1075,14 @@ class BlackjackTableView:
payload = {
"winner_type": "BOT",
"winner_names": [winning_bot.name],
"instant_777": winning_bot.name,
"player_won": False,
"player_net": -total_p_bet,
"bank_gain": 0,
"bot_gains": [(winning_bot.name, bot_net)] if bot_net > 0 else [],
"xp_gained": xp,
"leveled_to": leveled_to,
"showdown_snapshot": snap,
}
self._last_popup_payload = payload
@ -1016,6 +1134,7 @@ class BlackjackTableView:
def _finalize_showdown(self):
self._count_all_table_cards()
res = self.engine.resolve_showdown(self.bots)
snap = self._collect_showdown_snapshot(instant_777_winner=None)
if res["player_payout"] > 0:
self.bj_account = Database.update_blackjack_gold(self.bj_account["id"], res["player_payout"])
@ -1043,12 +1162,14 @@ class BlackjackTableView:
payload = {
"winner_type": w_type,
"winner_names": res["winner_names"],
"instant_777": None,
"player_won": player_won_flag,
"player_net": res["player_net"],
"bank_gain": res["bank_gain"],
"bot_gains": res["bot_gains"],
"xp_gained": xp,
"leveled_to": leveled_to,
"showdown_snapshot": snap,
}
self._last_popup_payload = payload
if self.devils_locked:
@ -1060,6 +1181,8 @@ class BlackjackTableView:
self._open_result_popup(self._build_localized_popup_data(payload))
def _build_localized_popup_data(self, payload: dict) -> dict:
from models.card import Card
w_type = payload["winner_type"]
if w_type == "BANK":
headline = t("bj_popup_bank_won")
@ -1070,6 +1193,41 @@ class BlackjackTableView:
else:
headline = t("bj_popup_tie")
# Lokalisierte Hand-Karten & Begründung aufbauen
showdown_hands = []
raw_snap = payload.get("showdown_snapshot", [])
for s in raw_snap:
cards_obj = [Card(sr[0], sr[1]) for sr in s.get("cards_raw", [])]
if s["role"] == "DEALER":
owner_lbl = t("bj_showdown_seat_dealer")
elif s["role"] == "PLAYER":
owner_lbl = (
t("bj_showdown_seat_you_hand", s["hand_no"])
if s.get("hand_no") else t("bj_showdown_seat_you")
)
else:
owner_lbl = s["name"]
rank_lbl = self._format_hand_rank_label(
cards_obj,
is_split=s.get("is_split", False),
busted=s.get("busted", False),
folded=s.get("folded", False),
)
showdown_hands.append({
"owner_label": owner_lbl,
"is_dealer": (s["role"] == "DEALER"),
"is_winner": s.get("is_winner", False),
"busted": s.get("busted", False),
"folded": s.get("folded", False),
"card_images": s.get("card_images", []),
"rank_label": rank_lbl,
"rank_tuple": tuple(s.get("rank_tuple", [0, 0])),
"role": s["role"],
})
reason_text = self._build_showdown_reason(payload, showdown_hands)
other_gains = []
if payload["bank_gain"] > 0:
other_gains.append(t("bj_popup_bank_gain", payload["bank_gain"]))
@ -1088,6 +1246,8 @@ class BlackjackTableView:
return {
"headline": headline,
"reason_text": reason_text,
"showdown_hands": showdown_hands,
"player_won": payload["player_won"],
"player_net": payload["player_net"],
"other_gains": other_gains,
@ -1097,6 +1257,65 @@ class BlackjackTableView:
"can_leave_menu": not self.devils_locked,
}
@staticmethod
def _build_showdown_reason(payload: dict, showdown_hands: list[dict]) -> str:
if not showdown_hands:
return ""
inst = payload.get("instant_777")
if inst:
who = t("bj_showdown_seat_you") if inst == "PLAYER" else inst
return t("bj_reason_777_win", who)
dealer = showdown_hands[0]
contenders = [h for h in showdown_hands[1:] if not h["busted"] and not h["folded"]]
if not contenders:
return t("bj_reason_all_out")
winners = [h for h in showdown_hands if h["is_winner"]]
if not winners:
return ""
top_rank = winners[0]["rank_tuple"]
winner_names_str = ", ".join(dict.fromkeys(w["owner_label"] for w in winners if not w["is_dealer"]))
# Fall 1: Gleichstand mit dem Haus-Dealer (Push)
if dealer["is_winner"] and len(winners) > 1:
return t("bj_reason_dealer_tie_push", dealer["rank_label"])
# Fall 2: Jemand hat ebenfalls 21 Punkte, verliert aber wegen 2-Karten-Blackjack oder 7-7-7!
losers_with_21 = [
h for h in showdown_hands
if not h["is_winner"] and not h["busted"] and not h["folded"] and h["rank_tuple"][1] == 21
]
win_label = dealer["owner_label"] if dealer["is_winner"] else winner_names_str
if top_rank == (3, 21) and losers_with_21:
return t("bj_reason_777_beats_21", win_label)
if top_rank == (2, 21) and losers_with_21:
return t("bj_reason_nat_beats_reg21", win_label)
# Fall 3: Mehrere Spieler/Bots teilen sich den Sieg
non_dealer_winners = [w for w in winners if not w["is_dealer"]]
if len(non_dealer_winners) > 1:
return t("bj_reason_split_pot", non_dealer_winners[0]["rank_label"], winner_names_str)
# Fall 4: Haus-Dealer hat sich überkauft
if dealer["busted"] and not dealer["is_winner"]:
return t("bj_reason_dealer_bust", dealer["rank_label"], win_label, winners[0]["rank_label"])
# Fall 5: Regulärer Punktesieg gegen die nächstbeste Hand am Tisch
others_alive = [
h for h in showdown_hands
if not h["is_winner"] and not h["busted"] and not h["folded"]
]
if others_alive:
runner_up = max(others_alive, key=lambda x: x["rank_tuple"])
runner_desc = f"{runner_up['owner_label']}: {runner_up['rank_label']}"
else:
runner_desc = f"{dealer['owner_label']}: {dealer['rank_label']}"
return t("bj_reason_higher_score", win_label, winners[0]["rank_label"], runner_desc)
def _open_result_popup(self, popup_data: dict):
for w in self.controls_frame.winfo_children():
w.destroy()

View File

@ -3,11 +3,13 @@
import tkinter as tk
from resources.code_res.game_constants import (
ACCENT_GOLD, ACCENT_GOTH, CELL_BG, ERROR_FG,
FG_COLOR, MODAL_BG, MUTED_FG, SUBTLE_BORDER
FG_COLOR, MODAL_BG, MUTED_FG, PANEL_BG, SUBTLE_BORDER
)
from resources.code_res.i18n import t
from view.widgets.image_button import ImageButton
SHOWDOWN_MINI_CARD_SIZE = (52, 76)
class BlackjackResultDialog(tk.Frame):
def __init__(
@ -20,7 +22,7 @@ class BlackjackResultDialog(tk.Frame):
on_back_to_menu,
):
super().__init__(
parent, bg=MODAL_BG, padx=32, pady=24,
parent, bg=MODAL_BG, padx=26, pady=18,
highlightthickness=2, highlightbackground=ACCENT_GOTH
)
self.assets = assets
@ -29,14 +31,19 @@ class BlackjackResultDialog(tk.Frame):
self.on_next_round = on_next_round
self.on_back_to_menu = on_back_to_menu
self._gif_job = None
self._card_photos = []
self.place(relx=0.5, rely=0.5, anchor="center")
self.lift()
self._build()
def _build(self):
self.gif_lbl = tk.Label(self, bg=MODAL_BG, bd=0)
self.gif_lbl.pack(pady=(0, 6))
# Kompaktere Kopfzeile (GIF + Headline), damit alle Karten sauber Platz haben
header_row = tk.Frame(self, bg=MODAL_BG)
header_row.pack(pady=(0, 6))
self.gif_lbl = tk.Label(header_row, bg=MODAL_BG, bd=0)
self.gif_lbl.pack(pady=(0, 4))
if self.data.get("player_won") is True:
self._start_gif("win_gif")
elif self.data.get("player_won") is False:
@ -46,15 +53,88 @@ class BlackjackResultDialog(tk.Frame):
MUTED_FG if self.data.get("player_won") is None else ERROR_FG
)
tk.Label(
self, text=self.data["headline"],
font=("Georgia", 18, "bold"), fg=headline_color, bg=MODAL_BG,
).pack(pady=(2, 12))
header_row, text=self.data["headline"],
font=("Georgia", 17, "bold"), fg=headline_color, bg=MODAL_BG,
).pack()
# Klare Begründung (z. B. warum Natural BJ gegen 3-Karten-21 gewonnen hat)
reason_txt = self.data.get("reason_text", "")
if reason_txt:
reason_box = tk.Frame(
self, bg=PANEL_BG, padx=14, pady=7,
highlightthickness=1, highlightbackground=ACCENT_GOLD
)
reason_box.pack(fill="x", pady=(2, 10))
tk.Label(
reason_box, text=reason_txt,
font=("Helvetica", 10, "bold"), fg=ACCENT_GOLD, bg=PANEL_BG,
wraplength=760, justify="center"
).pack()
# =========================================================
# SHOWDOWN-KARTENANSICHT ALLER TEILNEHMER (Dealer, Du, Bots)
# =========================================================
hands_list = self.data.get("showdown_hands", [])
if hands_list:
hands_outer = tk.Frame(
self, bg=CELL_BG, padx=12, pady=10,
highlightthickness=1, highlightbackground=SUBTLE_BORDER
)
hands_outer.pack(fill="x", pady=(0, 10))
tk.Label(
hands_outer, text=t("bj_showdown_section_title"),
font=("Georgia", 10, "bold"), fg=ACCENT_GOTH, bg=CELL_BG
).pack(anchor="w", pady=(0, 6))
cards_grid = tk.Frame(hands_outer, bg=CELL_BG)
cards_grid.pack()
max_cols = 3 if len(hands_list) <= 3 else 3
for idx, entry in enumerate(hands_list):
r_idx = idx // max_cols
c_idx = idx % max_cols
is_win = entry.get("is_winner", False)
is_dead = entry.get("busted", False) or entry.get("folded", False)
border_col = ACCENT_GOLD if is_win else (ERROR_FG if is_dead else SUBTLE_BORDER)
seat_card = tk.Frame(
cards_grid, bg=PANEL_BG, padx=10, pady=7,
highlightthickness=2 if is_win else 1, highlightbackground=border_col
)
seat_card.grid(row=r_idx, column=c_idx, padx=5, pady=4, sticky="nsew")
title_col = ACCENT_GOLD if is_win else (ACCENT_GOTH if entry.get("is_dealer") else FG_COLOR)
tk.Label(
seat_card, text=entry["owner_label"],
font=("Georgia", 10, "bold"), fg=title_col, bg=PANEL_BG
).pack()
c_row = tk.Frame(seat_card, bg=PANEL_BG)
c_row.pack(pady=4)
for img_name in entry.get("card_images", []):
photo = self.assets.get_card_photo(img_name, size=SHOWDOWN_MINI_CARD_SIZE)
if photo:
self._card_photos.append(photo)
tk.Label(c_row, image=photo, bg=PANEL_BG, bd=0).pack(side="left", padx=2)
badge_col = (
"#7be08a" if is_win else (ERROR_FG if is_dead else FG_COLOR)
)
tk.Label(
seat_card, text=entry["rank_label"],
font=("Helvetica", 9, "bold"), fg=badge_col, bg=PANEL_BG
).pack()
# =========================================================
# GOLD- & XP-ABRECHNUNG
# =========================================================
info_box = tk.Frame(
self, bg=CELL_BG, padx=22, pady=14,
self, bg=CELL_BG, padx=18, pady=10,
highlightthickness=1, highlightbackground=SUBTLE_BORDER
)
info_box.pack(fill="x", pady=(0, 14))
info_box.pack(fill="x", pady=(0, 10))
p_net = self.data["player_net"]
if p_net > 0:
@ -64,39 +144,39 @@ class BlackjackResultDialog(tk.Frame):
else:
own_txt, own_col = t("bj_popup_your_even"), FG_COLOR
tk.Label(info_box, text=own_txt, font=("Helvetica", 12, "bold"), fg=own_col, bg=CELL_BG).pack(pady=3)
tk.Label(info_box, text=own_txt, font=("Helvetica", 11, "bold"), fg=own_col, bg=CELL_BG).pack(pady=2)
for extra_line in self.data.get("other_gains", []):
tk.Label(info_box, text=extra_line, font=("Helvetica", 11), fg=MUTED_FG, bg=CELL_BG).pack(pady=2)
tk.Label(info_box, text=extra_line, font=("Helvetica", 10), fg=MUTED_FG, bg=CELL_BG).pack(pady=1)
tk.Frame(info_box, bg=SUBTLE_BORDER, height=1).pack(fill="x", pady=10)
tk.Frame(info_box, bg=SUBTLE_BORDER, height=1).pack(fill="x", pady=6)
tk.Label(
info_box, text=t("bj_popup_xp_earned", self.data["xp_gained"]),
font=("Helvetica", 12, "bold"), fg=ACCENT_GOTH, bg=CELL_BG,
).pack(pady=2)
font=("Helvetica", 11, "bold"), fg=ACCENT_GOTH, bg=CELL_BG,
).pack(pady=1)
if self.data.get("new_level_title"):
tk.Label(
info_box, text=self.data["new_level_title"],
font=("Georgia", 11, "bold"), fg=ACCENT_GOLD, bg=CELL_BG,
).pack(pady=(4, 0))
font=("Georgia", 10, "bold"), fg=ACCENT_GOLD, bg=CELL_BG,
).pack(pady=(3, 0))
btn_row = tk.Frame(self, bg=MODAL_BG)
btn_row.pack(fill="x", pady=(6, 0))
btn_row.pack(fill="x", pady=(4, 0))
if self.data.get("can_continue", True):
ImageButton(
btn_row, t("bj_popup_next_round_btn"),
self.assets.raw_btn, self.assets.raw_btn_active,
self._handle_next, sound_mgr=self.sounds, width=195, height=40, font=("Helvetica", 10, "bold")
self._handle_next, sound_mgr=self.sounds, width=195, height=38, font=("Helvetica", 10, "bold")
).pack(side="left", padx=(0, 10))
if self.data.get("can_leave_menu", True):
ImageButton(
btn_row, t("bj_popup_to_menu_btn"),
self.assets.raw_sel, self.assets.raw_sel_active,
self._handle_menu, sound_mgr=self.sounds, width=165, height=40, font=("Helvetica", 10, "bold")
self._handle_menu, sound_mgr=self.sounds, width=165, height=38, font=("Helvetica", 10, "bold")
).pack(side="right")
def _start_gif(self, key: str):
@ -119,6 +199,7 @@ class BlackjackResultDialog(tk.Frame):
except Exception:
pass
self._gif_job = None
self._card_photos.clear()
if self.winfo_exists():
self.destroy()

Binary file not shown.

View File

@ -884,4 +884,50 @@ INSERT OR REPLACE INTO base_i18n (key, lang, val) VALUES
('pk_popup_fold_win', 'EN', 'All opponents folded'),
('pk_popup_bot_gain', 'EN', 'Pot profit of {0}: +{1} Gold');
INSERT OR REPLACE INTO base_i18n (key, lang, val) VALUES
-- =========================================================================
-- DE: BLACKJACK SHOWDOWN & WERTUNGS-ERKLÄRUNGEN
-- =========================================================================
('bj_showdown_section_title', 'DE', 'Aufgedeckte Hände & Wertung'),
('bj_showdown_seat_dealer', 'DE', 'Haus-Dealer'),
('bj_showdown_seat_you', 'DE', 'Du'),
('bj_showdown_seat_you_hand', 'DE', 'Du (Hand {0})'),
('bj_rank_777', 'DE', '★ 7-7-7 Triple Seven (Rang 1) ★'),
('bj_rank_natural_bj', 'DE', '★ Blackjack (21 mit 2 Karten) ★'),
('bj_rank_split_21', 'DE', '21 Punkte (nach Split = reguläre 21)'),
('bj_rank_multi_21', 'DE', '21 Punkte ({0} Karten)'),
('bj_rank_points', 'DE', '{0} Punkte ({1} Karten)'),
('bj_rank_busted', 'DE', 'Überkauft ({0} Punkte)'),
('bj_rank_folded', 'DE', 'Ausgetreten ({0} Punkte)'),
('bj_reason_777_win', 'DE', '{0} gewinnt sofort mit 7-7-7 (höchste Blackjack-Hand überhaupt)!'),
('bj_reason_all_out', 'DE', 'Alle Herausforderer haben sich überkauft oder sind ausgetreten – die Bank zieht den Pot ein.'),
('bj_reason_nat_beats_reg21', 'DE', '{0} gewinnt mit echtem Blackjack (21 aus 2 Startkarten) gegen reguläre 21 (3+ Karten / Split)!'),
('bj_reason_777_beats_21', 'DE', '{0} schlägt mit 7-7-7 sogar jede andere 21 / jeden Blackjack!'),
('bj_reason_dealer_tie_push', 'DE', 'Gleichwertige Top-Hand mit dem Haus-Dealer ({0}) – Einsatz geht zurück (Push).'),
('bj_reason_dealer_bust', 'DE', 'Haus-Dealer überkauft sich ({0}) – {1} gewinnt mit {2}!'),
('bj_reason_higher_score', 'DE', '{0} gewinnt mit {1} gegen {2}.'),
('bj_reason_split_pot', 'DE', 'Gleichwertige beste Hände ({0}) – der Pot wird geteilt ({1}).'),
-- =========================================================================
-- EN: BLACKJACK SHOWDOWN & EVALUATION REASONS
-- =========================================================================
('bj_showdown_section_title', 'EN', 'Revealed Hands & Evaluation'),
('bj_showdown_seat_dealer', 'EN', 'House Dealer'),
('bj_showdown_seat_you', 'EN', 'You'),
('bj_showdown_seat_you_hand', 'EN', 'You (Hand {0})'),
('bj_rank_777', 'EN', '★ 7-7-7 Triple Seven (Rank 1) ★'),
('bj_rank_natural_bj', 'EN', '★ Natural Blackjack (2-card 21) ★'),
('bj_rank_split_21', 'EN', '21 Points (after Split = regular 21)'),
('bj_rank_multi_21', 'EN', '21 Points ({0} cards)'),
('bj_rank_points', 'EN', '{0} Points ({1} cards)'),
('bj_rank_busted', 'EN', 'Busted ({0} Points)'),
('bj_rank_folded', 'EN', 'Folded ({0} Points)'),
('bj_reason_777_win', 'EN', '{0} wins instantly with 7-7-7 (highest possible hand)!'),
('bj_reason_all_out', 'EN', 'All contenders busted or folded — the House takes the pot.'),
('bj_reason_nat_beats_reg21', 'EN', '{0} wins with a Natural Blackjack (2-card 21) over a regular 21 (3+ cards / Split)!'),
('bj_reason_777_beats_21', 'EN', '{0} beats every other 21 / Blackjack with 7-7-7!'),
('bj_reason_dealer_tie_push', 'EN', 'Equal top hand with the House Dealer ({0}) — bet returned (Push).'),
('bj_reason_dealer_bust', 'EN', 'House Dealer busts ({0}) — {1} wins with {2}!'),
('bj_reason_higher_score', 'EN', '{0} wins with {1} against {2}.'),
('bj_reason_split_pot', 'EN', 'Tied best hands ({0}) — pot is split ({1}).');
COMMIT;

Binary file not shown.