Skip to content

rewrite: app.py Phase 3-C — action definitions (menu items)#1856

Merged
wkentaro merged 1 commit intomainfrom
rewrite/app-3c-actions
Mar 8, 2026
Merged

rewrite: app.py Phase 3-C — action definitions (menu items)#1856
wkentaro merged 1 commit intomainfrom
rewrite/app-3c-actions

Conversation

@wkentaro
Copy link
Owner

@wkentaro wkentaro commented Mar 7, 2026

Summary

Rewrites the action definitions section of labelme/app.py (lines ~248–412) to use consistent explicit keyword arguments throughout.

What changed

All action() calls in the menu-action setup block now use explicit keyword parameters (text=, slot=, shortcut=, icon=, tip=, etc.) instead of a mix of positional and keyword arguments.

Affected actions:

  • quit, open_, opendir, openNextImg, openPrevImg
  • save, saveAs, deleteFile, changeOutputDir
  • saveAuto, saveWithImageData, close
  • toggle_keep_prev_mode
  • createMode, createRectangleMode, createCircleMode, createLineMode, createPointMode, createLineStripMode

Behavior

No functional change. All tr() strings, shortcuts, icons, and callbacks are identical to before. The saveAuto lambda parameter was renamed from x to checked for clarity.

Tests

36 unit tests pass (python3 -m pytest tests/unit/ -k "not qapp").

@wkentaro wkentaro force-pushed the rewrite/app-3c-actions branch from c8bc352 to 3e168a2 Compare March 8, 2026 13:32
@wkentaro wkentaro self-assigned this Mar 8, 2026
@wkentaro wkentaro added this to the v6.0.0 milestone Mar 8, 2026
@wkentaro wkentaro merged commit 3bf3924 into main Mar 8, 2026
4 checks passed
@wkentaro wkentaro deleted the rewrite/app-3c-actions branch March 8, 2026 13:37
@wkentaro
Copy link
Owner Author

wkentaro commented Mar 8, 2026

Closing in favor of a more meaningful refactor. Rather than just rewriting variable assignments in place, we're restructuring __init__ (~850 lines) into focused private setup methods (_setup_widgets, _setup_actions, _setup_menus, etc.), which serves the dual-license goal while producing genuinely cleaner code. Will open a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant