Remove ttkbootstrap support
This commit is contained in:
parent
7156bbb6c4
commit
43c26ce9a6
|
|
@ -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 (`📁`).
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@ dependencies = [
|
|||
"pillow>=10.0.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
ui = ["ttkbootstrap>=1.10.0"]
|
||||
|
||||
[project.scripts]
|
||||
icrs = "app.launcher:main"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue