mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-21 12:02:20 +01:00
Put my logo everywhere
Todo: 7808ee0a
This commit is contained in:
parent
3cd04e60dc
commit
6c2c365a69
2
.github/workflows/release-apk.yml
vendored
2
.github/workflows/release-apk.yml
vendored
@ -60,7 +60,7 @@ jobs:
|
||||
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.50.0
|
||||
flutter-version: 3.50.1
|
||||
channel: stable
|
||||
cache: true
|
||||
|
||||
|
||||
@ -115,6 +115,7 @@ repos:
|
||||
- crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync
|
||||
- freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.3#subdirectory=freedays
|
||||
- sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.5#subdirectory=sickdays
|
||||
- kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.0#subdirectory=kuhy_credit
|
||||
- rtdb-relay @ git+https://github.com/kuhyx/utils@rtdb-relay-v0.2.1#subdirectory=rtdb_relay
|
||||
- claude-agent-sdk==0.2.184
|
||||
- httpx==0.28.1
|
||||
|
||||
@ -27,6 +27,7 @@ import 'package:diet_guard_app/widgets/meal_schedule_editor.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:kuhy_credit/kuhy_credit.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:sync_settings_ui/sync_settings_ui.dart';
|
||||
@ -241,6 +242,10 @@ class _SettingsScreenState extends State<SettingsScreen>
|
||||
const SizedBox(height: 16),
|
||||
Align(alignment: Alignment.centerLeft, child: _status),
|
||||
],
|
||||
const SizedBox(height: 24),
|
||||
const Divider(),
|
||||
const SizedBox(height: 8),
|
||||
const Align(alignment: Alignment.centerLeft, child: KuhyCredit()),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -542,10 +542,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: health
|
||||
sha256: "8dd9625c9c26379a5753ad24c33af1d3dc5ce1f36f19c03e17c676c2f8fdbb80"
|
||||
sha256: "683d15fdde49a942bacce871faf3090bda3c1f5dad995725337aeb1dfd348e6d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "13.3.2"
|
||||
version: "14.0.0"
|
||||
hooks:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -682,6 +682,15 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.12.0"
|
||||
kuhy_credit:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "kuhy_credit/flutter"
|
||||
ref: "kuhy-credit-v0.3.0"
|
||||
resolved-ref: c3946412729991bf1e9c3b6a5cc55dbe80419fc0
|
||||
url: "https://github.com/kuhyx/utils"
|
||||
source: git
|
||||
version: "0.3.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -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.186+1
|
||||
version: 1.0.187+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.12.2
|
||||
@ -48,11 +48,16 @@ dependencies:
|
||||
url: https://github.com/kuhyx/utils
|
||||
ref: google_account_token-v0.1.0
|
||||
path: google_account_token
|
||||
health: 13.3.2
|
||||
health: 14.0.0
|
||||
http: 1.6.0
|
||||
idb_shim: 2.11.3
|
||||
# Camera/gallery photo as transient input to Claude (never stored or synced).
|
||||
image_picker: 1.2.4
|
||||
kuhy_credit:
|
||||
git:
|
||||
url: https://github.com/kuhyx/utils
|
||||
ref: kuhy-credit-v0.3.0
|
||||
path: kuhy_credit/flutter
|
||||
material_ui: 1.11.1
|
||||
path: 1.9.1
|
||||
path_provider: 2.1.6
|
||||
|
||||
@ -10,6 +10,7 @@ import 'package:diet_guard_app/services/firebase_backend.dart';
|
||||
import 'package:diet_guard_app/services/foodbank_service.dart';
|
||||
import 'package:diet_guard_app/services/log_storage_service.dart';
|
||||
import 'package:diet_guard_app/services/meal_schedule_service.dart';
|
||||
import 'package:kuhy_credit/kuhy_credit.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
@ -224,4 +225,17 @@ void main() {
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('shows the KuhyCredit logo at the bottom', (tester) async {
|
||||
await tester.runAsync(() async {
|
||||
await tester.pumpWidget(const MaterialApp(home: SettingsScreen()));
|
||||
await settle(tester);
|
||||
|
||||
// Scroll to the bottom where KuhyCredit is placed.
|
||||
await tester.ensureVisible(find.byType(KuhyCredit, skipOffstage: false));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(KuhyCredit, skipOffstage: false), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -58,6 +58,7 @@ from diet_guard._gatelock_core import _GateState
|
||||
from diet_guard._gatelock_credit import arm_credit_watch
|
||||
from diet_guard._gatelock_groups import GateWidgetsGroup
|
||||
from diet_guard._gatelock_lockfile import acquire_gate_lock, release_gate_lock
|
||||
from diet_guard._gatelock_logo import place_logo
|
||||
from diet_guard._gatelock_peerpull import arm_peer_pull
|
||||
from diet_guard._gatelock_ui import GateCallbacks, make_vars
|
||||
from diet_guard._hold import watch_hold
|
||||
@ -127,8 +128,7 @@ class MealGate(_GateCalendar):
|
||||
self.root = GateRoot()
|
||||
self.root.on_callback_error = self.on_callback_error
|
||||
self.root.title("Diet Gate") # OS-level app name: the one kept noun
|
||||
# No colour overrides: LockConfig's defaults are the design-system palette
|
||||
# and _gatelock_ui reads them too (an override drifted once).
|
||||
# No colour overrides: LockConfig defaults are the palette (one drifted).
|
||||
config = LockConfig(
|
||||
mode="soft" if demo_mode else "hard",
|
||||
app_name="diet_guard",
|
||||
@ -172,9 +172,9 @@ class MealGate(_GateCalendar):
|
||||
monitor the user is actually looking at.
|
||||
"""
|
||||
widgets = self._build_tabs(parent, self._callbacks)
|
||||
place_logo(parent)
|
||||
self._widgets.add(widgets, surface.output_name)
|
||||
# An output coming back mid-lock gets its bindings too; tk's bind
|
||||
# replaces rather than stacks, so re-wiring the others is a no-op.
|
||||
# A returning output gets its bindings; re-wiring the rest is a no-op.
|
||||
self._wire_events()
|
||||
|
||||
def teardown_surface(self, surface: SurfaceInfo) -> None:
|
||||
|
||||
27
diet_guard/_gatelock_logo.py
Normal file
27
diet_guard/_gatelock_logo.py
Normal file
@ -0,0 +1,27 @@
|
||||
"""The kuhy logo in a corner of each gate surface (shared ``kuhy_credit``).
|
||||
|
||||
Uses the Tk widget from kuhy_credit (kuhy-credit-v0.3.0). A click opens the
|
||||
credit panel; the site opens only on a further click, so the lock cannot be
|
||||
escaped by accident. This module imports tkinter and builds widgets, so it
|
||||
belongs in ``_GATE_TK_MODULES`` (see ``_gatelock_layout``).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit.tk import KuhyCredit
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import tkinter as tk
|
||||
|
||||
__all__ = ["place_logo"]
|
||||
|
||||
_MARGIN = 16
|
||||
|
||||
|
||||
def place_logo(parent: tk.Misc) -> KuhyCredit:
|
||||
"""Overlay the logo on ``parent``'s bottom-right corner."""
|
||||
credit = KuhyCredit(parent, theme="dark")
|
||||
credit.place(relx=1, rely=1, x=-_MARGIN, y=-_MARGIN, anchor="se")
|
||||
return credit
|
||||
@ -202,6 +202,8 @@ def fake_tk() -> Iterator[None]:
|
||||
with ExitStack() as stack:
|
||||
for module in _GATE_TK_MODULES:
|
||||
stack.enter_context(patch.object(module, "tk", _FAKE_TK))
|
||||
# The logo is a real Canvas subclass; it cannot take a fake parent.
|
||||
stack.enter_context(patch.object(_gatelock, "place_logo"))
|
||||
stack.enter_context(patch.object(_gatelock_calendar, "ttk", _FAKE_TTK))
|
||||
stack.enter_context(patch.object(_gatelock_calendar_ui, "ttk", _FAKE_TTK))
|
||||
# The schedule row's HH:MM spinboxes are ttk widgets; left real, they
|
||||
|
||||
@ -7,9 +7,10 @@ dependencies = [
|
||||
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.16.0#subdirectory=gatelock",
|
||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
||||
"freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.3#subdirectory=freedays",
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.0#subdirectory=kuhy_credit",
|
||||
"holds @ git+https://github.com/kuhyx/utils@holds-v0.1.0#subdirectory=holds",
|
||||
"sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.5#subdirectory=sickdays",
|
||||
"claude-agent-sdk==0.2.185",
|
||||
"sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.6#subdirectory=sickdays",
|
||||
"claude-agent-sdk==0.2.187",
|
||||
"defusedxml==0.7.1",
|
||||
"httpx==0.28.1",
|
||||
"requests==2.34.2",
|
||||
@ -25,7 +26,7 @@ dependencies = [
|
||||
mcp = ["mcp==2.3.0"]
|
||||
# Test-only: the property tests (test_claude_log.py) need it; same pin as
|
||||
# requirements.txt.
|
||||
dev = ["hypothesis==6.170.15"]
|
||||
dev = ["hypothesis==6.170.17"]
|
||||
|
||||
# Without this, setuptools' flat-layout auto-discovery treats the Flutter
|
||||
# app/ directory as a second top-level package and refuses to build.
|
||||
|
||||
@ -1,20 +1,21 @@
|
||||
# Diet Guard — runtime + development dependencies
|
||||
# Runtime: tkinter/json/hmac/fcntl (stdlib) plus gatelock and requests below.
|
||||
bandit==1.9.4
|
||||
claude-agent-sdk==0.2.185
|
||||
claude-agent-sdk==0.2.187
|
||||
codespell==2.4.3
|
||||
coverage==7.17.3
|
||||
coverage==7.17.4
|
||||
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync
|
||||
defusedxml==0.7.1
|
||||
freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.3#subdirectory=freedays
|
||||
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.16.0#subdirectory=gatelock
|
||||
holds @ git+https://github.com/kuhyx/utils@holds-v0.1.0#subdirectory=holds
|
||||
httpx==0.28.1
|
||||
hypothesis==6.170.15
|
||||
hypothesis==6.170.17
|
||||
kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.0#subdirectory=kuhy_credit
|
||||
mcp==2.3.0
|
||||
mypy==2.4.1
|
||||
pre-commit==4.7.0
|
||||
pydantic==2.14.3
|
||||
pydantic==2.14.4
|
||||
pylint==4.1.4
|
||||
pytest==9.2.0
|
||||
pytest-cov==7.1.0
|
||||
@ -24,5 +25,5 @@ pytest-xdist==3.8.0
|
||||
pytest-xvfb==3.1.1
|
||||
requests==2.34.2
|
||||
rtdb-relay @ git+https://github.com/kuhyx/utils@rtdb-relay-v0.2.1#subdirectory=rtdb_relay
|
||||
ruff==0.17.5
|
||||
sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.5#subdirectory=sickdays
|
||||
ruff==0.17.6
|
||||
sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.6#subdirectory=sickdays
|
||||
|
||||
Loading…
Reference in New Issue
Block a user