Skip to content

Make Escape activate No on the update-available dialog#14

Open
blindndangerous wants to merge 4 commits intomasonasons:masterfrom
blindndangerous:feature/escape-no-on-update-dialog
Open

Make Escape activate No on the update-available dialog#14
blindndangerous wants to merge 4 commits intomasonasons:masterfrom
blindndangerous:feature/escape-no-on-update-dialog

Conversation

@blindndangerous
Copy link
Contributor

@blindndangerous blindndangerous commented Mar 23, 2026

Summary

  • Pressing Escape on any yes/no dialog now activates No — because wx returns ID_CANCEL when Escape is pressed on a dialog with no Cancel button, and question() already treats any non-ID_YES result as No
  • Enter always activates Yes (the default button) — unchanged behavior
  • Tabbing to the No button then pressing Enter activates No — standard focus behavior, unchanged
  • Applies to all yes/no dialogs in the app, including the update-available prompt
  • Removes the no_default=True / wx.NO_DEFAULT approach from the previous attempt, which incorrectly made No the default (Enter = No)

How it works

wx.MessageDialog with wx.YES_NO shows Yes as the default button. When the user presses Escape, wx returns wx.ID_CANCEL (not wx.ID_YES or wx.ID_NO). Since question() only returns 1 for ID_YES and 2 for everything else, Escape naturally becomes No — no extra flags needed.

Test plan

  • pytest tests/test_application_question.py → 10 passed
  • Yes click → returns 1
  • No click → returns 2
  • Escape (ID_CANCEL) → returns 2
  • Dialog style never includes NO_DEFAULT (Yes stays default)
  • Dialog always destroyed after use
  • question_from_thread() maps all three paths correctly
  • Build or run from source, trigger the update-available dialog
  • Confirm Enter activates Yes (update proceeds)
  • Confirm Escape activates No (dialog closes, no download)
  • Confirm Tab to No then Enter activates No

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 <claude[bot]@users.noreply.github.com>
Human Testing Verification: blindndangerous

Adds no_default parameter to question() and question_from_thread().
The update check passes no_default=True so No is the default button —
pressing Escape (or Enter) declines the update instead of accepting it.
All other yes/no dialogs in the app are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@blindndangerous blindndangerous marked this pull request as draft March 23, 2026 02:57
blindndangerous and others added 3 commits March 22, 2026 21:05
conftest.py adds the project root to sys.path so top-level modules
(config, repo_sync, etc.) are importable from the tests/ subdirectory.
pytest.ini sets --basetemp=.pytest_tmp to avoid Windows temp-dir
permission errors when using the tmp_path fixture.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove wx.NO_DEFAULT — it made No the default button so Enter would
activate No immediately, which was wrong. Standard wx.YES_NO keeps Yes
as the default (Enter = Yes, Tab to No then Enter = No). When the user
presses Escape on a YES_NO dialog, wx returns ID_CANCEL which is not
ID_YES, so question() already returns 2 (No) — no special handling needed.

Applies to all yes/no dialogs including the update-available prompt.

Co-Authored-By: Claude Sonnet 4.6 <claude[bot]@users.noreply.github.com>
10 tests: Yes click returns 1, No click returns 2, Escape (ID_CANCEL)
returns 2, dialog style never includes NO_DEFAULT flag (Yes stays default),
dialog is always destroyed, question_from_thread() maps all three paths
correctly when invoked via CallAfter.

Co-Authored-By: Claude Sonnet 4.6 <claude[bot]@users.noreply.github.com>
@blindndangerous blindndangerous marked this pull request as ready for review March 23, 2026 03:07
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