feat(kc): Metadata Editor — schema-driven form with dirty tracking and save-back #39
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implement the Metadata Editor viewer — a schema-driven editable form that surfaces
silo/metadata.jsonfields (custom schema fields, lifecycle state, tags) in an MDI viewport tab. This is the most complex viewer widget and introduces the dirty tracking and save-back pipeline used by all editable viewers.Background
silo/metadata.jsoncontains user-customizable fields defined by a Silo schema (e.g.,mechanical-part-v2). The editor renders fields dynamically based on the schema descriptor fromGET /api/schemas/{name}/form. When offline, it falls back to a flat key-value display.The existing
mods/silo/freecad/schema_form.pyalready implements dynamic form building with collapsible groups — this should be reused or adapted.Widget specification
Layout
QScrollAreacontainingQGroupBoxsectionsQComboBoxin header barField type mapping
stringQLineEditenumQComboBoxnumberQDoubleSpinBoxbooleanQCheckBoxtext(multiline)QPlainTextEditForm dimensions
Dirty tracking and save-back
This phase introduces the modification tracking system:
SiloViewerObjectgets a_dirtyattribute set by the viewer widget on any edit.obj.RawContentand clears the dirty flag.obj.RawContentstate.pre_reinjectcallback (added in Phase 1), dirty objects have theirRawContentserialized back into thesilo/cache dict before ZIP write.Offline behavior
QLineEditdisplay for all fieldsKC_SPECIFICATION.mdQComboBoxis disabled when offlineFiles to modify
src/Mod/Create/silo_viewers.pySiloMetadataEditorwidget classsrc/Mod/Create/silo_objects.py_dirtyflag,mark_dirty(),is_dirty()methodssrc/Mod/Create/kc_format.pypre_reinjectcallback writes dirty metadata back to ZIP cacheAcceptance criteria
QLineEditdisplay when offlineQComboBoxis disabled when offlineobj.RawContentand clears dirty flagsilo/metadata.jsonin the ZIPDependencies
create_viewer_widget()factory and MDI pipelineReferences
docs/KC_SPECIFICATION.md§4.2 (silo/metadata.jsonschema)docs/SILO_VIEWPORT_PLAN.mdPhase 3mods/silo/freecad/schema_form.py— existing dynamic form builder