Skip to content

Context menu refresh#205

Merged
matt-pharr merged 6 commits intodevelopfrom
context_menu_refresh
Apr 21, 2026
Merged

Context menu refresh#205
matt-pharr merged 6 commits intodevelopfrom
context_menu_refresh

Conversation

@matt-pharr
Copy link
Copy Markdown
Owner

@matt-pharr matt-pharr commented Apr 21, 2026

Summary

Adds four new tree operations to the context menu — create node, rename, move, and duplicate — wired end-to-end through Python handlers, comm protocol, main IPC, preload bridge, and renderer dialogs. Also refreshes the context menu UX with visual separators, "open in external editor" for notes, and removes the legacy config.json migration path.

New tree operations

  • Create empty node — inserts an empty PDVTree() dict container at any path
  • Rename — re-keys a node under the same parent, relocating backing files
  • Move — re-parents a node to a new dot-path, with file relocation and circular-move protection
  • Duplicate — deep-copies a node (and its backing files) to a new path

Context menu improvements

  • Separators between action sections for visual clarity
  • "Open in external editor" action for markdown/note nodes
  • Type-specific rename labels ("Rename script", "Rename note", etc.)
  • Refresh moved to bottom of menu

Cleanup

  • Removed legacy config.jsonpreferences.json migration (no longer needed)
  • Removed unused customKernels from Config type
  • Extracted treeCommHandler helper to reduce IPC boilerplate
  • Extracted useTreeAction hook to reduce dialog callback boilerplate
  • Extracted shared FILE_BACKED_TYPES/defaultExtension to tree-file-utils.ts

Test plan

  • Python unit tests: 18 new tests covering tree operations and file relocation (test_tree_handlers.py)
  • TypeScript unit tests: updated context menu action tests (307 tests pass)
  • Full Python suite passes (308 tests, 2 skipped)
  • Manual smoke test: right-click tree nodes, exercise create/rename/move/duplicate, verify file-backed nodes relocate correctly

🤖 Generated with Claude Code

matt-pharr and others added 6 commits April 20, 2026 23:21
- Fix rename handler to relocate backing files (was silently leaving stale _relative_path)
- Extract shared FILE_BACKED_TYPES/defaultExtension to tree-file-utils.ts
- Handle namelist extension gracefully (leave filename blank when extension unknown)
- Clean up stale blank lines in ContextMenu.tsx
- Replace assert with TypeError in _relocate_single_file for -O safety
- Add hint text to move/duplicate dialogs about parent containers
- Clean up editors TODO comment in pdv.d.ts (tracked as #206)
- Add Python tests for tree handler operations and file relocation
- Extract treeCommHandler helper to reduce IPC handler boilerplate
- Extract useTreeAction hook to reduce dialog callback boilerplate

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matt-pharr matt-pharr merged commit b6684de into develop Apr 21, 2026
2 of 4 checks passed
@matt-pharr matt-pharr deleted the context_menu_refresh branch April 21, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant