diet-guard/diet_guard
Krzysztof kuhy Rudnicki b621ccaed0
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
Use gatelock's shared button and WidgetGroup
Phase 2 consumer migration. diet-guard was the donor for make_button, so it
is one of the two proof consumers the extraction is validated against.

- _gatelock_buttons.py is deleted; its make_button now lives in gatelock,
  where the variant API (text colour picked *from* the fill) and the
  <Return>/<KP_Enter> bindings serve all four gates instead of one. Call
  sites pass _COLORS explicitly, since a shared widget cannot read this
  app's module-level palette. Pixel-identical: BODY/LABEL were -16/-14 and
  LockConfig.font("body"/"label") yields the same negative (pixel) sizes.
- WidgetGroup now subclasses gatelock's, keeping the list[_W] constructor and
  re-narrowing `first` to the widget type. The specialized groups (EntryGroup
  over a shared StringVar, TextGroup, ListboxGroup, MacroGroup) are unchanged
  behaviour and stay -- gatelock has no equivalent for them.
- bind() keeps *replacing* semantics, inverted from gatelock's additive
  default and now documented + tested. _wire_events runs once per
  build_surface and again on rebuild, so an additive bind would stack a
  second <Return> handler on every surviving widget and log the meal twice.
- conftest swaps gatelock.widgets into the fake-tk module list in the same
  edit that removes _gatelock_buttons, since that list fails the whole suite
  if it drifts in either direction.

All three gatelock pins move together to v0.5.0 -- pyproject, requirements.txt
and the pylint hook's additional_dependencies. The config comment already
warned that a lagging hook pin lints against a gatelock without the API the
code calls; that is exactly what it did before this bump.

The "<Return> activates a button" test moves to gatelock with the button, so
it runs against real Tk rather than a fake widget that can only report the
binding it was handed.

Verified: 692 tests, 100% branch coverage against the *installed* gatelock
0.5.0 (not a PYTHONPATH shim); the gate builds under xvfb and <Return> and
<KP_Enter> both fire a real button's command, with the accent focus ring
(#B8862E, 2px) instead of Tk's invisible 1px black.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U4Rj3s7K2qzrLNgJqqPhno
2026-08-15 14:23:11 +02:00
..
tests Use gatelock's shared button and WidgetGroup 2026-08-15 14:23:11 +02:00
__init__.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
__main__.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
_averages.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
_budget_history.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
_budget.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
_calendar_view.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
_cli_averages.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
_cli_gate.py Review fixes: specific sync exceptions, clearer names 2026-07-11 18:33:43 +02:00
_cli_sync.py Make the phone publish on every tick, and fail closed on Firebase errors 2026-08-10 14:35:37 +02:00
_cli.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
_coerce.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
_constants.py Push under a persisted per-install uuid, not a fixed role id 2026-08-09 17:18:42 +02:00
_daystatus.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
_device.py Push under a persisted per-install uuid, not a fixed role id 2026-08-09 17:18:42 +02:00
_estimator.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
_foodbank_manual.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
_foodbank.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
_fuzzy.py feat(diet_guard): add meal-logging screen-lock gate with trigger fix 2026-06-10 22:32:39 +02:00
_gate.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
_gatelock_calendar_ui.py Use gatelock's shared button and WidgetGroup 2026-08-15 14:23:11 +02:00
_gatelock_calendar.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
_gatelock_core.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
_gatelock_groups.py Use gatelock's shared button and WidgetGroup 2026-08-15 14:23:11 +02:00
_gatelock_mealflow.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
_gatelock_nutrition.py Add budget-adherence calendar, streaks, and freely-editable synced budget 2026-07-13 21:31:45 +02:00
_gatelock_spacing.py Migrate diet_guard to gatelock v0.2.0 per-output locking 2026-07-25 16:56:13 +02:00
_gatelock_support.py feat: split oversized modules for 500-line limit, fix kasa coverage gap 2026-06-14 07:19:37 +02:00
_gatelock_typography.py Make the meal gate usable without a pointer on a 1366x768 screen 2026-07-30 16:21:27 +02:00
_gatelock_ui_types.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
_gatelock_ui.py Use gatelock's shared button and WidgetGroup 2026-08-15 14:23:11 +02:00
_gatelock.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
_mcp.py Remove the Snack chip from the phone's slot selector 2026-08-14 22:31:09 +02:00
_portions.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
_resolve.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
_slots.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
_state.py Remove the Snack chip from the phone's slot selector 2026-08-14 22:31:09 +02:00
_sync_merge.py Push under a persisted per-install uuid, not a fixed role id 2026-08-09 17:18:42 +02:00
_sync.py Make the phone publish on every tick, and fail closed on Firebase errors 2026-08-10 14:35:37 +02:00
_test_guard.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00