feat(create): metadata editor — editable form with dirty tracking and save-back #270

Merged
forbes merged 2 commits from feat/metadata-editor into main 2026-02-19 00:42:56 +00:00
Owner

Summary

Add an editable Metadata viewer that opens in an MDI subwindow when the user double-clicks the "Metadata" node in the Silo tree. Introduces the dirty tracking and save-back pipeline used by all editable viewers.

Changes

Modified files:

  • silo_viewers.pySiloMetadataEditor widget with:
    • Lifecycle QComboBox (draft/review/released/obsolete)
    • Tag chip widgets with add (+) and remove (×) buttons
    • Schema-defined fields with type-inferred widgets (QCheckBox for bools, QDoubleSpinBox for numbers, QLineEdit for strings)
    • Save/Reset buttons with dirty-state gating
    • Unsaved-changes close guard (QMessageBox prompt)
    • QScrollArea wrapper for long field lists
  • silo_objects.pymark_dirty(), is_dirty(), clear_dirty() methods on SiloViewerObject proxy
  • kc_format.py — Fix entries is None{} before hooks run; add _metadata_save_hook that writes dirty RawContent back to the silo/ cache on document save

Save-back round-trip:

  1. User edits metadata fields → mark_dirty()
  2. User clicks Save → json.dumps to obj.RawContent
  3. User saves document → _metadata_save_hook encodes RawContent into silo/ cache
  4. slotFinishSaveDocument writes cache to ZIP (duplicate entry, last wins)
  5. Reopen → metadata reflects edits

Closes kindred/silo-mod#39
Depends on #268, #269

Checklist

  • Commit messages follow conventional commits (feat:, fix:, chore:, docs:, art:)
  • Code follows project style (clang-format for C++, black for Python)
  • Changes are tested locally
  • Documentation updated (if applicable)
## Summary Add an editable Metadata viewer that opens in an MDI subwindow when the user double-clicks the "Metadata" node in the Silo tree. Introduces the dirty tracking and save-back pipeline used by all editable viewers. ## Changes **Modified files:** - `silo_viewers.py` — `SiloMetadataEditor` widget with: - Lifecycle `QComboBox` (draft/review/released/obsolete) - Tag chip widgets with add (`+`) and remove (`×`) buttons - Schema-defined fields with type-inferred widgets (`QCheckBox` for bools, `QDoubleSpinBox` for numbers, `QLineEdit` for strings) - Save/Reset buttons with dirty-state gating - Unsaved-changes close guard (`QMessageBox` prompt) - `QScrollArea` wrapper for long field lists - `silo_objects.py` — `mark_dirty()`, `is_dirty()`, `clear_dirty()` methods on `SiloViewerObject` proxy - `kc_format.py` — Fix `entries is None` → `{}` before hooks run; add `_metadata_save_hook` that writes dirty `RawContent` back to the silo/ cache on document save **Save-back round-trip:** 1. User edits metadata fields → `mark_dirty()` 2. User clicks Save → `json.dumps` to `obj.RawContent` 3. User saves document → `_metadata_save_hook` encodes `RawContent` into silo/ cache 4. `slotFinishSaveDocument` writes cache to ZIP (duplicate entry, last wins) 5. Reopen → metadata reflects edits ## Related Issues Closes kindred/silo-mod#39 Depends on #268, #269 ## Checklist - [x] Commit messages follow [conventional commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, `chore:`, `docs:`, `art:`) - [x] Code follows project style (clang-format for C++, black for Python) - [x] Changes are tested locally - [x] Documentation updated (if applicable)
forbes added 1 commit 2026-02-18 23:11:32 +00:00
feat(create): metadata editor — editable form with dirty tracking and save-back (#39)
All checks were successful
Build and Test / build (pull_request) Successful in 30m48s
e947822c7a
Add SiloMetadataEditor widget that opens in an MDI subwindow when the
user double-clicks the Metadata node in the Silo tree. Supports editing
lifecycle state, tags (add/remove chips), and schema-defined fields with
type-inferred widgets (QCheckBox, QDoubleSpinBox, QLineEdit).

Changes:
- silo_viewers.py: SiloMetadataEditor with dirty tracking, Save/Reset
  buttons, unsaved-changes close guard, and tag chip management
- silo_objects.py: mark_dirty()/is_dirty()/clear_dirty() on proxy
- kc_format.py: fix entries=None before hooks; _metadata_save_hook
  writes dirty RawContent back to silo/ cache on document save

Closes #39
forbes added 1 commit 2026-02-19 00:42:49 +00:00
Merge branch 'main' into feat/metadata-editor
All checks were successful
Build and Test / build (pull_request) Successful in 29m56s
6fe5cc1d4d
forbes merged commit 8b6205a340 into main 2026-02-19 00:42:56 +00:00
forbes deleted branch feat/metadata-editor 2026-02-19 00:42:57 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#270