Undo/redo, frictionless delete/merge, exclusive tools, dataset-splitter fixes (#80, #81)#26
Merged
Merged
Conversation
… fixes Bundles seven related changes: Dataset splitter (dialogs/dataset_splitter.py) - bnsreenu#81: compute_split_counts() + bounded slices so a 0% subset yields exactly 0 images (was leaking the flooring remainder into test). - bnsreenu#80: auto-balance the train/val/test spin boxes so they always sum to 100 (val absorbs train; test→train absorb val; etc.). Frictionless destructive ops (annotation_controller.py) - Delete: removed the confirmation AND success dialogs — instant. - Merge: removed the keep/delete prompt (always replaces originals with the union) and the success dialog. Undo/redo for annotation edits (ADR-026) - New controllers/annotation_history.py: snapshot-based, per-image-key undo/redo stacks with deep-equal dedup and a depth cap. - record_history() choke-point before every synchronous mutation (finish poly/rect, delete, merge, change-class, eraser, SAM/DINO accept); deferred bbox/paint/temp gestures capture a baseline at start (editBaselineRequested) and push it at commit. - Detail-% drags coalesce to one undo entry. - Ctrl+Z / Ctrl+Y / Ctrl+Shift+Z as ApplicationShortcuts; undo/redo no-op during load, modal, text focus, or an in-flight gesture. Tool mode (annotator_window.py, sam_controller.py, image_label.py) - F: single activate_tool() choke-point makes all six tools (incl. SAM) mutually exclusive — a SAM tool can no longer be active alongside a manual tool. - G: Esc cancels the in-progress shape AND returns to selection mode (selectModeRequested -> activate_tool(None)). Docs: ADR-026, crosscutting concepts (tool activation, Esc), runtime view, CLAUDE.md shortcuts + patterns table. Tests: +114 (splitter math/balance, AnnotationHistory unit, history integration incl. mid-paint-undo + number-parity guards, tool mode). 378 passed, 3 skipped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Vertex edits (double-click polygon edit) were the one annotation edit Ctrl+Z couldn't reverse. Their Enter-commit only refreshed the list and relied on a later save to persist, and Esc silently kept the in-place vertex drags instead of reverting them. - start_polygon_edit captures the segmentation + emits editBaselineRequested (undo baseline) on entry. - New polygonEditCommitted signal -> commit_polygon_edit syncs all_annotations (save_current_annotations) + pushes the baseline + refreshes the list. Gated on an actual geometry change. - Esc now reverts the drags from the captured original; _editing_polygon_orig is cleared on commit/cancel/delete/exit/clear. Tests: vertex-edit commit->undo and Esc-reverts-without-history. 380 passed, 3 skipped. ADR-026 + CLAUDE.md updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
switch_slice didn't call exit_editing_mode the way switch_image does, so editing a polygon then switching slice left editing_polygon and the new _editing_polygon_orig pointing at the previous slice's object (stale overlay). One-line parity fix; closes the leak for multi-dim stacks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Merges the feature branch into the fork's master so it's usable locally. Full details and upstream submission: bnsreenu#82.
Summary: snapshot-based undo/redo for all annotation edits (Ctrl+Z/Y), frictionless delete & merge (no confirm/success dialogs), mutually-exclusive tools, Esc → selection mode, and dataset-splitter fixes (bnsreenu#80 auto-balance, bnsreenu#81 test=0% → 0 images). 380 tests pass; senior-reviewer clean.
🤖 Generated with Claude Code