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/dialogs/audio_settings_dialog.py
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
2026-11-14 04:25:51 +00:00
|
|
|
import tkinter as tk
|
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 PIL import Image, ImageTk
|
|
|
|
|
|
2026-11-14 04:25:51 +00:00
|
|
|
from resources.code_res.game_constants import (
|
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
|
|
|
BG_COLOR,
|
|
|
|
|
FONT_COLOR_BODY_DEFAULT,
|
|
|
|
|
FONT_COLOR_BODY_MUTED,
|
|
|
|
|
FONT_COLOR_HEADING_SUB,
|
|
|
|
|
FONT_COLOR_TITLE_MAIN,
|
|
|
|
|
FONT_SIZE_BODY,
|
|
|
|
|
FONT_SIZE_HEADING,
|
|
|
|
|
FONT_SIZE_SMALL_MIN,
|
|
|
|
|
FONT_SIZE_TITLE_LG,
|
|
|
|
|
SUBTLE_BORDER,
|
|
|
|
|
UI_ACCENT_AMETHYST,
|
|
|
|
|
UI_ACCENT_GOLD,
|
2026-11-14 04:25:51 +00:00
|
|
|
)
|
|
|
|
|
from resources.code_res.i18n import t
|
|
|
|
|
from view.widgets.image_button import ImageButton
|
|
|
|
|
|
|
|
|
|
|
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 AudioSettingsDialog(tk.Canvas):
|
|
|
|
|
"""
|
|
|
|
|
Rahmenloses Gothic-Audio-Overlay auf Basis von background_vertical.jpg + box_big.png
|
|
|
|
|
mit eigenen Amethyst/Gold-Schiebereglern statt Standard-tk.Scale.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
DLG_W = 480
|
|
|
|
|
DLG_H = 440
|
|
|
|
|
|
2026-11-14 04:25:51 +00:00
|
|
|
@classmethod
|
|
|
|
|
def open(cls, root_window: tk.Tk, assets, sound_mgr):
|
|
|
|
|
existing = getattr(root_window, "_audio_overlay", None)
|
|
|
|
|
if existing and existing.winfo_exists():
|
|
|
|
|
existing.lift()
|
|
|
|
|
return existing
|
|
|
|
|
dlg = cls(root_window, assets, sound_mgr)
|
|
|
|
|
root_window._audio_overlay = dlg
|
|
|
|
|
return dlg
|
|
|
|
|
|
|
|
|
|
def __init__(self, root_window: tk.Tk, assets, sound_mgr):
|
|
|
|
|
super().__init__(
|
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
|
|
|
root_window,
|
|
|
|
|
width=self.DLG_W,
|
|
|
|
|
height=self.DLG_H,
|
|
|
|
|
bg=BG_COLOR,
|
|
|
|
|
bd=0,
|
|
|
|
|
highlightthickness=0,
|
2026-11-14 04:25:51 +00:00
|
|
|
)
|
|
|
|
|
self.root_window = root_window
|
|
|
|
|
self.assets = assets
|
|
|
|
|
self.sound_mgr = sound_mgr
|
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._photo_refs: list[ImageTk.PhotoImage] = []
|
|
|
|
|
self._pct_photos: dict[str, ImageTk.PhotoImage] = {}
|
|
|
|
|
self._dragging_key: str | None = None
|
|
|
|
|
self._sliders: dict[str, dict] = {}
|
|
|
|
|
|
2026-11-14 04:25:51 +00:00
|
|
|
self.place(relx=0.5, rely=0.5, anchor="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
|
|
|
self._build_scene()
|
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 _build_scene(self):
|
|
|
|
|
self.delete("all")
|
|
|
|
|
self._photo_refs.clear()
|
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
|
|
|
w, h = self.DLG_W, self.DLG_H
|
|
|
|
|
|
|
|
|
|
# 1. Hochformat-Hintergrund (background_vertical.jpg) + box_big.png Zierrahmen
|
|
|
|
|
bg_src = self.assets.raw_bg_vertical or self.assets.raw_bg_horizontal or self.assets.raw_bg
|
|
|
|
|
if bg_src is not None:
|
|
|
|
|
bg_scaled = bg_src.resize((w, h), Image.Resampling.LANCZOS)
|
|
|
|
|
bg_ph = ImageTk.PhotoImage(bg_scaled)
|
|
|
|
|
self._photo_refs.append(bg_ph)
|
|
|
|
|
self.create_image(0, 0, image=bg_ph, anchor="nw")
|
|
|
|
|
|
|
|
|
|
outer_box = self.assets.get_box_photo("box_big", (w - 6, h - 6))
|
|
|
|
|
if outer_box:
|
|
|
|
|
self._photo_refs.append(outer_box)
|
|
|
|
|
self.create_image(w // 2, h // 2, image=outer_box, anchor="center")
|
|
|
|
|
|
|
|
|
|
# 2. Titel & Untertitel
|
|
|
|
|
title_ph = self.assets.get_goth_text_photo(
|
|
|
|
|
t("audio_title"), size_px=FONT_SIZE_TITLE_LG - 2, color=FONT_COLOR_TITLE_MAIN, max_width=w - 60
|
|
|
|
|
)
|
|
|
|
|
sub_ph = self.assets.get_goth_text_photo(
|
|
|
|
|
t("audio_subtitle"), size_px=FONT_SIZE_SMALL_MIN, color=FONT_COLOR_BODY_MUTED, max_width=w - 70
|
|
|
|
|
)
|
|
|
|
|
self._photo_refs.extend([title_ph, sub_ph])
|
|
|
|
|
self.create_image(w // 2, 46, image=title_ph, anchor="center")
|
|
|
|
|
self.create_image(w // 2, 82, image=sub_ph, anchor="center")
|
|
|
|
|
|
|
|
|
|
# 3. Zwei Slider-Boxen in box_small_purple.png
|
|
|
|
|
self._create_goth_slider(
|
|
|
|
|
key="amb",
|
|
|
|
|
cy=162,
|
2026-11-14 04:25:51 +00:00
|
|
|
label_txt=t("audio_ambiance_label"),
|
|
|
|
|
desc_txt=t("audio_ambiance_desc"),
|
|
|
|
|
initial_vol=self.sound_mgr.ambiance_volume,
|
|
|
|
|
on_change=lambda v: self.sound_mgr.set_ambiance_volume(v, persist=True),
|
|
|
|
|
)
|
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._create_goth_slider(
|
|
|
|
|
key="sfx",
|
|
|
|
|
cy=284,
|
2026-11-14 04:25:51 +00:00
|
|
|
label_txt=t("audio_sfx_label"),
|
|
|
|
|
desc_txt=t("audio_sfx_desc"),
|
|
|
|
|
initial_vol=self.sound_mgr.menu_volume,
|
|
|
|
|
on_change=lambda v: self.sound_mgr.set_menu_volume(v, persist=True),
|
|
|
|
|
)
|
|
|
|
|
|
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
|
|
|
# 4. Untere Aktions-Buttons (Amethyst für Test, Feuer für Fertig)
|
|
|
|
|
btn_norm = self.assets.raw_btn_default
|
|
|
|
|
btn_purp = self.assets.raw_btn_purple
|
|
|
|
|
btn_fire = self.assets.raw_btn_fire or btn_purp
|
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
|
|
|
btn_test = ImageButton(
|
|
|
|
|
self, t("audio_test_btn"), btn_norm, btn_purp,
|
|
|
|
|
lambda: self.sound_mgr.play("deal"),
|
|
|
|
|
sound_mgr=None, width=168, height=40, style="amethyst"
|
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
|
|
|
btn_done = ImageButton(
|
|
|
|
|
self, t("audio_done_btn"), btn_fire, btn_fire,
|
|
|
|
|
self.close, sound_mgr=self.sound_mgr, width=168, height=40, style="fire"
|
|
|
|
|
)
|
|
|
|
|
self.create_window(42, h - 48, window=btn_test, anchor="w")
|
|
|
|
|
self.create_window(w - 42, h - 48, window=btn_done, anchor="e")
|
|
|
|
|
|
|
|
|
|
self.bind("<ButtonPress-1>", self._on_mouse_down)
|
|
|
|
|
self.bind("<B1-Motion>", self._on_mouse_drag)
|
|
|
|
|
self.bind("<ButtonRelease-1>", lambda _e: setattr(self, "_dragging_key", None))
|
|
|
|
|
|
|
|
|
|
def _create_goth_slider(self, key: str, cy: int, label_txt: str, desc_txt: str, initial_vol: float, on_change):
|
|
|
|
|
box_w, box_h = self.DLG_W - 72, 108
|
|
|
|
|
cx = self.DLG_W // 2
|
|
|
|
|
x_left = cx - box_w // 2 + 22
|
|
|
|
|
x_right = cx + box_w // 2 - 22
|
|
|
|
|
|
|
|
|
|
sec_box = self.assets.get_box_photo("box_purple", (box_w, box_h))
|
|
|
|
|
if sec_box:
|
|
|
|
|
self._photo_refs.append(sec_box)
|
|
|
|
|
self.create_image(cx, cy, image=sec_box, anchor="center")
|
|
|
|
|
|
|
|
|
|
lbl_ph = self.assets.get_goth_text_photo(
|
|
|
|
|
label_txt, size_px=FONT_SIZE_HEADING - 4, color=FONT_COLOR_BODY_DEFAULT, align="left"
|
|
|
|
|
)
|
|
|
|
|
desc_ph = self.assets.get_goth_text_photo(
|
|
|
|
|
desc_txt, size_px=FONT_SIZE_SMALL_MIN, color=FONT_COLOR_BODY_MUTED, max_width=box_w - 44, align="left"
|
|
|
|
|
)
|
|
|
|
|
self._photo_refs.extend([lbl_ph, desc_ph])
|
|
|
|
|
self.create_image(x_left, cy - 30, image=lbl_ph, anchor="w")
|
|
|
|
|
self.create_image(x_left, cy - 4, image=desc_ph, anchor="w")
|
|
|
|
|
|
|
|
|
|
pct_item = self.create_image(x_right, cy - 30, anchor="e")
|
|
|
|
|
|
|
|
|
|
track_y = cy + 28
|
|
|
|
|
track_x1 = x_left + 4
|
|
|
|
|
track_x2 = x_right - 4
|
|
|
|
|
self.create_rectangle(
|
|
|
|
|
track_x1, track_y - 4, track_x2, track_y + 4,
|
|
|
|
|
fill="#09070e", outline=SUBTLE_BORDER, width=1
|
|
|
|
|
)
|
|
|
|
|
fill_id = self.create_rectangle(
|
|
|
|
|
track_x1, track_y - 3, track_x1, track_y + 3,
|
|
|
|
|
fill=UI_ACCENT_AMETHYST, outline=""
|
|
|
|
|
)
|
|
|
|
|
knob_id = self.create_polygon(
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
fill=UI_ACCENT_GOLD, outline="#0d0b12", width=1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self._sliders[key] = {
|
|
|
|
|
"x1": track_x1,
|
|
|
|
|
"x2": track_x2,
|
|
|
|
|
"y": track_y,
|
|
|
|
|
"fill_id": fill_id,
|
|
|
|
|
"knob_id": knob_id,
|
|
|
|
|
"pct_item": pct_item,
|
|
|
|
|
"val": max(0.0, min(1.0, float(initial_vol))),
|
|
|
|
|
"on_change": on_change,
|
|
|
|
|
}
|
|
|
|
|
self._update_slider_visual(key, self._sliders[key]["val"], notify=False)
|
|
|
|
|
|
|
|
|
|
def _update_slider_visual(self, key: str, val: float, notify: bool = True):
|
|
|
|
|
s = self._sliders[key]
|
|
|
|
|
val = max(0.0, min(1.0, val))
|
|
|
|
|
s["val"] = val
|
|
|
|
|
|
|
|
|
|
kx = s["x1"] + (s["x2"] - s["x1"]) * val
|
|
|
|
|
ky = s["y"]
|
|
|
|
|
self.coords(s["fill_id"], s["x1"] + 1, ky - 3, kx, ky + 3)
|
|
|
|
|
# Rautenförmiger Gold-Reglergriff
|
|
|
|
|
r = 9
|
|
|
|
|
self.coords(s["knob_id"], kx, ky - r, kx + r, ky, kx, ky + r, kx - r, ky)
|
|
|
|
|
|
|
|
|
|
pct_txt = f"{int(round(val * 100))} %"
|
|
|
|
|
pct_ph = self.assets.get_goth_text_photo(
|
|
|
|
|
pct_txt, size_px=FONT_SIZE_BODY + 2, color=FONT_COLOR_HEADING_SUB, align="right"
|
|
|
|
|
)
|
|
|
|
|
self._pct_photos[key] = pct_ph
|
|
|
|
|
self.itemconfigure(s["pct_item"], image=pct_ph)
|
|
|
|
|
|
|
|
|
|
if notify:
|
|
|
|
|
s["on_change"](val)
|
|
|
|
|
|
|
|
|
|
def _on_mouse_down(self, event):
|
|
|
|
|
for key, s in self._sliders.items():
|
|
|
|
|
if (s["x1"] - 12) <= event.x <= (s["x2"] + 12) and abs(event.y - s["y"]) <= 18:
|
|
|
|
|
self._dragging_key = key
|
|
|
|
|
ratio = (event.x - s["x1"]) / max(1.0, float(s["x2"] - s["x1"]))
|
|
|
|
|
self._update_slider_visual(key, ratio, notify=True)
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
def _on_mouse_drag(self, event):
|
|
|
|
|
if self._dragging_key and self._dragging_key in self._sliders:
|
|
|
|
|
s = self._sliders[self._dragging_key]
|
|
|
|
|
ratio = (event.x - s["x1"]) / max(1.0, float(s["x2"] - s["x1"]))
|
|
|
|
|
self._update_slider_visual(self._dragging_key, ratio, notify=True)
|
2026-11-14 04:25:51 +00:00
|
|
|
|
|
|
|
|
def close(self):
|
|
|
|
|
self.destroy()
|
|
|
|
|
self.root_window._audio_overlay = None
|