mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-14 20:10:56 +01:00
_ui_widgets.py's _button() always set fg=self._colors.fg (near-white) regardless of bg, so any accent/success/warning/danger-filled button under-contrasted (measured 2.2-3.6:1 vs the 4.5:1 floor). Added _fg_for(bg) so fg is derived from bg instead of hardcoded -- fixes every current _button() call site structurally, not per-instance. Found and fixed 2 more standalone instances of the same bug outside the shared helper (_window_setup.py's demo-close button, _heat_skip.py's heat-skip button). Bumps gatelock to the released v0.1.1 carrying the same on_fill token plus the warm palette rework. Regenerated workout_app's launcher icon assets to match. Verified: gatelock 50/50 + screen_locker 859/859 tests, both 100% coverage; pre-commit (incl. pylint against the real v0.1.1 install) green.
51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
"""Auxiliary (non-lock) window setup for ScreenLocker.
|
|
|
|
The fullscreen lock-window mechanics (overrideredirect, input grab,
|
|
VT-disable) now live in the shared ``gatelock`` package. This module keeps
|
|
only the screen-locker-specific windows that are never the lock itself: the
|
|
post-sick-day verification window, the demo close button, and the optional
|
|
relaxed-day prompt.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import tkinter as tk
|
|
|
|
|
|
class WindowSetupMixin:
|
|
"""Mixin providing the screen-locker-specific auxiliary windows."""
|
|
|
|
def on_focus_ready(self) -> None:
|
|
"""No typed-input field in the lock window; nothing to focus."""
|
|
|
|
def on_callback_error(self) -> None:
|
|
"""Surfaced via GateRoot's logging already; no extra action yet."""
|
|
|
|
def on_close(self) -> None:
|
|
"""No extra hardware/state beyond what close() already handles."""
|
|
|
|
def _setup_verify_window(self) -> None:
|
|
"""Configure window for post-sick-day workout verification."""
|
|
self.root.geometry("600x400")
|
|
self.root.configure(bg=self._colors.bg, cursor="arrow")
|
|
self.root.protocol("WM_DELETE_WINDOW", self.close)
|
|
|
|
def _setup_demo_close_button(self) -> None:
|
|
"""Add close button for demo mode."""
|
|
close_btn = tk.Button(
|
|
self.root,
|
|
text="✕ Close Demo",
|
|
font=(self._colors.font_family, 12),
|
|
bg=self._colors.danger,
|
|
fg=self._colors.on_fill,
|
|
command=self.close,
|
|
cursor="hand2",
|
|
)
|
|
close_btn.place(x=10, y=10)
|
|
|
|
def _setup_relaxed_day_window(self) -> None:
|
|
"""Configure a small non-locking window for the optional Tue-Thu prompt."""
|
|
self.root.geometry("700x450")
|
|
self.root.configure(bg=self._colors.bg, cursor="arrow")
|
|
self.root.protocol("WM_DELETE_WINDOW", self.close)
|