Add a diagnostics command that sequentially tests: - DNS resolution of the server hostname - Health endpoint (/health) - Readiness endpoint (/ready) - Auth endpoint (/auth/me) with token - SSE event stream (/events) Results are printed to the FreeCAD console with PASS/FAIL status. Closes #3
70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
"""Kindred Silo Workbench - Item database integration for Kindred Create."""
|
|
|
|
import os
|
|
|
|
import FreeCAD
|
|
import FreeCADGui
|
|
|
|
FreeCAD.Console.PrintMessage("Kindred Silo InitGui.py loading...\n")
|
|
|
|
|
|
class SiloWorkbench(FreeCADGui.Workbench):
|
|
"""Kindred Silo workbench for item database integration."""
|
|
|
|
MenuText = "Kindred Silo"
|
|
ToolTip = "Item database and part management for Kindred Create"
|
|
Icon = ""
|
|
|
|
def __init__(self):
|
|
# Resolve icon relative to this file so it works regardless of install location
|
|
icon_path = os.path.join(
|
|
os.path.dirname(os.path.abspath(__file__)), "resources", "icons", "silo.svg"
|
|
)
|
|
if os.path.exists(icon_path):
|
|
self.__class__.Icon = icon_path
|
|
|
|
def Initialize(self):
|
|
"""Called when workbench is first activated."""
|
|
import silo_commands
|
|
|
|
# Register Silo as a file origin in the unified origin system
|
|
try:
|
|
import silo_origin
|
|
|
|
silo_origin.register_silo_origin()
|
|
except Exception as e:
|
|
FreeCAD.Console.PrintWarning(f"Could not register Silo origin: {e}\n")
|
|
|
|
# Silo menu provides admin/management commands.
|
|
# File operations (New/Open/Save) are handled by the standard File
|
|
# toolbar via the origin system -- no separate Silo toolbar needed.
|
|
self.menu_commands = [
|
|
"Silo_Info",
|
|
"Silo_BOM",
|
|
"Silo_TagProjects",
|
|
"Silo_SetStatus",
|
|
"Silo_Rollback",
|
|
"Separator",
|
|
"Silo_Settings",
|
|
"Silo_Auth",
|
|
"Silo_StartPanel",
|
|
"Silo_Diag",
|
|
]
|
|
|
|
self.appendMenu("Silo", self.menu_commands)
|
|
|
|
def Activated(self):
|
|
"""Called when workbench is activated."""
|
|
FreeCAD.Console.PrintMessage("Kindred Silo workbench activated\n")
|
|
FreeCADGui.runCommand("Silo_StartPanel", 0)
|
|
|
|
def Deactivated(self):
|
|
pass
|
|
|
|
def GetClassName(self):
|
|
return "Gui::PythonWorkbench"
|
|
|
|
|
|
FreeCADGui.addWorkbench(SiloWorkbench())
|
|
FreeCAD.Console.PrintMessage("Silo workbench registered\n")
|