Compare commits
10 Commits
feat/runne
...
feat/confi
| Author | SHA1 | Date | |
|---|---|---|---|
| 82d8741059 | |||
|
|
3fe43710fa | ||
|
|
8cbd872e5c | ||
|
|
e31321ac95 | ||
|
|
dc64a66f0f | ||
|
|
3d38e4b4c3 | ||
| 0f407360ed | |||
| fa4f3145c6 | |||
| d3e27010d8 | |||
|
|
d7c6066030 |
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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
Submodule silo-client updated: fb658c5a24...8c4fb4c433
Reference in New Issue
Block a user