feat(dupe): add Keep dropdown criteria and AoK toggle (#136) #141

Merged
ValleyGeek merged 6 commits from 0.2.4/issue-136-keep-dropdown into main 2026-06-25 06:11:49 +00:00
Member

Summary

  • Replaces the single-criterion Keep Best button with Keep plus a criterion dropdown — choose File Size, Resolution, Sharpness, Filename, Directory name, or Relative Path, each available Largest/Longest or Smallest/Shortest, to decide which image in the active duplicate group to keep. The rest are marked DELETE, and DELETE is cleared from the kept image if an earlier Keep press (with a different criterion) had already marked it.
  • Default criterion is File Size - Largest, configurable in Settings → Duplicates → Default Keep criterion.
  • Ties are broken alphabetically by relative path.
  • New AoK (Advance on Keep) toggle, on by default, controls whether the workbench jumps to the next group after Keep is applied. Default keyboard shortcut for Keep is C.
  • Follow-up fixes from real-world testing: removed the colon from the button label ("Keep:" → "Keep"); switched the default away from Resolution - Largest to File Size - Largest; made the default configurable; and fixed Keep to clear DELETE from the new keeper instead of only ever adding DELETE to losers.

Bumps VERSION to 0.3.1.

Test plan

  • pytest — full suite passes (599 passed, 1 skipped)
  • ruff check / ruff format --check pass
  • scripts/smoke-ui-exit.sh — clean Qt teardown
  • New tests for criterion selection/shortcut, default-criterion settings persistence, and DELETE-clearing on re-Keep
  • Manually exercised in a real directory with 2,200 images / 270 duplicate groups
## Summary - Replaces the single-criterion **Keep Best** button with **Keep** plus a criterion dropdown — choose File Size, Resolution, Sharpness, Filename, Directory name, or Relative Path, each available Largest/Longest or Smallest/Shortest, to decide which image in the active duplicate group to keep. The rest are marked DELETE, and DELETE is cleared from the kept image if an earlier Keep press (with a different criterion) had already marked it. - Default criterion is File Size - Largest, configurable in Settings → Duplicates → Default Keep criterion. - Ties are broken alphabetically by relative path. - New **AoK** (Advance on Keep) toggle, on by default, controls whether the workbench jumps to the next group after Keep is applied. Default keyboard shortcut for Keep is `C`. - Follow-up fixes from real-world testing: removed the colon from the button label ("Keep:" → "Keep"); switched the default away from Resolution - Largest to File Size - Largest; made the default configurable; and fixed Keep to clear DELETE from the new keeper instead of only ever adding DELETE to losers. Bumps VERSION to 0.3.1. ## Test plan - [x] `pytest` — full suite passes (599 passed, 1 skipped) - [x] `ruff check` / `ruff format --check` pass - [x] `scripts/smoke-ui-exit.sh` — clean Qt teardown - [x] New tests for criterion selection/shortcut, default-criterion settings persistence, and DELETE-clearing on re-Keep - [x] Manually exercised in a real directory with 2,200 images / 270 duplicate groups
Replace the single "Keep Best" action with a "Keep:" button plus a
criterion dropdown (file size, resolution, sharpness, filename,
directory name, and relative path, each largest/smallest) and an
"AoK" (Advance on Keep) toggle that gates whether Keep auto-advances
to the next group. The 'C' key (customizable via shortcut_registry)
triggers Keep using whatever criterion is selected.

core/dupe_detector.py gains pick_keep_path_by_criterion() /
keep_by_criterion_delete_paths(), reusing the existing sharpness_score()
edge-variance metric (DR-025) for the Sharpness criteria instead of
adding a new one. The prior resolution+sharpness-tiebreak
pick_keep_best_path()/keep_best_delete_paths() helpers are left in
place (still covered by tests) but no longer wired to the toolbar.

Threading notes: no new worker code. Sharpness scoring for the Keep
dropdown reuses the existing synchronous sharpness_score() Pillow call
on the main thread, same as the pre-existing Keep Best path it
replaces — no behavior change to threading here.
Adds unit coverage for the new pick_keep_path_by_criterion /
keep_by_criterion_delete_paths helpers (filesize, resolution, filename,
relpath, directory-name, sharpness, unknown-id fallback), plus widget
tests for the Keep dropdown + AoK toggle in DupeWorkbench and the
default "C" shortcut for dupe_keep.
Documents the Keep:/AoK toggle and criterion dropdown (issue #136) in
USER_GUIDE.md, DESIGN.md, and TECHNICAL_OUTLINE.md, and bumps VERSION
to the next canonical release per docs/VERSIONING.md
(compiled-inputs-changed.sh against origin/main confirms a bump is
required).
This branch stacks on the unmerged 0.2.4/issue-138-dupe-grid-view branch,
which already bumped VERSION to 0.3.0 in its own PR-prep commit. The
previous PR-prep commit here bumped against origin/main's 0.2.4 instead
(0.2.5), since bump-version.sh only knows about origin/main and has no
visibility into sibling stacked branches. Continue the v0.3.0 tranche
sequence instead: 0.3.0 -> 0.3.1.
Feedback from real-world testing of issue #136 (Keep dropdown + AoK):

- Button label "Keep:" -> "Keep" (the colon read oddly next to the dropdown).
- Default criterion changed from Resolution - Largest to File Size - Largest
  (DEFAULT_KEEP_CRITERION).
- The default is now configurable: Settings -> Duplicates -> "Default Keep
  criterion" (new PREF_DEFAULT_KEEP_CRITERION pref), applied via
  DupeWorkbench.set_default_keep_criterion() the same way the default visual
  similarity % is applied.
- Pressing Keep now clears DELETE from the chosen image if an earlier Keep
  press (with a different criterion) had already marked it, instead of only
  ever adding DELETE to the losers -- switched _on_dupe_keep_best() from
  plan_apply_tags_on_paths() to the existing plan_set_delete_keep_one(), which
  already had exactly this add-to-losers/clear-from-keeper semantics (reused
  by the Multi view's "mark others" gesture).

Threading notes: no worker/threading changes -- all main-thread UI/DB-planning
code, consistent with the rest of the Duplicates workbench.
VERSION stays at 0.3.1 -- correcting the not-yet-released entry in place
rather than appending a separate Fixed section.
ValleyGeek deleted branch 0.2.4/issue-136-keep-dropdown 2026-06-25 06:11:50 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ai-collab/bulk-image-organizer!141
No description provided.