mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-30 07:45:23 +01:00
Compare commits
No commits in common. "191fa48b9d9365c97a5c42b7bb32b90cfbd7bee5" and "2c10788d44154563af6e3629632485959f886306" have entirely different histories.
191fa48b9d
...
2c10788d44
@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:wake_alarm_sync/screens/home_screen.dart';
|
||||
import 'package:wake_alarm_sync/ui/theme.dart';
|
||||
|
||||
/// Entry point.
|
||||
void main() => runApp(const WakeAlarmSyncApp());
|
||||
@ -15,7 +14,12 @@ class WakeAlarmSyncApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Wake Alarm Sync',
|
||||
theme: buildAppTheme(),
|
||||
theme: ThemeData.dark(useMaterial3: true).copyWith(
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: Colors.orange,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
),
|
||||
home: const HomeScreen(),
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:wake_alarm_sync/screens/settings_screen.dart';
|
||||
import 'package:wake_alarm_sync/services/alarm_sync_service.dart';
|
||||
import 'package:wake_alarm_sync/services/sync_settings.dart';
|
||||
import 'package:wake_alarm_sync/ui/theme.dart';
|
||||
|
||||
/// Main screen: displays the current alarm time and syncs it to the PC via
|
||||
/// the shared crdt_sync transport.
|
||||
@ -132,11 +131,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
title: const Text('Wake Alarm Sync'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.settings,
|
||||
// Dimmed relative to the adjacent title text (rule 28).
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
icon: const Icon(Icons.settings),
|
||||
onPressed: () async {
|
||||
await Navigator.push<void>(
|
||||
context,
|
||||
@ -200,22 +195,16 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: _status.contains('Error')
|
||||
? Theme.of(context).colorScheme.error
|
||||
: Theme.of(
|
||||
context,
|
||||
).extension<AppStatusColors>()!.success,
|
||||
? Colors.redAccent
|
||||
: Colors.greenAccent,
|
||||
),
|
||||
),
|
||||
if (!_configured) ...[
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
const Text(
|
||||
'Open Settings (gear icon) to connect GitHub.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).extension<AppStatusColors>()!.warning,
|
||||
),
|
||||
style: TextStyle(color: Colors.orange),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
@ -6,7 +6,6 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'package:wake_alarm_sync/services/github_device_auth.dart';
|
||||
import 'package:wake_alarm_sync/services/sync_settings.dart';
|
||||
import 'package:wake_alarm_sync/ui/theme.dart';
|
||||
|
||||
/// Settings screen for the GitHub connection used to sync the alarm.
|
||||
///
|
||||
@ -109,7 +108,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
: const Icon(Icons.link),
|
||||
label: const Text('Connect GitHub'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
textStyle: const TextStyle(fontSize: 16),
|
||||
),
|
||||
)
|
||||
@ -125,26 +124,18 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
_status,
|
||||
style: TextStyle(
|
||||
color: _status.contains('Error')
|
||||
? Theme.of(context).colorScheme.error
|
||||
: Theme.of(
|
||||
context,
|
||||
).extension<AppStatusColors>()!.success,
|
||||
? Colors.redAccent
|
||||
: Colors.greenAccent,
|
||||
),
|
||||
),
|
||||
const Divider(height: 32),
|
||||
Text(
|
||||
const Text(
|
||||
'PC config — create this file:\n'
|
||||
'~/.config/wake_alarm/sync.json\n\n'
|
||||
'{ "token": "<same token>" }\n\n'
|
||||
'The token needs "repo" scope so the PC can read '
|
||||
'kuhyx/syncs at shutdown.',
|
||||
// Was 12px/Colors.grey — below the 16px reading floor (rule
|
||||
// 20) and off-palette (rule 4); this is real setup
|
||||
// instructions, not decorative chrome.
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -160,8 +151,6 @@ class _StatusCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final success = Theme.of(context).extension<AppStatusColors>()!.success;
|
||||
return Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@ -169,11 +158,9 @@ class _StatusCard extends StatelessWidget {
|
||||
children: [
|
||||
Icon(
|
||||
connected ? Icons.check_circle : Icons.cancel,
|
||||
// Dimmed relative to the adjacent label text (rule 28).
|
||||
color: (connected ? success : colorScheme.error)
|
||||
.withValues(alpha: 0.8),
|
||||
color: connected ? Colors.greenAccent : Colors.redAccent,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
connected ? 'Connected to GitHub' : 'Not connected',
|
||||
@ -255,10 +242,7 @@ class _DeviceCodeDialogState extends State<_DeviceCodeDialog> {
|
||||
],
|
||||
)
|
||||
else
|
||||
Text(
|
||||
_error!,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
Text(_error!, style: const TextStyle(color: Colors.red)),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
|
||||
@ -1,86 +0,0 @@
|
||||
/// The app's design tokens: one identical palette shared across every one
|
||||
/// of kuhy's apps (Flutter, web, Python/Tkinter alike) — see the
|
||||
/// `unified-design-system` skill (`~/.claude/skills/unified-design-system/`)
|
||||
/// for the frozen token table this file implements. Built from an explicit
|
||||
/// `ColorScheme`, not `ColorScheme.fromSeed`, because the shared palette is
|
||||
/// hand-picked, not algorithmically derived from one seed color.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Builds the app's single dark `ThemeData` from the shared token set.
|
||||
ThemeData buildAppTheme() {
|
||||
const colorScheme = ColorScheme.dark(
|
||||
surface: Color(0xFF211D1B), // ink
|
||||
surfaceContainerHighest: Color(0xFF38312E), // ink-raised-2
|
||||
surfaceContainerHigh: Color(0xFF2B2624), // ink-raised-1
|
||||
onSurface: Color(0xFFECEAE9), // text-on-dark
|
||||
onSurfaceVariant: Color(0xFFAAA09A), // muted-on-dark
|
||||
outline: Color(0xFF463E3A), // line-dark
|
||||
primary: Color(0xFFB8862E), // accent
|
||||
onPrimary: Color(0xFF211D1B), // on-fill — filled surfaces use dark text
|
||||
// secondary/tertiary mirror primary — the shared palette has one accent,
|
||||
// not a separate secondary hue. Leaving these undefined lets Flutter
|
||||
// fall back to stock Material teal on any widget that reaches for
|
||||
// secondaryContainer (Chip, SegmentedButton, etc.) — confirmed as a
|
||||
// real, live bug on two other apps sharing this template.
|
||||
secondary: Color(0xFFB8862E),
|
||||
onSecondary: Color(0xFF211D1B),
|
||||
secondaryContainer: Color(0xFF463E3A),
|
||||
onSecondaryContainer: Color(0xFFB8862E),
|
||||
tertiary: Color(0xFFB8862E),
|
||||
onTertiary: Color(0xFF211D1B),
|
||||
tertiaryContainer: Color(0xFF463E3A),
|
||||
onTertiaryContainer: Color(0xFFB8862E),
|
||||
error: Color(0xFFE2585F), // danger
|
||||
onError: Color(0xFF211D1B), // on-fill
|
||||
);
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: colorScheme,
|
||||
scaffoldBackgroundColor: colorScheme.surface,
|
||||
extensions: const [AppStatusColors.dark],
|
||||
// No custom shadow/elevation exists elsewhere in this app — the one
|
||||
// Card (_StatusCard) is the sole place M3's default elevation would
|
||||
// otherwise introduce a shadow in an all-dark UI (rule 26).
|
||||
cardTheme: const CardThemeData(elevation: 0),
|
||||
);
|
||||
}
|
||||
|
||||
/// Semantic status colors M3's [ColorScheme] has no role for (it only has
|
||||
/// `error`). Used instead of the ad hoc `Colors.greenAccent`/`Colors.orange`
|
||||
/// literals previously scattered across both screens.
|
||||
@immutable
|
||||
class AppStatusColors extends ThemeExtension<AppStatusColors> {
|
||||
/// Creates a status-color set.
|
||||
const AppStatusColors({required this.success, required this.warning});
|
||||
|
||||
/// The shared dark-theme instance — success/warning from the unified
|
||||
/// palette (danger already exists as `colorScheme.error`).
|
||||
static const dark = AppStatusColors(
|
||||
success: Color(0xFF8A9A3C),
|
||||
warning: Color(0xFFE0A63C),
|
||||
);
|
||||
|
||||
/// Positive/connected status (e.g. "Connected to GitHub").
|
||||
final Color success;
|
||||
|
||||
/// Caution/pending status (e.g. "Open Settings to connect GitHub").
|
||||
final Color warning;
|
||||
|
||||
@override
|
||||
AppStatusColors copyWith({Color? success, Color? warning}) =>
|
||||
AppStatusColors(
|
||||
success: success ?? this.success,
|
||||
warning: warning ?? this.warning,
|
||||
);
|
||||
|
||||
@override
|
||||
AppStatusColors lerp(AppStatusColors? other, double t) {
|
||||
if (other is! AppStatusColors) return this;
|
||||
return AppStatusColors(
|
||||
success: Color.lerp(success, other.success, t) ?? success,
|
||||
warning: Color.lerp(warning, other.warning, t) ?? warning,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -21,7 +21,6 @@ import tkinter as tk
|
||||
from gatelock import GateRoot, LockConfig, LockWindow
|
||||
|
||||
from wake_alarm._alarm_display import _restore_display, _wake_display
|
||||
from wake_alarm._alarm_view import _build_alarm_view
|
||||
from wake_alarm._audio import (
|
||||
_beep_loud,
|
||||
_beep_medium,
|
||||
@ -69,6 +68,20 @@ def _is_alarm_day() -> bool:
|
||||
return datetime.now(tz=timezone.utc).weekday() in ALARM_DAYS
|
||||
|
||||
|
||||
@dataclass
|
||||
class _AlarmView:
|
||||
"""The Tk widgets that make up the alarm's dismiss-challenge screen."""
|
||||
|
||||
container: tk.Frame
|
||||
title_label: tk.Label
|
||||
round_label: tk.Label
|
||||
info_label: tk.Label
|
||||
code_label: tk.Label
|
||||
entry: tk.Entry
|
||||
status_label: tk.Label
|
||||
timer_label: tk.Label
|
||||
|
||||
|
||||
@dataclass
|
||||
class _AlarmProgress:
|
||||
"""Mutable dismiss-challenge progress state."""
|
||||
@ -108,14 +121,11 @@ class WakeAlarm:
|
||||
self.root.title("Wake Alarm" + (" [DEMO]" if demo_mode else ""))
|
||||
# mode="soft": no watchdog exists yet for a clean, silent lock
|
||||
# failure, so hard-lock (overrideredirect + grab) is deferred.
|
||||
config = LockConfig(mode="soft")
|
||||
self._lock = LockWindow(self.root, config, hooks=self)
|
||||
self._lock = LockWindow(self.root, LockConfig(mode="soft"), hooks=self)
|
||||
self._lock.setup()
|
||||
|
||||
self._progress = _AlarmProgress(current_challenge=_make_challenge())
|
||||
self._view = _build_alarm_view(
|
||||
self.root, self._progress.current_challenge, config, self._on_submit
|
||||
)
|
||||
self._view = self._build_ui()
|
||||
self._update_timer()
|
||||
if self._progress.current_challenge.kind == "flash":
|
||||
self._start_flash_countdown()
|
||||
@ -149,6 +159,92 @@ class WakeAlarm:
|
||||
_restore_display()
|
||||
turn_off_plug()
|
||||
|
||||
def _build_ui(self) -> _AlarmView:
|
||||
"""Build the dismiss-challenge UI and return its widgets as a view."""
|
||||
challenge = self._progress.current_challenge
|
||||
|
||||
container = tk.Frame(self.root, bg="#1a1a1a")
|
||||
container.place(relx=0.5, rely=0.5, anchor="center")
|
||||
|
||||
title_label = tk.Label(
|
||||
container,
|
||||
text="WAKE UP!",
|
||||
font=("Arial", 48, "bold"),
|
||||
fg="#ff4444",
|
||||
bg="#1a1a1a",
|
||||
)
|
||||
title_label.pack(pady=20)
|
||||
|
||||
round_label = tk.Label(
|
||||
container,
|
||||
text=f"Round 1 / {DISMISS_ROUNDS_REQUIRED}",
|
||||
font=("Arial", 24, "bold"),
|
||||
fg="#ffaa00",
|
||||
bg="#1a1a1a",
|
||||
)
|
||||
round_label.pack(pady=5)
|
||||
|
||||
info_label = tk.Label(
|
||||
container,
|
||||
text=challenge.hint,
|
||||
font=("Arial", 18),
|
||||
fg="white",
|
||||
bg="#1a1a1a",
|
||||
)
|
||||
info_label.pack(pady=10)
|
||||
|
||||
# Non-flash types use a smaller font because their display text is wider.
|
||||
code_font_size = (
|
||||
48 if challenge.kind in ("math", "sort", "sequence", "reverse") else 72
|
||||
)
|
||||
code_label = tk.Label(
|
||||
container,
|
||||
text=challenge.display,
|
||||
font=("Courier", code_font_size, "bold"),
|
||||
fg="#00ff00",
|
||||
bg="#1a1a1a",
|
||||
)
|
||||
code_label.pack(pady=30)
|
||||
|
||||
entry = tk.Entry(
|
||||
container,
|
||||
font=("Courier", 36),
|
||||
justify="center",
|
||||
width=12,
|
||||
)
|
||||
entry.pack(pady=10)
|
||||
entry.focus_set()
|
||||
entry.bind("<Return>", self._on_submit)
|
||||
|
||||
status_label = tk.Label(
|
||||
container,
|
||||
text="",
|
||||
font=("Arial", 18),
|
||||
fg="#ff4444",
|
||||
bg="#1a1a1a",
|
||||
)
|
||||
status_label.pack(pady=10)
|
||||
|
||||
timer_label = tk.Label(
|
||||
container,
|
||||
text="",
|
||||
font=("Arial", 14),
|
||||
fg="#aaaaaa",
|
||||
bg="#1a1a1a",
|
||||
)
|
||||
timer_label.pack(pady=5)
|
||||
|
||||
return _AlarmView(
|
||||
container=container,
|
||||
title_label=title_label,
|
||||
round_label=round_label,
|
||||
info_label=info_label,
|
||||
code_label=code_label,
|
||||
entry=entry,
|
||||
status_label=status_label,
|
||||
timer_label=timer_label,
|
||||
)
|
||||
|
||||
def _on_submit(self, _event: object = None) -> None:
|
||||
"""Handle challenge submission.
|
||||
|
||||
@ -164,7 +260,7 @@ class WakeAlarm:
|
||||
if self._progress.current_challenge.kind == "flash":
|
||||
self._view.code_label.configure(
|
||||
text=self._progress.current_challenge.display,
|
||||
fg=self._view.config.success,
|
||||
fg="#00ff00",
|
||||
)
|
||||
self._start_flash_countdown()
|
||||
return
|
||||
@ -175,7 +271,7 @@ class WakeAlarm:
|
||||
self._progress.current_challenge = _make_challenge()
|
||||
self._view.code_label.configure(
|
||||
text=self._progress.current_challenge.display,
|
||||
fg=self._view.config.success,
|
||||
fg="#00ff00",
|
||||
)
|
||||
self._view.info_label.configure(text=self._progress.current_challenge.hint)
|
||||
self._view.entry.delete(0, tk.END)
|
||||
@ -206,7 +302,7 @@ class WakeAlarm:
|
||||
self.root.after(1000, self._flash_tick)
|
||||
else:
|
||||
hidden = "?" * len(self._progress.current_challenge.display)
|
||||
self._view.code_label.configure(text=hidden, fg=self._view.config.muted)
|
||||
self._view.code_label.configure(text=hidden, fg="#555555")
|
||||
self._view.status_label.configure(text="Now type the code from memory!")
|
||||
|
||||
def _dismiss_alarm(self, *, earned_skip: bool) -> None:
|
||||
@ -225,15 +321,14 @@ class WakeAlarm:
|
||||
if earned_skip
|
||||
else "Alarm dismissed. No workout skip."
|
||||
)
|
||||
cfg = self._view.config
|
||||
color = cfg.success if earned_skip else cfg.warning
|
||||
color = "#00ff00" if earned_skip else "#ffaa00"
|
||||
|
||||
tk.Label(
|
||||
self._view.container,
|
||||
text=msg,
|
||||
font=("Arial", 36, "bold"),
|
||||
fg=color,
|
||||
bg=cfg.bg,
|
||||
bg="#1a1a1a",
|
||||
).pack(pady=30)
|
||||
|
||||
self.root.after(3000, self._lock.close)
|
||||
@ -249,7 +344,7 @@ class WakeAlarm:
|
||||
self._progress.current_challenge = _make_challenge()
|
||||
self._view.code_label.configure(
|
||||
text=self._progress.current_challenge.display,
|
||||
fg=self._view.config.success,
|
||||
fg="#00ff00",
|
||||
)
|
||||
self._view.info_label.configure(text=self._progress.current_challenge.hint)
|
||||
self._view.entry.delete(0, tk.END)
|
||||
@ -311,8 +406,7 @@ class WakeAlarm:
|
||||
"""Alternate background colour every 750 ms (below seizure-risk 3 Hz)."""
|
||||
if not self._active:
|
||||
return
|
||||
cfg = self._view.config
|
||||
self.root.configure(bg=cfg.danger if self._progress.flash_on else cfg.bg)
|
||||
self.root.configure(bg="#ff0000" if self._progress.flash_on else "#1a1a1a")
|
||||
self._progress.flash_on = not self._progress.flash_on
|
||||
self.root.after(750, self._flash_step)
|
||||
|
||||
|
||||
@ -1,122 +0,0 @@
|
||||
"""Widget construction for the wake alarm's dismiss-challenge screen."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import tkinter as tk
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from wake_alarm._constants import DISMISS_ROUNDS_REQUIRED
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
|
||||
from gatelock import LockConfig
|
||||
|
||||
from wake_alarm._challenges import _Challenge
|
||||
|
||||
|
||||
@dataclass
|
||||
class _AlarmView:
|
||||
"""The Tk widgets that make up the alarm's dismiss-challenge screen."""
|
||||
|
||||
container: tk.Frame
|
||||
title_label: tk.Label
|
||||
round_label: tk.Label
|
||||
info_label: tk.Label
|
||||
code_label: tk.Label
|
||||
entry: tk.Entry
|
||||
status_label: tk.Label
|
||||
timer_label: tk.Label
|
||||
config: LockConfig
|
||||
|
||||
|
||||
def _build_alarm_view(
|
||||
root: tk.Tk,
|
||||
challenge: _Challenge,
|
||||
config: LockConfig,
|
||||
on_submit: Callable[[object], None],
|
||||
) -> _AlarmView:
|
||||
"""Build the dismiss-challenge UI and return its widgets as a view."""
|
||||
container = tk.Frame(root, bg=config.bg)
|
||||
container.place(relx=0.5, rely=0.5, anchor="center")
|
||||
|
||||
title_label = tk.Label(
|
||||
container,
|
||||
text="WAKE UP!",
|
||||
font=("Arial", 48, "bold"),
|
||||
fg=config.danger,
|
||||
bg=config.bg,
|
||||
)
|
||||
title_label.pack(pady=20)
|
||||
|
||||
round_label = tk.Label(
|
||||
container,
|
||||
text=f"Round 1 / {DISMISS_ROUNDS_REQUIRED}",
|
||||
font=("Arial", 24, "bold"),
|
||||
fg=config.warning,
|
||||
bg=config.bg,
|
||||
)
|
||||
round_label.pack(pady=5)
|
||||
|
||||
info_label = tk.Label(
|
||||
container,
|
||||
text=challenge.hint,
|
||||
font=("Arial", 18),
|
||||
fg=config.fg,
|
||||
bg=config.bg,
|
||||
)
|
||||
info_label.pack(pady=10)
|
||||
|
||||
# Non-flash types use a smaller font because their display text is wider.
|
||||
code_font_size = (
|
||||
48 if challenge.kind in ("math", "sort", "sequence", "reverse") else 72
|
||||
)
|
||||
code_label = tk.Label(
|
||||
container,
|
||||
text=challenge.display,
|
||||
font=("Courier", code_font_size, "bold"),
|
||||
fg=config.success,
|
||||
bg=config.bg,
|
||||
)
|
||||
code_label.pack(pady=30)
|
||||
|
||||
entry = tk.Entry(
|
||||
container,
|
||||
font=("Courier", 36),
|
||||
justify="center",
|
||||
width=12,
|
||||
)
|
||||
entry.pack(pady=10)
|
||||
entry.focus_set()
|
||||
entry.bind("<Return>", on_submit)
|
||||
|
||||
status_label = tk.Label(
|
||||
container,
|
||||
text="",
|
||||
font=("Arial", 18),
|
||||
fg=config.danger,
|
||||
bg=config.bg,
|
||||
)
|
||||
status_label.pack(pady=10)
|
||||
|
||||
timer_label = tk.Label(
|
||||
container,
|
||||
text="",
|
||||
font=("Arial", 14),
|
||||
fg=config.muted,
|
||||
bg=config.bg,
|
||||
)
|
||||
timer_label.pack(pady=5)
|
||||
|
||||
return _AlarmView(
|
||||
container=container,
|
||||
title_label=title_label,
|
||||
round_label=round_label,
|
||||
info_label=info_label,
|
||||
code_label=code_label,
|
||||
entry=entry,
|
||||
status_label=status_label,
|
||||
timer_label=timer_label,
|
||||
config=config,
|
||||
)
|
||||
@ -60,7 +60,6 @@ def _block_real_tk() -> Generator[MagicMock]:
|
||||
mock = _make_mock_tk()
|
||||
with (
|
||||
patch("wake_alarm._alarm.tk", mock),
|
||||
patch("wake_alarm._alarm_view.tk", mock),
|
||||
patch(
|
||||
"wake_alarm._alarm.GateRoot",
|
||||
return_value=mock.Tk.return_value,
|
||||
@ -75,7 +74,6 @@ def mock_tk_module() -> Generator[MagicMock]:
|
||||
mock = _make_mock_tk()
|
||||
with (
|
||||
patch("wake_alarm._alarm.tk", mock),
|
||||
patch("wake_alarm._alarm_view.tk", mock),
|
||||
patch(
|
||||
"wake_alarm._alarm.GateRoot",
|
||||
return_value=mock.Tk.return_value,
|
||||
|
||||
@ -42,7 +42,6 @@ def _block_real_tk() -> Generator[MagicMock]:
|
||||
mock = _make_mock_tk()
|
||||
with (
|
||||
patch("wake_alarm._alarm.tk", mock),
|
||||
patch("wake_alarm._alarm_view.tk", mock),
|
||||
patch(
|
||||
"wake_alarm._alarm.GateRoot",
|
||||
return_value=mock.Tk.return_value,
|
||||
@ -76,7 +75,6 @@ def mock_tk_module() -> Generator[MagicMock]:
|
||||
mock = _make_mock_tk()
|
||||
with (
|
||||
patch("wake_alarm._alarm.tk", mock),
|
||||
patch("wake_alarm._alarm_view.tk", mock),
|
||||
patch(
|
||||
"wake_alarm._alarm.GateRoot",
|
||||
return_value=mock.Tk.return_value,
|
||||
@ -399,7 +397,7 @@ class TestScreenFlash:
|
||||
alarm._progress.flash_on = False
|
||||
alarm._flash_step()
|
||||
|
||||
mock_root.configure.assert_called_once_with(bg=alarm._view.config.bg)
|
||||
mock_root.configure.assert_called_once_with(bg="#1a1a1a")
|
||||
assert alarm._progress.flash_on is True
|
||||
mock_root.after.assert_called_with(750, alarm._flash_step)
|
||||
alarm._stop_beep.set()
|
||||
@ -417,7 +415,7 @@ class TestScreenFlash:
|
||||
alarm._progress.flash_on = True
|
||||
alarm._flash_step()
|
||||
|
||||
mock_root.configure.assert_called_once_with(bg=alarm._view.config.danger)
|
||||
mock_root.configure.assert_called_once_with(bg="#ff0000")
|
||||
assert alarm._progress.flash_on is False
|
||||
mock_root.after.assert_called_with(750, alarm._flash_step)
|
||||
alarm._stop_beep.set()
|
||||
|
||||
@ -41,7 +41,6 @@ def _block_real_tk() -> Generator[MagicMock]:
|
||||
mock = _make_mock_tk()
|
||||
with (
|
||||
patch("wake_alarm._alarm.tk", mock),
|
||||
patch("wake_alarm._alarm_view.tk", mock),
|
||||
patch(
|
||||
"wake_alarm._alarm.GateRoot",
|
||||
return_value=mock.Tk.return_value,
|
||||
@ -75,7 +74,6 @@ def mock_tk_module() -> Generator[MagicMock]:
|
||||
mock = _make_mock_tk()
|
||||
with (
|
||||
patch("wake_alarm._alarm.tk", mock),
|
||||
patch("wake_alarm._alarm_view.tk", mock),
|
||||
patch(
|
||||
"wake_alarm._alarm.GateRoot",
|
||||
return_value=mock.Tk.return_value,
|
||||
|
||||
@ -40,7 +40,6 @@ def _block_real_tk() -> Generator[MagicMock]:
|
||||
mock = _make_mock_tk()
|
||||
with (
|
||||
patch("wake_alarm._alarm.tk", mock),
|
||||
patch("wake_alarm._alarm_view.tk", mock),
|
||||
patch(
|
||||
"wake_alarm._alarm.GateRoot",
|
||||
return_value=mock.Tk.return_value,
|
||||
@ -74,7 +73,6 @@ def mock_tk_module() -> Generator[MagicMock]:
|
||||
mock = _make_mock_tk()
|
||||
with (
|
||||
patch("wake_alarm._alarm.tk", mock),
|
||||
patch("wake_alarm._alarm_view.tk", mock),
|
||||
patch(
|
||||
"wake_alarm._alarm.GateRoot",
|
||||
return_value=mock.Tk.return_value,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user