Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Manual GUI validation remains necessary because the change affects nested Qt modal-dialog reuse and main-window close/cleanup sequencing, while automated tests mock QInputDialog and close() without exercising real event-loop and closeEvent behavior.
No open issues 🎉
What changed in this PR
Updates the first-behavior prompt so it cannot return without a valid behavior name after blank input or a declined quit, preventing empty behavior-change events.
Changes:
- Re-prompts after blank or whitespace-only names, trims surrounding whitespace, and shows a validation message.
- Re-prompts after a declined main-window close, restores the normal prompt text, and logs the event.
- Adds UI regression tests for blank names, declined quits, signal emissions, and handler reconnection.
| File | Description |
|---|---|
| tests/ui/test_main_control_widget.py | Adds regression tests covering blank-name validation, declined quits, normalized names, behavior-change signals, and handler reconnection. |
| src/jabs/ui/main_control_widget/main_control_widget.py | Implements repeated prompting, blank-name validation, whitespace trimming, and declined-quit handling. |
Review effort: Lite
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
KLAUS-847. Follow-up to #620.
When a JABS project has no behaviors, the "New Behavior" prompt asks for one. Its Cancel button is "Quit JABS". If the main window declined that close,
_get_first_labelreturned with no behavior. Both callers (opening a project, archiving the last behavior) then emittedbehavior_changed(''), so the classifier load, counts and settings save ran for an empty behavior name, and the prompt never came back. Clicking OK with a blank name led to the same state._get_first_labelnow asks again in both cases, so it only returns once a behavior has been entered:The callers are unchanged. Nothing in JABS declines the main window's close today (
MainWindow.closeEventkeepsQMainWindow's default accept), so the declined-quit path is defensive. The blank-name path can be reached by anyone.The reserved multi-class name "None", and blank names in the "+" dialog, are still accepted. That is tracked in KLAUS-848.
Tests
test_first_label_asks_again_when_the_quit_is_declined,test_declined_quit_after_archiving_the_last_behavior_asks_againandtest_declined_quit_on_project_open_asks_again: the user quits once, the window refuses, and the user then enters "Walk". Only["Walk"]is emitted, and after archiving the drop-down's change handler still works.test_first_label_asks_again_for_a_blank_name: "", then " ", then " Walk ". The prompt shows the blank-name message twice and adds "Walk" once.test_declined_quit_resets_the_blank_name_message: blank name, declined quit, then "Walk". The prompt goes back to its normal text after the declined quit.All five fail without the fix. They replace the two tests that pinned the old behavior: the declined quit returning with no behavior, and #620's empty-name emit.
tests/ui: 629 passed. Not yet exercised by hand in the GUI.