Add 'Classify Video' context-menu action to classify a single video#411
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a “Classify Video” context-menu action to the project video list, enabling on-demand classification of a single selected video using the currently selected behavior, while reusing the existing classification pipeline and save-to-disk behavior.
Changes:
- Extend
ClassifyThreadto optionally classify only a provided subset of video filenames (default remains “classify all”). - Add central-widget helpers/signals to start subset classification, guard against re-entry, and auto-switch to the classified video when appropriate.
- Add a new video-list context-menu action and wire it through
MainWindow, with unit tests covering new branches and signal behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ui/test_video_list_widget.py | Adds tests for context-menu action enablement and signal emission for “Classify Video”. |
| tests/ui/test_classification_thread.py | Adds tests validating subset and empty-subset behavior in ClassifyThread. |
| tests/ui/test_central_widget.py | Adds tests for classify availability signaling, single-video start behavior, re-entry guard, and completion-branch behavior. |
| src/jabs/ui/main_window/video_list_widget.py | Implements the “Classify Video” context-menu action, a new signal, and availability toggling. |
| src/jabs/ui/main_window/main_window.py | Wires new signals between the video list dock and central widget (request/availability/auto-switch). |
| src/jabs/ui/main_window/central_widget.py | Centralizes classify-enabled state, adds subset classification entry point, tracks classification targets, and updates completion handling. |
| src/jabs/ui/classification_thread.py | Adds optional videos parameter to restrict iteration to a provided list. |
| src/jabs/scripts/cli/cli.py | Removes an overly-specific type annotation for CLASSIFIER_CHOICES (no behavior change). |
Comments suppressed due to low confidence (1)
src/jabs/ui/main_window/central_widget.py:1131
- _classification_targets is cleared on successful completion, but not on the error/cancel path. If classification fails or is canceled, this leaves stale state hanging around, which can make future branching logic around targets harder to reason about (and risks accidental reuse if the attribute is consulted elsewhere later). Consider clearing it in _classify_thread_error_callback as part of cleanup.
self._set_classify_enabled(False)
def _classify_thread_error_callback(self, error: Exception) -> None:
"""handle an error in the classification thread"""
self._cleanup_classify_thread()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bergsalex
approved these changes
Jul 14, 2026
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.
Summary
Adds a "Classify Video" action to the right-click context menu in the project video list, so a user can classify a single video on demand instead of running classification across every video in the project.
Primary use case: right-click a video → "Exclude from Training", train a new classifier, then right-click that same video → "Classify Video" to inspect how the classifier performs on that specific held-out video.
Jira: KLAUS-504
Behavior
Changes
ui/classification_thread.py—ClassifyThreadgained an optionalvideos: list[str] | Noneparam;run()iterates that subset when given, else all project videos (defaultNone= existing behavior).ui/main_window/central_widget.py—_classify_button_clickeddelegates to a shared_start_classification(videos); newclassify_single_video(name)entry point; re-entry guard while a run is active; completion handler refreshes the view only when the loaded video was classified, otherwise emitsrequest_video_selectionto auto-switch; classify-button enabled state centralized into_set_classify_enabled()which emits a newclassify_availability_changedsignal.ui/main_window/video_list_widget.py— new "Classify Video" context-menu action,classify_video_requestedsignal, andset_classify_available().ui/main_window/main_window.py— wires the new signals between the video list dock and the central widget.Testing
ClassifyThread, menu action enablement + signal emission,_set_classify_enabled, single-video start guard, and all three completion branches (refresh-all, refresh-loaded-in-subset, auto-switch).uv run pytest tests/ui→ 121 passed.ruff check .andruff format --check→ clean.