From 43c26ce9a6b957c5b6f6914d7c81ff31cf93491c Mon Sep 17 00:00:00 2001 From: lm Date: Fri, 17 Oct 2025 13:11:52 +0200 Subject: [PATCH] Remove ttkbootstrap support --- README.md | 4 ---- app/gui/__init__.py | 3 +-- app/gui/theme.py | 50 ++++++++------------------------------------- pyproject.toml | 3 --- 4 files changed, 9 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 4f44168..697ace3 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,6 @@ uv pip install . # install ICRS and dependencies uv run icrs # launches the GUI ``` The launcher copies Tcl/Tk resources into the virtualenv on first run, so no manual environment tweaks are needed. -To include the optional ttkbootstrap theme pack: -```bash -uv pip install '.[ui]' -``` ## Workflow 1. Load an image (`📂`) or a folder (`📁`). diff --git a/app/gui/__init__.py b/app/gui/__init__.py index e242ef9..f6e1550 100644 --- a/app/gui/__init__.py +++ b/app/gui/__init__.py @@ -2,13 +2,12 @@ from .color_picker import ColorPickerMixin from .exclusions import ExclusionMixin -from .theme import ThemeMixin, HAS_TTKBOOTSTRAP +from .theme import ThemeMixin from .ui import UIBuilderMixin __all__ = [ "ColorPickerMixin", "ExclusionMixin", "ThemeMixin", - "HAS_TTKBOOTSTRAP", "UIBuilderMixin", ] diff --git a/app/gui/theme.py b/app/gui/theme.py index 82e4edf..581097e 100644 --- a/app/gui/theme.py +++ b/app/gui/theme.py @@ -5,14 +5,6 @@ from __future__ import annotations import platform from tkinter import ttk -try: - import ttkbootstrap as tb # type: ignore - - HAS_TTKBOOTSTRAP = True -except Exception: # pragma: no cover - optional dependency - tb = None - HAS_TTKBOOTSTRAP = False - try: import winreg except Exception: # pragma: no cover - platform-specific @@ -24,27 +16,12 @@ class ThemeMixin: theme: str style: ttk.Style - using_tb: bool scale_style: str def init_theme(self) -> None: """Initialise ttk style handling and apply the detected theme.""" - if HAS_TTKBOOTSTRAP: - try: - try: - self.root.tk.call("package", "require", "msgcat") # type: ignore[attr-defined] - except Exception: - pass - self.style = tb.Style() - self.using_tb = True - except Exception: - self.style = ttk.Style() - self.style.theme_use("clam") - self.using_tb = False - else: - self.style = ttk.Style() - self.style.theme_use("clam") - self.using_tb = False + self.style = ttk.Style() + self.style.theme_use("clam") self.theme = "light" self.apply_theme(self.detect_system_theme()) @@ -54,17 +31,7 @@ class ThemeMixin: mode = (mode or "light").lower() self.theme = "dark" if mode == "dark" else "light" - if HAS_TTKBOOTSTRAP: - try: - theme_name = "darkly" if self.theme == "dark" else "flatly" - self.style.theme_use(theme_name) - except Exception: - pass - self.scale_style = ( - "info.Horizontal.TScale" if self.theme == "dark" else "primary.Horizontal.TScale" - ) - else: - self.scale_style = "Horizontal.TScale" + self.scale_style = "Horizontal.TScale" if self.theme == "dark": bg, fg = "#0f0f10", "#f1f1f1" @@ -77,11 +44,10 @@ class ThemeMixin: s = self.style s.configure("TFrame", background=bg) s.configure("TLabel", background=bg, foreground=fg, font=("Segoe UI", 10)) - if not HAS_TTKBOOTSTRAP: - s.configure( - "TButton", padding=8, relief="flat", background="#e0e0e0", foreground=fg, font=("Segoe UI", 10) - ) - s.map("TButton", background=[("active", "#d0d0d0")]) + s.configure( + "TButton", padding=8, relief="flat", background="#e0e0e0", foreground=fg, font=("Segoe UI", 10) + ) + s.map("TButton", background=[("active", "#d0d0d0")]) button_refresher = getattr(self, "_refresh_toolbar_buttons_theme", None) if callable(button_refresher): @@ -123,4 +89,4 @@ class ThemeMixin: self.update_preview() # type: ignore[attr-defined] -__all__ = ["ThemeMixin", "HAS_TTKBOOTSTRAP"] +__all__ = ["ThemeMixin"] diff --git a/pyproject.toml b/pyproject.toml index 7981976..5bdbe2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,9 +10,6 @@ dependencies = [ "pillow>=10.0.0", ] -[project.optional-dependencies] -ui = ["ttkbootstrap>=1.10.0"] - [project.scripts] icrs = "app.launcher:main"