Compare commits

...

30 Commits

Author SHA1 Message Date
forbes-0023
dfa1da97dd chore: configure silo-client submodule to track main branch
Enables 'git submodule update --remote' to auto-advance to latest main.
2026-02-19 14:55:11 -06:00
43e905c00a Merge pull request 'feat(silo): BOM auto-extraction from Assembly links (#276)' (#49) from feat/bom-sync-and-manifest into main
Reviewed-on: #49
2026-02-19 20:27:14 +00:00
forbes-0023
f67d9a0422 feat(silo): BOM auto-extraction from Assembly links (#276)
Phase 1 implementation:
- New bom_sync.py: extract cross-document App::Link components from
  Assembly, resolve SiloItemId UUIDs to part numbers, diff against
  server BOM, apply adds/qty updates via individual CRUD calls.
- Hook _push_bom_after_upload into Silo_Save and Silo_Commit
  (same non-blocking pattern as DAG sync).
- Hook _update_manifest_revision to write revision_hash into .kc
  manifest after successful upload (#277).
- Add bom_merged SSE signal + dispatch + Activity pane handler.
- Add merge_bom_json to SiloClient (forward-looking for Phase 2).

Merge rules: auto-add, auto-update qty, NEVER auto-delete removed
entries (warn only).

Refs: #276, #277
2026-02-19 12:37:14 -06:00
af98994a53 Merge pull request 'chore: update silo-client pointer to main merge commit' (#48) from fix/silo-client-pointer into main
Reviewed-on: #48
2026-02-19 01:58:00 +00:00
Zoe Forbes
d266bfb653 chore: update silo-client pointer to main merge commit
Points to silo-client main (285bd1f) which includes the merged
kc-metadata-api methods from PR #19.
2026-02-18 19:56:58 -06:00
a92174e0b9 Merge pull request 'chore: bump silo-client to feat/kc-metadata-api' (#47) from feat/kc-metadata-api into main
Reviewed-on: #47
2026-02-19 01:43:01 +00:00
Zoe Forbes
edbaf65923 chore: bump silo-client to feat/kc-metadata-api
Tracks new .kc metadata and dependency resolution API methods
needed by Create module server integration (silo-mod#43).
2026-02-18 19:35:41 -06:00
80f8ec27a0 Merge pull request 'chore(deps): update silo-client to c5c8288e' (#36) from auto/update-silo-client-c5c8288e into main
Reviewed-on: #36
2026-02-18 22:34:25 +00:00
kindred-bot
6b3e8b7518 chore(deps): update silo-client to c5c8288e
Upstream: c5c8288eeb
2026-02-18 21:06:32 +00:00
b3fe98c696 Merge pull request 'fix: remove MinIO references and degraded mode' (#35) from fix/remove-minio-references into main
Reviewed-on: #35
2026-02-18 20:56:18 +00:00
Zoe Forbes
c537e2f08f fix: remove MinIO references and degraded mode
The silo server now uses filesystem storage instead of MinIO.

- Remove all MinIO references from docstrings, tooltips, and UI text
- Remove obsolete 'degraded' server mode (no separate storage service)
- Update Silo_Info display: 'File in MinIO' → 'File on Server'
- Update SiloOrigin class docstring
2026-02-18 14:55:57 -06:00
29b1f32fd9 Merge pull request 'refactor: migrate to kindred-addon-sdk for overlay, origin, and theme' (#34) from feat/migrate-to-sdk into main
Reviewed-on: #34
2026-02-17 17:05:34 +00:00
dca6380199 refactor: migrate to kindred-addon-sdk for overlay, origin, and theme (#250)
Replace FreeCADGui.registerEditingOverlay() with kindred_sdk.register_overlay().
Replace FreeCADGui.addOrigin()/removeOrigin() with kindred_sdk wrappers.
Replace hardcoded _MOCHA dict with kindred_sdk.get_theme_tokens().
Add sdk dependency to package.xml <kindred> element.
2026-02-17 11:03:21 -06:00
27f0cc0f34 feat: add <kindred> element to package.xml
Declares min_create_version=0.1.0, load_priority=60, pure_python=true,
and documents universal overlay context.
2026-02-17 11:03:20 -06:00
a5eff534b5 Merge pull request 'chore(deps): update silo-client to 5e6f2cb9' (#33) from auto/update-silo-client-5e6f2cb9 into main
Reviewed-on: #33
2026-02-17 14:48:26 +00:00
kindred-bot
1001424b16 chore(deps): update silo-client to 5e6f2cb9
Upstream: 5e6f2cb963
2026-02-17 14:48:03 +00:00
7e3127498a Merge pull request 'feat(schema): make schema name configurable (closes #28)' (#32) from feat/configurable-schema-name into main
Reviewed-on: #32
2026-02-16 19:20:02 +00:00
82d8741059 feat(schema): make schema name configurable, update silo-client submodule
Replace all hardcoded 'kindred-rd' schema references with the new
configurable get_schema_name() setting. Priority: FreeCAD preference
SchemaName > SILO_SCHEMA env var > default 'kindred-rd'.

- Add get_schema_name() to FreeCADSiloSettings and _get_schema_name() helper
- Add Schema Name field to Settings dialog
- Replace raw urllib calls in schema_form.py with SiloClient methods
  (get_property_schema, generate_part_number)
- Inline parse_part_number/sanitize_filename (removed from silo-client)
- Simplify category folder naming to use category code directly
- Update silo-client submodule to origin/main + configurable schema branch

Closes #28
2026-02-16 13:17:50 -06:00
Zoe Forbes
3fe43710fa fix(ui): remove addStretch from auth panel, use compact size policy
Replace layout.addStretch() with QSizePolicy.Maximum so the
Database Auth dock panel only takes the height its content needs,
leaving more vertical space for the Database Activity panel below.

Closes #190
2026-02-15 09:43:15 -06:00
Zoe Forbes
8cbd872e5c Merge branch 'feat/worker-client-ui' into main
Resolve conflicts in silo_commands.py:
- Keep event-based activity feed (_append_activity_event, _rebuild_activity_feed)
- Adapt DAG/job SSE handlers to use _append_activity_event
- Keep _relative_time formatting for activity entries
- Include DNS diagnostic IP display from feature branch
2026-02-15 08:32:55 -06:00
Zoe Forbes
e31321ac95 feat: add Jobs and Runners commands with SSE event wiring
- Add JobMonitorDialog (Silo_Jobs): filter, view, trigger, cancel jobs
- Add RunnerAdminDialog (Silo_Runners): list, register, delete runners
- Wire job_claimed, job_progress, job_cancelled SSE signals to handlers
- Add activity panel entries for job lifecycle events
- Register Silo_Jobs in toolbar and menu, Silo_Runners in menu
- Update silo-client submodule with worker API methods
2026-02-15 05:07:33 -06:00
Zoe Forbes
dc64a66f0f feat: show DAG status and job events in Activity panel
Connects dag_updated, dag_validated, and job lifecycle signals
from SiloEventListener to the Database Activity dock widget.

- dag.updated: inserts DAG sync status (node/edge count)
- dag.validated: inserts pass/fail badge with failed count
- job.created: inserts queued job entry
- job.completed: refreshes the full activity list
- job.failed: inserts error entry

Live entries are inserted at the top of the activity list,
styled in Catppuccin Blue, capped at 50 entries.

Closes kindred/create#219
2026-02-14 15:28:40 -06:00
Zoe Forbes
3d38e4b4c3 feat: handle DAG and job SSE events in SiloEventListener
New signals:
- dag_updated(part_number, node_count, edge_count)
- dag_validated(part_number, valid, failed_count)
- job_created/claimed/progress/completed/failed/cancelled

Dispatch logic parses payloads and emits typed signals for
downstream UI and logging consumers.

Closes kindred/create#218
2026-02-14 15:22:29 -06:00
Zoe Forbes
da2a360c56 feat: add headless runner entry points
New file: runner.py with three entry points for silorunner:
- dag_extract(input_path, output_path): extract feature DAG as JSON
- validate(input_path, output_path): rebuild features, report pass/fail
- export(input_path, output_path, format): export to STEP/IGES/STL/OBJ

Invoked via: create --console -e 'from runner import dag_extract; ...'

Closes kindred/create#217
2026-02-14 15:17:30 -06:00
Zoe Forbes
3dd0da3964 feat: push DAG on save and commit
Adds _push_dag_after_upload() helper that extracts the feature DAG
and pushes it to Silo after a successful file upload.

Hooked into both Silo_Save and Silo_Commit commands. DAG sync
failures are logged as warnings and never block the save/commit.

Closes kindred/create#216
2026-02-14 15:10:50 -06:00
Zoe Forbes
4921095296 feat: update silo-client — add DAG API methods
Points silo-client to feat/dag-api-methods with push_dag/get_dag.

Closes kindred/create#215
2026-02-14 15:06:31 -06:00
0f407360ed Merge pull request 'feat: use .kc extension for new files, find both .kc and .FCStd' (#23) from feat/kc-file-format-layer1 into main
Reviewed-on: #23
2026-02-13 19:42:03 +00:00
fa4f3145c6 Merge branch 'main' into feat/kc-file-format-layer1 2026-02-13 19:41:55 +00:00
d3e27010d8 Merge pull request 'feat: live SSE-based activity feed for Database Activity panel' (#22) from feat/live-activity-panel into main
Reviewed-on: #22
2026-02-13 01:57:03 +00:00
Zoe Forbes
d7c6066030 feat: live activity panel with SSE event feed and relative timestamps
Replace static item list refresh with real-time event feed:
- Add _relative_time() helper for human-friendly timestamps
- Prepend SSE events (item updates, new revisions, mode changes) instantly
- Seed feed with 10 recent items on first SSE connect (no per-item revision calls)
- Refresh relative timestamps every 60 seconds
- Cap activity feed at 50 events
- Remove expensive list_items + get_revisions calls on every SSE event
2026-02-12 17:27:25 -06:00
13 changed files with 1364 additions and 155 deletions

1
.gitmodules vendored
View File

@@ -1,3 +1,4 @@
[submodule "silo-client"]
path = silo-client
url = https://git.kindred-systems.com/kindred/silo-client.git
branch = main

View File

@@ -45,6 +45,7 @@ class SiloWorkbench(FreeCADGui.Workbench):
"Separator",
"Silo_Info",
"Silo_BOM",
"Silo_Jobs",
]
self.appendToolbar("Silo Origin", self.silo_toolbar_commands, "Unavailable")
@@ -52,12 +53,14 @@ class SiloWorkbench(FreeCADGui.Workbench):
self.menu_commands = [
"Silo_Info",
"Silo_BOM",
"Silo_Jobs",
"Silo_TagProjects",
"Silo_SetStatus",
"Silo_Rollback",
"Separator",
"Silo_Settings",
"Silo_Auth",
"Silo_Runners",
"Silo_StartPanel",
"Silo_Diag",
]
@@ -103,7 +106,9 @@ def _register_silo_overlay():
return False
try:
FreeCADGui.registerEditingOverlay(
from kindred_sdk import register_overlay
register_overlay(
"silo", # overlay id
["Silo Origin"], # toolbar names to append
_silo_overlay_match, # match function

Binary file not shown.

Binary file not shown.

Binary file not shown.

317
freecad/bom_sync.py Normal file
View File

@@ -0,0 +1,317 @@
"""BOM extraction engine for FreeCAD Assembly documents.
Extracts cross-document ``App::Link`` components from an Assembly,
resolves Silo UUIDs to part numbers, diffs against the server BOM,
and applies adds/quantity updates via individual API calls.
No GUI dependencies -- usable in both desktop and headless mode.
Public API
----------
extract_bom_entries(doc) -> List[BomEntry]
resolve_entries(entries, client) -> (resolved, unresolved)
diff_bom(local_entries, remote_entries) -> BomDiff
apply_bom_diff(diff, parent_pn, client) -> BomResult
sync_bom_after_upload(doc, part_number, client) -> Optional[BomResult]
"""
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Tuple
import FreeCAD
# ---------------------------------------------------------------------------
# Data structures
# ---------------------------------------------------------------------------
@dataclass
class BomEntry:
"""A single BOM line extracted from an Assembly."""
silo_item_id: Optional[str] # UUID from SiloItemId property
part_number: Optional[str] # resolved via get_item_by_uuid()
label: str # FreeCAD Label of the linked object
doc_path: str # FileName of the linked document
quantity: int # summed from ElementCount + individual links
consolidation_warning: bool = False # multiple individual links to same source
@dataclass
class BomDiff:
"""Result of diffing local assembly BOM against server BOM."""
added: List[Dict[str, Any]] = field(default_factory=list)
removed: List[Dict[str, Any]] = field(default_factory=list)
quantity_changed: List[Dict[str, Any]] = field(default_factory=list)
unchanged: List[Dict[str, Any]] = field(default_factory=list)
@dataclass
class BomResult:
"""Summary of a BOM sync operation."""
added_count: int = 0
updated_count: int = 0
unreferenced_count: int = 0
unresolved_count: int = 0
errors: List[str] = field(default_factory=list)
# ---------------------------------------------------------------------------
# Assembly detection helpers
# ---------------------------------------------------------------------------
def _find_assembly(doc):
"""Return the first ``Assembly::AssemblyObject`` in *doc*, or ``None``."""
for obj in doc.Objects:
if obj.isDerivedFrom("Assembly::AssemblyObject"):
return obj
return None
def _get_silo_item_id(doc):
"""Read ``SiloItemId`` from the tracked object in *doc*.
Returns ``None`` if the document has no tracked object or no UUID.
"""
for obj in doc.Objects:
if hasattr(obj, "SiloItemId") and obj.SiloItemId:
return obj.SiloItemId
return None
def _link_count(link_obj) -> int:
"""Return the instance count for an ``App::Link``.
``ElementCount > 0`` means link array; otherwise single link (qty 1).
"""
element_count = getattr(link_obj, "ElementCount", 0)
return element_count if element_count > 0 else 1
# ---------------------------------------------------------------------------
# Extraction
# ---------------------------------------------------------------------------
def extract_bom_entries(doc) -> List[BomEntry]:
"""Walk the Assembly in *doc* and collect cross-document link entries.
Returns an empty list if the document has no Assembly or no
cross-document links. Only first-level children are extracted;
sub-assemblies commit their own BOMs separately.
"""
assembly = _find_assembly(doc)
if assembly is None:
return []
# Key by linked document path to merge duplicates.
entries: Dict[str, BomEntry] = {}
for obj in assembly.Group:
# Accept App::Link (single or array) and App::LinkElement.
if not (
obj.isDerivedFrom("App::Link") or obj.isDerivedFrom("App::LinkElement")
):
continue
linked = obj.getLinkedObject()
if linked is None:
continue
# Skip in-document links (construction / layout geometry).
if linked.Document == doc:
continue
linked_doc = linked.Document
doc_path = linked_doc.FileName or linked_doc.Name
qty = _link_count(obj)
if doc_path in entries:
entries[doc_path].quantity += qty
entries[doc_path].consolidation_warning = True
else:
entries[doc_path] = BomEntry(
silo_item_id=_get_silo_item_id(linked_doc),
part_number=None,
label=linked.Label,
doc_path=doc_path,
quantity=qty,
)
return list(entries.values())
# ---------------------------------------------------------------------------
# Resolution
# ---------------------------------------------------------------------------
def resolve_entries(
entries: List[BomEntry], client
) -> Tuple[List[BomEntry], List[BomEntry]]:
"""Resolve ``SiloItemId`` UUIDs to part numbers via the API.
Returns ``(resolved, unresolved)``. Unresolved entries have no
``SiloItemId`` or the UUID lookup failed.
"""
resolved: List[BomEntry] = []
unresolved: List[BomEntry] = []
for entry in entries:
if not entry.silo_item_id:
unresolved.append(entry)
continue
try:
item = client.get_item_by_uuid(entry.silo_item_id)
entry.part_number = item["part_number"]
resolved.append(entry)
except Exception:
unresolved.append(entry)
return resolved, unresolved
# ---------------------------------------------------------------------------
# Diff
# ---------------------------------------------------------------------------
def diff_bom(
local_entries: List[BomEntry],
remote_entries: List[Dict[str, Any]],
) -> BomDiff:
"""Diff local assembly BOM against server BOM.
*local_entries*: resolved ``BomEntry`` list.
*remote_entries*: raw dicts from ``client.get_bom()`` with keys
``child_part_number`` and ``quantity``.
"""
local_map = {e.part_number: e.quantity for e in local_entries}
remote_map = {e["child_part_number"]: e.get("quantity", 1) for e in remote_entries}
diff = BomDiff()
for pn, qty in local_map.items():
if pn not in remote_map:
diff.added.append({"part_number": pn, "quantity": qty})
elif remote_map[pn] != qty:
diff.quantity_changed.append(
{
"part_number": pn,
"local_quantity": qty,
"remote_quantity": remote_map[pn],
}
)
else:
diff.unchanged.append({"part_number": pn, "quantity": qty})
for pn, qty in remote_map.items():
if pn not in local_map:
diff.removed.append({"part_number": pn, "quantity": qty})
return diff
# ---------------------------------------------------------------------------
# Apply
# ---------------------------------------------------------------------------
def apply_bom_diff(diff: BomDiff, parent_pn: str, client) -> BomResult:
"""Apply adds and quantity updates to the server BOM.
Uses individual CRUD calls (Phase 1 fallback). Phase 2 replaces
this with a single ``POST /items/{pn}/bom/merge`` call.
Removed entries are NEVER deleted -- only warned about.
Each call is individually wrapped so one failure does not block others.
"""
result = BomResult()
for entry in diff.added:
try:
client.add_bom_entry(
parent_pn,
entry["part_number"],
quantity=entry["quantity"],
rel_type="component",
)
result.added_count += 1
except Exception as e:
result.errors.append(f"add {entry['part_number']}: {e}")
for entry in diff.quantity_changed:
try:
client.update_bom_entry(
parent_pn,
entry["part_number"],
quantity=entry["local_quantity"],
)
result.updated_count += 1
except Exception as e:
result.errors.append(f"update {entry['part_number']}: {e}")
result.unreferenced_count = len(diff.removed)
if diff.removed:
pns = ", ".join(e["part_number"] for e in diff.removed)
FreeCAD.Console.PrintWarning(
f"BOM sync: {result.unreferenced_count} server entries "
f"not in assembly (not deleted): {pns}\n"
)
return result
# ---------------------------------------------------------------------------
# Top-level orchestrator
# ---------------------------------------------------------------------------
def sync_bom_after_upload(doc, part_number: str, client) -> Optional[BomResult]:
"""Full BOM sync pipeline: extract, resolve, diff, apply.
Returns ``None`` if *doc* is not an assembly or has no cross-document
links. Returns a ``BomResult`` with summary counts otherwise.
"""
entries = extract_bom_entries(doc)
if not entries:
return None
resolved, unresolved = resolve_entries(entries, client)
# Log consolidation warnings.
for entry in entries:
if entry.consolidation_warning:
FreeCAD.Console.PrintWarning(
f"BOM sync: {entry.label} ({entry.doc_path}) has multiple "
f"individual links. Consider using a link array "
f"(ElementCount) for cleaner assembly management.\n"
)
# Log unresolved components.
for entry in unresolved:
FreeCAD.Console.PrintWarning(
f"BOM sync: {entry.label} ({entry.doc_path}) has no Silo "
f"part number -- excluded from BOM.\n"
)
if not resolved:
result = BomResult()
result.unresolved_count = len(unresolved)
return result
# Fetch current server BOM.
try:
remote = client.get_bom(part_number)
except Exception:
remote = []
diff = diff_bom(resolved, remote)
result = apply_bom_diff(diff, part_number, client)
result.unresolved_count = len(unresolved)
return result

View File

@@ -12,4 +12,17 @@
<subdirectory>./</subdirectory>
</workbench>
</content>
<!-- Kindred Create extensions -->
<kindred>
<min_create_version>0.1.0</min_create_version>
<load_priority>60</load_priority>
<pure_python>true</pure_python>
<dependencies>
<dependency>sdk</dependency>
</dependencies>
<contexts>
<context id="*" action="overlay"/>
</contexts>
</kindred>
</package>

156
freecad/runner.py Normal file
View File

@@ -0,0 +1,156 @@
"""Headless runner entry points for silorunner compute jobs.
These functions are invoked via ``create --console -e`` by the
silorunner binary. They must work without a display server.
Entry Points
------------
dag_extract(input_path, output_path)
Extract feature DAG and write JSON.
validate(input_path, output_path)
Rebuild all features and report pass/fail per node.
export(input_path, output_path, format='step')
Export geometry to STEP, IGES, STL, or OBJ.
"""
import json
import FreeCAD
def dag_extract(input_path, output_path):
"""Extract the feature DAG from a Create file.
Parameters
----------
input_path : str
Path to the ``.kc`` or ``.FCStd`` file.
output_path : str
Path to write the JSON output.
Output JSON::
{"nodes": [...], "edges": [...]}
"""
from dag import extract_dag
doc = FreeCAD.openDocument(input_path)
try:
nodes, edges = extract_dag(doc)
with open(output_path, "w") as f:
json.dump({"nodes": nodes, "edges": edges}, f)
FreeCAD.Console.PrintMessage(
f"DAG extracted: {len(nodes)} nodes, {len(edges)} edges -> {output_path}\n"
)
finally:
FreeCAD.closeDocument(doc.Name)
def validate(input_path, output_path):
"""Validate a Create file by rebuilding all features.
Parameters
----------
input_path : str
Path to the ``.kc`` or ``.FCStd`` file.
output_path : str
Path to write the JSON output.
Output JSON::
{
"valid": true/false,
"nodes": [
{"node_key": "Pad001", "state": "clean", "message": null, "properties_hash": "..."},
...
]
}
"""
from dag import classify_type, compute_properties_hash
doc = FreeCAD.openDocument(input_path)
try:
doc.recompute()
results = []
all_valid = True
for obj in doc.Objects:
if not hasattr(obj, "TypeId"):
continue
node_type = classify_type(obj.TypeId)
if node_type is None:
continue
state = "clean"
message = None
if hasattr(obj, "isValid") and not obj.isValid():
state = "failed"
message = f"Feature {obj.Label} failed to recompute"
all_valid = False
results.append(
{
"node_key": obj.Name,
"state": state,
"message": message,
"properties_hash": compute_properties_hash(obj),
}
)
with open(output_path, "w") as f:
json.dump({"valid": all_valid, "nodes": results}, f)
status = "PASS" if all_valid else "FAIL"
FreeCAD.Console.PrintMessage(
f"Validation {status}: {len(results)} nodes -> {output_path}\n"
)
finally:
FreeCAD.closeDocument(doc.Name)
def export(input_path, output_path, format="step"):
"""Export a Create file to an external geometry format.
Parameters
----------
input_path : str
Path to the ``.kc`` or ``.FCStd`` file.
output_path : str
Path to write the exported file.
format : str
One of ``step``, ``iges``, ``stl``, ``obj``.
"""
import Part
doc = FreeCAD.openDocument(input_path)
try:
shapes = [
obj.Shape for obj in doc.Objects if hasattr(obj, "Shape") and obj.Shape
]
if not shapes:
raise ValueError("No geometry found in document")
compound = Part.makeCompound(shapes)
format_lower = format.lower()
if format_lower == "step":
compound.exportStep(output_path)
elif format_lower == "iges":
compound.exportIges(output_path)
elif format_lower == "stl":
import Mesh
Mesh.export([compound], output_path)
elif format_lower == "obj":
import Mesh
Mesh.export([compound], output_path)
else:
raise ValueError(f"Unsupported format: {format}")
FreeCAD.Console.PrintMessage(
f"Exported {format_lower.upper()} -> {output_path}\n"
)
finally:
FreeCAD.closeDocument(doc.Name)

View File

@@ -10,9 +10,6 @@ backward-compatible :class:`SchemaFormDialog` modal.
"""
import json
import urllib.error
import urllib.parse
import urllib.request
import FreeCAD
from PySide import QtCore, QtGui, QtWidgets
@@ -267,17 +264,8 @@ class SchemaFormWidget(QtWidgets.QWidget):
def _fetch_properties(self, category: str) -> dict:
"""Fetch merged property definitions for a category."""
from silo_commands import _get_api_url, _get_auth_headers, _get_ssl_context
api_url = _get_api_url().rstrip("/")
url = f"{api_url}/schemas/kindred-rd/properties?category={urllib.parse.quote(category)}"
req = urllib.request.Request(url, method="GET")
req.add_header("Accept", "application/json")
for k, v in _get_auth_headers().items():
req.add_header(k, v)
try:
resp = urllib.request.urlopen(req, context=_get_ssl_context(), timeout=5)
data = json.loads(resp.read().decode("utf-8"))
data = self._client.get_property_schema(category=category)
return data.get("properties", data)
except Exception as e:
FreeCAD.Console.PrintWarning(
@@ -287,19 +275,10 @@ class SchemaFormWidget(QtWidgets.QWidget):
def _generate_pn_preview(self, category: str) -> str:
"""Call the server to preview the next part number."""
from silo_commands import _get_api_url, _get_auth_headers, _get_ssl_context
from silo_commands import _get_schema_name
api_url = _get_api_url().rstrip("/")
url = f"{api_url}/generate-part-number"
payload = json.dumps({"schema": "kindred-rd", "category": category}).encode()
req = urllib.request.Request(url, data=payload, method="POST")
req.add_header("Content-Type", "application/json")
req.add_header("Accept", "application/json")
for k, v in _get_auth_headers().items():
req.add_header(k, v)
try:
resp = urllib.request.urlopen(req, context=_get_ssl_context(), timeout=5)
data = json.loads(resp.read().decode("utf-8"))
data = self._client.generate_part_number(_get_schema_name(), category)
return data.get("part_number", "")
except Exception:
return ""
@@ -574,8 +553,10 @@ class SchemaFormWidget(QtWidgets.QWidget):
return
try:
from silo_commands import _get_schema_name
result = self._client.create_item(
"kindred-rd",
_get_schema_name(),
data["category"],
data["description"],
projects=data["projects"],

File diff suppressed because it is too large Load Diff

View File

@@ -30,7 +30,7 @@ class SiloOrigin:
Key behaviors:
- Documents are always stored locally (hybrid local-remote model)
- Database tracks metadata, part numbers, and revision history
- MinIO stores revision snapshots for sync/backup
- Server stores revision files for sync/backup
- Identity is tracked by UUID (SiloItemId), displayed as part number
"""
@@ -388,9 +388,7 @@ class SiloOrigin:
# Upload to Silo
properties = collect_document_properties(doc)
_client._upload_file(
obj.SiloPartNumber, str(file_path), properties, comment=""
)
_client._upload_file(obj.SiloPartNumber, str(file_path), properties, comment="")
# Clear modified flag (Modified is on Gui.Document, not App.Document)
gui_doc = FreeCADGui.getDocument(doc.Name)
@@ -567,12 +565,9 @@ def register_silo_origin():
This should be called during workbench initialization to make
Silo available as a file origin.
"""
origin = get_silo_origin()
try:
FreeCADGui.addOrigin(origin)
FreeCAD.Console.PrintLog("Registered Silo origin\n")
except Exception as e:
FreeCAD.Console.PrintWarning(f"Could not register Silo origin: {e}\n")
from kindred_sdk import register_origin
register_origin(get_silo_origin())
def unregister_silo_origin():
@@ -582,9 +577,7 @@ def unregister_silo_origin():
"""
global _silo_origin
if _silo_origin:
try:
FreeCADGui.removeOrigin(_silo_origin)
FreeCAD.Console.PrintLog("Unregistered Silo origin\n")
except Exception as e:
FreeCAD.Console.PrintWarning(f"Could not unregister Silo origin: {e}\n")
from kindred_sdk import unregister_origin
unregister_origin(_silo_origin)
_silo_origin = None

View File

@@ -19,23 +19,10 @@ from PySide import QtCore, QtGui, QtWidgets
# ---------------------------------------------------------------------------
# Catppuccin Mocha palette
# ---------------------------------------------------------------------------
_MOCHA = {
"base": "#1e1e2e",
"mantle": "#181825",
"crust": "#11111b",
"surface0": "#313244",
"surface1": "#45475a",
"surface2": "#585b70",
"text": "#cdd6f4",
"subtext0": "#a6adc8",
"subtext1": "#bac2de",
"blue": "#89b4fa",
"green": "#a6e3a1",
"red": "#f38ba8",
"peach": "#fab387",
"lavender": "#b4befe",
"overlay0": "#6c7086",
}
# Catppuccin Mocha palette — sourced from kindred-addon-sdk
from kindred_sdk.theme import get_theme_tokens
_MOCHA = get_theme_tokens()
_PREF_GROUP = "User parameter:BaseApp/Preferences/Mod/KindredSilo"