Skip to content

Comments

feat: notification improvements, tray balloon fallback, and debug tools#329

Merged
Orinks merged 16 commits intodevfrom
fix/notification-debug-and-priority-labels
Feb 23, 2026
Merged

feat: notification improvements, tray balloon fallback, and debug tools#329
Orinks merged 16 commits intodevfrom
fix/notification-debug-and-priority-labels

Conversation

@Orinks
Copy link
Owner

@Orinks Orinks commented Feb 20, 2026

What changed

Notifications now appear when the app is in the system tray

When the main window is minimized to the notification area, Windows was silently dropping toast notifications. A tray balloon fallback now fires automatically so you never miss an alert or discussion update, even when AccessiWeather is running in the background.

Notifications correctly labeled as AccessiWeather

Toast notifications and balloon tips now show "AccessiWeather" as the source instead of "notification from Python".

Debug menu: separate notification test items

The single "Test Notifications" item has been replaced with a full Debug submenu (visible in debug mode):

  • Test: Discussion Updated — fires a real notification simulating an NWS discussion update, with sound
  • Test: Alert Notification... — opens a picker with 12 preset alert types (Tornado Warning, Severe Thunderstorm, Flash Flood, Hurricane, Winter Storm, Fog, Frost, Heat, etc.). Shows the sound event candidates in priority order so soundpacks can be auditioned for each type
  • Test: Tray Balloon (direct) — calls the tray balloon fallback path directly to confirm it is wired up, with sound
  • Run Notification Diagnostics — original pass/fail system diagnostic

The same submenu is available from the system tray right-click menu.

Bug fix: metric labels after alert priority reorder

When a weather alert (e.g. Dense Fog Advisory) triggered a metric reorder, the fallback text hard-coded Temperature: as the label for the first metric regardless of what it actually was — producing output like "Temperature: ESE at 6.9 mph". All metrics now use their real labels. Regression test added.

Notification pipeline debug logging

Added structured [toast], [notify], [alertmgr], and [events] debug logging across the notification stack to help diagnose notification delivery issues.

Testing

  • Debug mode: Help → Debug or tray right-click → Debug to access all test items
  • Minimize to tray and use "Test: Discussion Updated" to verify balloon fallback
  • "Test: Tray Balloon (direct)" to confirm wiring and custom sound playback

…order

When a weather alert (e.g. Dense Fog Advisory) is active, the
PriorityEngine reorders metrics so the relevant category appears first.
The fallback_text builder was hard-coding 'Temperature:' as the label
for metrics[0] regardless of what it was after reordering, producing
output like 'Temperature: ESE at 6.9 mph' instead of 'Wind: ESE at 6.9 mph'.

Fix: iterate all metrics using their actual labels.

Also adds a regression test covering the fog-alert reorder scenario.
Covers the full toast + sound path to diagnose 'sound plays but toast
doesn't show when app is minimized':

- toast_notifier.py: [toast] prefix logs on worker health, future
  result, desktop-notifier availability, thread name, sound path
- alert_notification_system.py: [notify] prefix logs on alert count,
  queued notifications, sound candidates
- alert_manager.py: [alertmgr] prefix logs on skip reasons, per-alert
  and global cooldown remaining time; upgrade key messages to INFO
- main_window.py: [events] prefix logs on discussion-update path,
  notifier source, event count, per-event send result
…tion testing

- Add 'Test: Discussion Updated' — fires real NWS discussion update notification
- Add 'Test: Alert Notification...' — opens DebugAlertDialog with 12 preset
  alert types (Tornado Warning, Severe Thunderstorm, Flash Flood, Hurricane,
  Winter Storm, Fog, Frost, Heat, SWS, Air Quality, etc.)
- Dialog shows sound event candidates in priority order so soundpacks
  can be auditioned for each alert type
- Rename existing test to 'Run Notification Diagnostics' (still in submenu)
- Debug submenu only visible when app.debug_mode is True
… menu

- Tray right-click Debug submenu matches main window Help → Debug
- Discussion and alert test items delegate to main window handlers
- Alert dialog falls back gracefully if main window not open
- Diagnostics item still runs pass/fail test
- Tray alert test creates DebugAlertDialog directly (parent=None if needed)
- Dialog centres on screen when no parent window is available
- Notifications and sound never required the main window; dialog now doesn't either
…hidden)

When the main window is minimized to the system tray, Windows silently
drops WinRT toast notifications from the app. Sound still played (via
sound_player), but no visual notification appeared.

Fix: add optional balloon_fn callback to SafeDesktopNotifier. When
_send_in_worker returns False, call balloon_fn(title, message) if set.
After tray icon init, wire balloon_fn to tray_icon.ShowBalloon() so
users get a tray balloon notification when the window is hidden.
Calls balloon_fn directly to verify the tray fallback is wired before
testing the full WinRT → balloon code path. Shows the message in the
balloon if balloon_fn is set, or falls back to ShowBalloon directly.
Available in both Help → Debug and tray right-click → Debug.
Without an AUMID, Windows labels balloon tips and toast notifications
as 'notification from Python' (the process name). Setting the AUMID to
'Orinks.AccessiWeather' makes the source label read 'AccessiWeather'
across all notification types. No-ops silently on non-Windows.
…lloon

Direct balloon test was missing the _play_sound call that the real
send_notification path makes after balloon_fn. Now mirrors the full
fallback path: show balloon (silent) + play custom soundpack sound.
@Orinks Orinks changed the title fix: correct priority-reorder labels + notification pipeline debug logging feat: notification improvements, tray balloon fallback, and debug tools Feb 23, 2026
@Orinks Orinks merged commit 5ae969e into dev Feb 23, 2026
6 checks passed
@Orinks Orinks deleted the fix/notification-debug-and-priority-labels branch February 23, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant