mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-11 13:07:40 +01:00
The gate is laid out once per live output instead of once on the primary, and claims the screen through an Arbiter at RANK_DIET_GUARD so the wake alarm and the workout locker can both outrank it. Three kinds of state needed three different answers. The display fields already fanned out for free -- GateVars holds root-mastered StringVars bound to labels. The typed-in fields did not: amount, per, meal name and the four macro cells were bare tk.Entry widgets, so N copies would have been N independent forms. They are variable-backed now, which is what makes logging work from whichever screen the user is actually looking at. The description box and the suggestion list cannot be shared at all -- tk.Text and tk.Listbox have no variable -- so those genuinely diverge and reads answer from the copy the user touched. The History tab is per-surface too: its grid, budget field and edit button are driven across every monitor, with the budget likewise variable-backed so the value cannot differ between screens mid-edit. Laying the gate out on the primary monitor only was considered and rejected: not having to hunt for the screen the form landed on is the entire point of per-output locking. Tests: the suite hung rather than failed on first run -- diet_guard patches its own `tk`, but LockWindow builds Toplevels through gatelock's, and real tkinter over a MagicMock root recurses without bound. `_hermetic_gatelock` closes that and redirects the runtime dir so no test can stand a production locker down. Every other test runs single-output, where fan-out is unobservable, so test_gatelock_fanout runs on two; each assertion was checked by cropping the fan-out loops to the first surface and confirming it goes red. _gatelock_ui and _gatelock_calendar were each split in two to stay under the 500-line limit, and GateVars' typed-in fields moved into a nested GateEntryVars rather than raising pylint's attribute cap. 470 tests, 100% branch coverage, pre-commit clean, no lint suppressions. |
||
|---|---|---|
| .. | ||
| tests | ||
| __init__.py | ||
| __main__.py | ||
| _budget.py | ||
| _calendar_view.py | ||
| _cli_gate.py | ||
| _cli_sync.py | ||
| _cli.py | ||
| _coerce.py | ||
| _constants.py | ||
| _daystatus.py | ||
| _estimator.py | ||
| _foodbank.py | ||
| _fuzzy.py | ||
| _gate.py | ||
| _gatelock_buttons.py | ||
| _gatelock_calendar_ui.py | ||
| _gatelock_calendar.py | ||
| _gatelock_core.py | ||
| _gatelock_groups.py | ||
| _gatelock_mealflow.py | ||
| _gatelock_nutrition.py | ||
| _gatelock_spacing.py | ||
| _gatelock_support.py | ||
| _gatelock_typography.py | ||
| _gatelock_ui_types.py | ||
| _gatelock_ui.py | ||
| _gatelock.py | ||
| _mcp.py | ||
| _meal.py | ||
| _portions.py | ||
| _resolve.py | ||
| _slots.py | ||
| _state.py | ||
| _sync_merge.py | ||
| _sync.py | ||