From 3f6a9b0ebf0861c70535df26c80f73ef0593ce19 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sat, 12 Sep 2026 19:59:44 +0200 Subject: [PATCH] Take gatelock 0.8.1: colour reads through LockConfig.palette LockConfig's colours moved into a nested LockPalette record; every _COLORS. read follows. Nothing about the gate's behaviour changed. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01HHCbkJWXHjtTUaqvnHRAqA --- .fvmrc | 2 +- .github/workflows/release-apk.yml | 2 +- .pre-commit-config.yaml | 2 +- app/pubspec.lock | 4 ++-- app/pubspec.yaml | 4 ++-- diet_guard/_calendar_view.py | 10 +++++----- diet_guard/_gatelock_calendar_schedule.py | 12 ++++++------ diet_guard/_gatelock_calendar_types.py | 6 +++--- diet_guard/_gatelock_calendar_ui.py | 2 +- diet_guard/_gatelock_calendar_widgets.py | 20 ++++++++++---------- diet_guard/_gatelock_fields.py | 2 +- diet_guard/_gatelock_ui.py | 14 +++++++------- diet_guard/tests/test_gatelock_keyboard.py | 2 +- pyproject.toml | 2 +- requirements.txt | 2 +- 15 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.fvmrc b/.fvmrc index d7f4b8c..5ec4649 100644 --- a/.fvmrc +++ b/.fvmrc @@ -1,3 +1,3 @@ { - "flutter": "3.47.3" + "flutter": "3.47.4" } diff --git a/.github/workflows/release-apk.yml b/.github/workflows/release-apk.yml index ddcd2cb..0429274 100644 --- a/.github/workflows/release-apk.yml +++ b/.github/workflows/release-apk.yml @@ -50,7 +50,7 @@ jobs: - uses: subosito/flutter-action@v2 with: - flutter-version: 3.47.3 + flutter-version: 3.47.4 channel: stable cache: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 602851f..b72a325 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -106,7 +106,7 @@ repos: # direct URLs for one distribution, so any pin that drifts from # the manifest becomes an unresolvable hook environment rather # than merely an old one. - - gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock + - gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock - crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync - freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays - mcp>=2,<3 diff --git a/app/pubspec.lock b/app/pubspec.lock index f55c76e..cd7f1a0 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -203,10 +203,10 @@ packages: dependency: "direct main" description: name: flutter_secure_storage - sha256: "4540927d8b37e6cc47aaa2d17b6035a2d49049e2797cb19d2bdd299bff602c67" + sha256: d87713a152ee2f255117bdbbf43da1dea1797e0551e499e0334f0c9dcfafddd2 url: "https://pub.dev" source: hosted - version: "11.1.0" + version: "11.1.1" flutter_secure_storage_darwin: dependency: transitive description: diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 093ccad..55a2fc6 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -2,7 +2,7 @@ name: diet_guard_app description: "Companion phone app for diet_guard: log meals on the go." publish_to: 'none' -version: 1.0.80+1 +version: 1.0.81+1 environment: sdk: ^3.12.2 @@ -17,7 +17,7 @@ dependencies: flutter: sdk: flutter flutter_local_notifications: 22.3.0 - flutter_secure_storage: 11.1.0 + flutter_secure_storage: 11.1.1 # One-tap sign-in for the sync account. App-side only: crdt_sync stays pure # Dart so it keeps working on Linux desktop and headless. diff --git a/diet_guard/_calendar_view.py b/diet_guard/_calendar_view.py index 1525744..70f80a8 100644 --- a/diet_guard/_calendar_view.py +++ b/diet_guard/_calendar_view.py @@ -38,12 +38,12 @@ _COLORS = LockConfig() _NOT_LOGGED_FILL = BG _NOT_LOGGED_OUTLINE = FG _STATUS_COLORS = { - DayStatus.GREEN: _COLORS.success, - DayStatus.YELLOW: _COLORS.warning, - DayStatus.RED: _COLORS.danger, + DayStatus.GREEN: _COLORS.palette.success, + DayStatus.YELLOW: _COLORS.palette.warning, + DayStatus.RED: _COLORS.palette.danger, } -_STATUS_TEXT_COLOR = _COLORS.on_fill -_MUTED = _COLORS.muted +_STATUS_TEXT_COLOR = _COLORS.palette.on_fill +_MUTED = _COLORS.palette.muted @dataclass(frozen=True) diff --git a/diet_guard/_gatelock_calendar_schedule.py b/diet_guard/_gatelock_calendar_schedule.py index 87ebf89..5dfa476 100644 --- a/diet_guard/_gatelock_calendar_schedule.py +++ b/diet_guard/_gatelock_calendar_schedule.py @@ -33,7 +33,7 @@ def _spin_entry(row: tk.Frame, variable: tk.StringVar) -> tk.Entry: entry = tk.Entry( row, textvariable=variable, - font=(_COLORS.font_family, BODY), + font=(_COLORS.typography.font_family, BODY), width=_ENTRY_WIDTH, bg=_FIELD_BG, fg=FG, @@ -65,7 +65,7 @@ def build_schedule_row( tk.Label( row, text="Meals:", - font=(_COLORS.font_family, LABEL), + font=(_COLORS.typography.font_family, LABEL), bg=BG, fg=FG, ).pack(side="left") @@ -73,7 +73,7 @@ def build_schedule_row( tk.Label( row, text="to", - font=(_COLORS.font_family, LABEL), + font=(_COLORS.typography.font_family, LABEL), bg=BG, fg=FG, ).pack(side="left") @@ -81,7 +81,7 @@ def build_schedule_row( tk.Label( row, text="x", - font=(_COLORS.font_family, LABEL), + font=(_COLORS.typography.font_family, LABEL), bg=BG, fg=FG, ).pack(side="left") @@ -94,14 +94,14 @@ def build_schedule_row( tk.Label( parent, textvariable=vars_.schedule.times, - font=(_COLORS.font_family, LABEL), + font=(_COLORS.typography.font_family, LABEL), bg=BG, fg=FG, ).pack(pady=(0, XS)) status_label = tk.Label( parent, textvariable=vars_.schedule.status, - font=(_COLORS.font_family, LABEL), + font=(_COLORS.typography.font_family, LABEL), bg=BG, fg=FG, ) diff --git a/diet_guard/_gatelock_calendar_types.py b/diet_guard/_gatelock_calendar_types.py index 69ea238..d5b6ac9 100644 --- a/diet_guard/_gatelock_calendar_types.py +++ b/diet_guard/_gatelock_calendar_types.py @@ -25,9 +25,9 @@ if TYPE_CHECKING: # used to be its own hardcoded copy of _gatelock_ui's private constants; now # it reads the same shared LockConfig() directly instead. _COLORS = LockConfig() -_MUTED = _COLORS.muted -_FIELD_BG = _COLORS.field_bg -_ACCENT = _COLORS.accent +_MUTED = _COLORS.palette.muted +_FIELD_BG = _COLORS.palette.field_bg +_ACCENT = _COLORS.palette.accent # calendar.monthcalendar never returns more than 6 weeks for any month. _MONTH_ROWS = 6 diff --git a/diet_guard/_gatelock_calendar_ui.py b/diet_guard/_gatelock_calendar_ui.py index 4e23d47..55ecef1 100644 --- a/diet_guard/_gatelock_calendar_ui.py +++ b/diet_guard/_gatelock_calendar_ui.py @@ -75,5 +75,5 @@ def _style_notebook(root: tk.Misc) -> None: style.map( "TNotebook.Tab", background=[("selected", _ACCENT)], - foreground=[("selected", _COLORS.on_fill)], + foreground=[("selected", _COLORS.palette.on_fill)], ) diff --git a/diet_guard/_gatelock_calendar_widgets.py b/diet_guard/_gatelock_calendar_widgets.py index 590812d..000952d 100644 --- a/diet_guard/_gatelock_calendar_widgets.py +++ b/diet_guard/_gatelock_calendar_widgets.py @@ -60,14 +60,14 @@ def _build_budget_row( tk.Label( row, text="Daily budget (kcal):", - font=(_COLORS.font_family, LABEL), + font=(_COLORS.typography.font_family, LABEL), bg=BG, fg=FG, ).pack(side="left") entry = tk.Entry( row, textvariable=vars_.budget, - font=(_COLORS.font_family, BODY), + font=(_COLORS.typography.font_family, BODY), width=8, bg=_FIELD_BG, fg=FG, @@ -87,7 +87,7 @@ def _build_budget_row( status_label = tk.Label( parent, textvariable=vars_.budget_status, - font=(_COLORS.font_family, LABEL), + font=(_COLORS.typography.font_family, LABEL), bg=BG, fg=FG, ) @@ -113,7 +113,7 @@ def _build_month_nav( tk.Label( row, textvariable=vars_.month_label, - font=(_COLORS.font_family, LABEL, "bold"), + font=(_COLORS.typography.font_family, LABEL, "bold"), bg=BG, fg=FG, width=16, @@ -136,7 +136,7 @@ def _build_grid(parent: tk.Frame) -> list[tk.Label]: tk.Label( weekday_row, text=label, - font=(_COLORS.font_family, CAPTION, "bold"), + font=(_COLORS.typography.font_family, CAPTION, "bold"), bg=BG, fg=_MUTED, width=4, @@ -150,7 +150,7 @@ def _build_grid(parent: tk.Frame) -> list[tk.Label]: cell = tk.Label( grid_frame, text="", - font=(_COLORS.font_family, CAPTION), + font=(_COLORS.typography.font_family, CAPTION), width=4, height=2, bg=BG, @@ -173,7 +173,7 @@ def build_calendar_frame( tk.Label( frame, text="📅 History", - font=(_COLORS.font_family, TITLE, "bold"), + font=(_COLORS.typography.font_family, TITLE, "bold"), bg=BG, fg=_ACCENT, ).pack(pady=(SM, 0)) @@ -200,21 +200,21 @@ def build_calendar_frame( tk.Label( frame, textvariable=vars_.streaks, - font=(_COLORS.font_family, LABEL, "bold"), + font=(_COLORS.typography.font_family, LABEL, "bold"), bg=BG, fg=FG, ).pack(pady=(SM, 0)) tk.Label( frame, textvariable=vars_.ytd, - font=(_COLORS.font_family, CAPTION), + font=(_COLORS.typography.font_family, CAPTION), bg=BG, fg=_MUTED, ).pack(pady=(XS, 0)) tk.Label( frame, textvariable=vars_.averages, - font=(_COLORS.font_family, CAPTION), + font=(_COLORS.typography.font_family, CAPTION), bg=BG, fg=_MUTED, ).pack(pady=(XS, SM)) diff --git a/diet_guard/_gatelock_fields.py b/diet_guard/_gatelock_fields.py index 4af175b..1586fd9 100644 --- a/diet_guard/_gatelock_fields.py +++ b/diet_guard/_gatelock_fields.py @@ -103,7 +103,7 @@ def build_suggestion_box(parent: tk.Frame) -> tk.Listbox: bg=_FIELD_BG, fg=FG, selectbackground=_ACCENT, - selectforeground=_COLORS.on_fill, + selectforeground=_COLORS.palette.on_fill, activestyle="none", # Was highlightthickness=0, which removed the focus ring entirely. The # list *is* arrow-key navigable, so it was keyboard-usable with no diff --git a/diet_guard/_gatelock_ui.py b/diet_guard/_gatelock_ui.py index fe013de..3b2d843 100644 --- a/diet_guard/_gatelock_ui.py +++ b/diet_guard/_gatelock_ui.py @@ -44,13 +44,13 @@ from diet_guard._gatelock_ui_types import ( # already import them by name; they now track LockConfig instead of a # separate, driftable copy. _COLORS = LockConfig() -BG = _COLORS.bg -FG = _COLORS.fg -ERR = _COLORS.danger -_ACCENT = _COLORS.accent -_FIELD_BG = _COLORS.field_bg -_MUTED = _COLORS.muted -_FONT = _COLORS.font_family +BG = _COLORS.palette.bg +FG = _COLORS.palette.fg +ERR = _COLORS.palette.danger +_ACCENT = _COLORS.palette.accent +_FIELD_BG = _COLORS.palette.field_bg +_MUTED = _COLORS.palette.muted +_FONT = _COLORS.typography.font_family # Number of food-bank / staple / OFF suggestions shown in the picker list. SUGGESTION_ROWS = 5 # Grams a label's macros are assumed to describe when the "per" field is blank. diff --git a/diet_guard/tests/test_gatelock_keyboard.py b/diet_guard/tests/test_gatelock_keyboard.py index 45ec549..083b851 100644 --- a/diet_guard/tests/test_gatelock_keyboard.py +++ b/diet_guard/tests/test_gatelock_keyboard.py @@ -130,7 +130,7 @@ class TestFocusRingIsVisible: against ``bg`` the moment it took focus. """ kwargs = _gatelock_ui._COLORS.focus_kwargs() - assert kwargs["highlightcolor"] == _gatelock_ui._COLORS.accent + assert kwargs["highlightcolor"] == _gatelock_ui._COLORS.palette.accent assert kwargs["highlightcolor"] != "#000000" assert int(kwargs["highlightthickness"]) > 0 diff --git a/pyproject.toml b/pyproject.toml index 08517e9..cf89a21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "1.0.0" description = "Tkinter/systemd log-to-unlock meal gate with calorie/macro budget tracking" requires-python = ">=3.14" dependencies = [ - "gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock", + "gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock", "crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync", "freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays", "requests==2.34.2", diff --git a/requirements.txt b/requirements.txt index 8280aec..edb52e1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ codespell==2.4.3 coverage==7.16.0 crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays -gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock +gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock mcp==2.2.0 mypy==2.3.1 pre-commit==4.6.2