fix(gui): resolve unknown command and style token errors at startup

Move ZTools command imports before workbench initialization in
InitGui.py so commands are registered before PartDesign/Sketcher
init triggers toolbar state restoration.

Import silo_commands eagerly in _setup_silo_menu() so Silo commands
exist before the WorkbenchManipulator references them.

Create KindredCreate.yaml and Classic.yaml theme parameter files
defining all style tokens (PrimaryColor, TextForegroundColor, etc.)
used by FreeCAD.qss and the overlay stylesheet. Register them in
CMakeLists.txt and set the Theme preference in KindredCreate.cfg.

Add migration in migrateOldTheme() to set Theme=KindredCreate for
existing users who have the stylesheet but not the Theme parameter.
This commit is contained in:
forbes
2026-01-31 11:47:28 -06:00
parent eb80c07f57
commit 8639b6fd8a
7 changed files with 274 additions and 78 deletions

View File

@@ -4,103 +4,113 @@
<FCParamGroup Name="BaseApp">
<FCParamGroup Name="Preferences">
<FCParamGroup Name="Editor">
<FCUInt Name="Text" Value="3453416703"/>
<FCUInt Name="Bookmark" Value="3032415999"/>
<FCUInt Name="Breakpoint" Value="4086016255"/>
<FCUInt Name="Keyword" Value="3416717311"/>
<FCUInt Name="Comment" Value="2139095295"/>
<FCUInt Name="Block comment" Value="2139095295"/>
<FCUInt Name="Number" Value="4206069759"/>
<FCUInt Name="String" Value="2799935999"/>
<FCUInt Name="Character" Value="4073902335"/>
<FCUInt Name="Class name" Value="2310339327"/>
<FCUInt Name="Define name" Value="2310339327"/>
<FCUInt Name="Operator" Value="2312199935"/>
<FCUInt Name="Python output" Value="2796290303"/>
<FCUInt Name="Python error" Value="4086016255"/>
<FCUInt Name="Current line highlight" Value="1162304255"/>
<FCUInt Name="Text" Value="3453416703" />
<FCUInt Name="Bookmark" Value="3032415999" />
<FCUInt Name="Breakpoint" Value="4086016255" />
<FCUInt Name="Keyword" Value="3416717311" />
<FCUInt Name="Comment" Value="2139095295" />
<FCUInt Name="Block comment" Value="2139095295" />
<FCUInt Name="Number" Value="4206069759" />
<FCUInt Name="String" Value="2799935999" />
<FCUInt Name="Character" Value="4073902335" />
<FCUInt Name="Class name" Value="2310339327" />
<FCUInt Name="Define name" Value="2310339327" />
<FCUInt Name="Operator" Value="2312199935" />
<FCUInt Name="Python output" Value="2796290303" />
<FCUInt Name="Python error" Value="4086016255" />
<FCUInt Name="Current line highlight" Value="1162304255" />
</FCParamGroup>
<FCParamGroup Name="OutputWindow">
<FCUInt Name="colorText" Value="3453416703"/>
<FCUInt Name="colorLogging" Value="2497893887"/>
<FCUInt Name="colorWarning" Value="4192382975"/>
<FCUInt Name="colorError" Value="4086016255"/>
<FCUInt Name="colorText" Value="3453416703" />
<FCUInt Name="colorLogging" Value="2497893887" />
<FCUInt Name="colorWarning" Value="4192382975" />
<FCUInt Name="colorError" Value="4086016255" />
</FCParamGroup>
<FCParamGroup Name="View">
<FCUInt Name="BackgroundColor" Value="505294591"/>
<FCUInt Name="BackgroundColor2" Value="286333951"/>
<FCUInt Name="BackgroundColor3" Value="404235775"/>
<FCUInt Name="BackgroundColor4" Value="825378047"/>
<FCBool Name="Simple" Value="0"/>
<FCBool Name="Gradient" Value="1"/>
<FCBool Name="UseBackgroundColorMid" Value="0"/>
<FCUInt Name="HighlightColor" Value="3416717311"/>
<FCUInt Name="SelectionColor" Value="3032415999"/>
<FCUInt Name="PreselectColor" Value="2497893887"/>
<FCUInt Name="DefaultShapeColor" Value="1482387711"/>
<FCBool Name="RandomColor" Value="0"/>
<FCUInt Name="DefaultShapeLineColor" Value="2470768383"/>
<FCUInt Name="DefaultShapeVertexColor" Value="2470768383"/>
<FCUInt Name="BoundingBoxColor" Value="1819509759"/>
<FCUInt Name="AnnotationTextColor" Value="3453416703"/>
<FCUInt Name="SketchEdgeColor" Value="3453416703"/>
<FCUInt Name="SketchVertexColor" Value="3453416703"/>
<FCUInt Name="EditedEdgeColor" Value="3416717311"/>
<FCUInt Name="EditedVertexColor" Value="4123402495"/>
<FCUInt Name="ConstructionColor" Value="4206069759"/>
<FCUInt Name="ExternalColor" Value="4192382975"/>
<FCUInt Name="FullyConstrainedColor" Value="2799935999"/>
<FCUInt Name="InternalAlignedGeoColor" Value="1959907071"/>
<FCUInt Name="FullyConstraintElementColor" Value="2799935999"/>
<FCUInt Name="FullyConstraintConstructionElementColor" Value="2497893887"/>
<FCUInt Name="FullyConstraintInternalAlignmentColor" Value="2312199935"/>
<FCUInt Name="FullyConstraintConstructionPointColor" Value="2799935999"/>
<FCUInt Name="ConstrainedIcoColor" Value="2310339327"/>
<FCUInt Name="NonDrivingConstrDimColor" Value="2139095295"/>
<FCUInt Name="ConstrainedDimColor" Value="3416717311"/>
<FCUInt Name="ExprBasedConstrDimColor" Value="4206069759"/>
<FCUInt Name="DeactivatedConstrDimColor" Value="1819509759"/>
<FCUInt Name="CursorTextColor" Value="3453416703"/>
<FCUInt Name="CursorCrosshairColor" Value="3416717311"/>
<FCUInt Name="CreateLineColor" Value="2799935999"/>
<FCUInt Name="ShadowLightColor" Value="2470768128"/>
<FCUInt Name="ShadowGroundColor" Value="286333952"/>
<FCUInt Name="HiddenLineColor" Value="825378047"/>
<FCUInt Name="HiddenLineFaceColor" Value="505294591"/>
<FCUInt Name="HiddenLineBackground" Value="505294591"/>
<FCBool Name="EnableBacklight" Value="1"/>
<FCUInt Name="BacklightColor" Value="1162304255"/>
<FCFloat Name="BacklightIntensity" Value="0.30"/>
<FCUInt Name="BackgroundColor" Value="505294591" />
<FCUInt Name="BackgroundColor2" Value="286333951" />
<FCUInt Name="BackgroundColor3" Value="404235775" />
<FCUInt Name="BackgroundColor4" Value="825378047" />
<FCBool Name="Simple" Value="0" />
<FCBool Name="Gradient" Value="1" />
<FCBool Name="UseBackgroundColorMid" Value="0" />
<FCUInt Name="HighlightColor" Value="3416717311" />
<FCUInt Name="SelectionColor" Value="3032415999" />
<FCUInt Name="PreselectColor" Value="2497893887" />
<FCUInt Name="DefaultShapeColor" Value="1482387711" />
<FCBool Name="RandomColor" Value="0" />
<FCUInt Name="DefaultShapeLineColor" Value="2470768383" />
<FCUInt Name="DefaultShapeVertexColor" Value="2470768383" />
<FCUInt Name="BoundingBoxColor" Value="1819509759" />
<FCUInt Name="AnnotationTextColor" Value="3453416703" />
<FCUInt Name="SketchEdgeColor" Value="3453416703" />
<FCUInt Name="SketchVertexColor" Value="3453416703" />
<FCUInt Name="EditedEdgeColor" Value="3416717311" />
<FCUInt Name="EditedVertexColor" Value="4123402495" />
<FCUInt Name="ConstructionColor" Value="4206069759" />
<FCUInt Name="ExternalColor" Value="4192382975" />
<FCUInt Name="FullyConstrainedColor" Value="2799935999" />
<FCUInt Name="InternalAlignedGeoColor" Value="1959907071" />
<FCUInt Name="FullyConstraintElementColor" Value="2799935999" />
<FCUInt
Name="FullyConstraintConstructionElementColor"
Value="2497893887"
/>
<FCUInt
Name="FullyConstraintInternalAlignmentColor"
Value="2312199935"
/>
<FCUInt
Name="FullyConstraintConstructionPointColor"
Value="2799935999"
/>
<FCUInt Name="ConstrainedIcoColor" Value="2310339327" />
<FCUInt Name="NonDrivingConstrDimColor" Value="2139095295" />
<FCUInt Name="ConstrainedDimColor" Value="3416717311" />
<FCUInt Name="ExprBasedConstrDimColor" Value="4206069759" />
<FCUInt Name="DeactivatedConstrDimColor" Value="1819509759" />
<FCUInt Name="CursorTextColor" Value="3453416703" />
<FCUInt Name="CursorCrosshairColor" Value="3416717311" />
<FCUInt Name="CreateLineColor" Value="2799935999" />
<FCUInt Name="ShadowLightColor" Value="2470768128" />
<FCUInt Name="ShadowGroundColor" Value="286333952" />
<FCUInt Name="HiddenLineColor" Value="825378047" />
<FCUInt Name="HiddenLineFaceColor" Value="505294591" />
<FCUInt Name="HiddenLineBackground" Value="505294591" />
<FCBool Name="EnableBacklight" Value="1" />
<FCUInt Name="BacklightColor" Value="1162304255" />
<FCFloat Name="BacklightIntensity" Value="0.30" />
</FCParamGroup>
<FCParamGroup Name="TreeView">
<FCUInt Name="TreeEditColor" Value="3416717311"/>
<FCUInt Name="TreeActiveColor" Value="2799935999"/>
<FCUInt Name="TreeEditColor" Value="3416717311" />
<FCUInt Name="TreeActiveColor" Value="2799935999" />
</FCParamGroup>
<FCParamGroup Name="MainWindow">
<FCText Name="StyleSheet">KindredCreate.qss</FCText>
<FCText Name="Theme">KindredCreate</FCText>
</FCParamGroup>
<FCParamGroup Name="Mod">
<FCParamGroup Name="Start">
<FCUInt Name="BackgroundColor1" Value="404235775"/>
<FCUInt Name="BackgroundTextColor" Value="3453416703"/>
<FCUInt Name="PageColor" Value="505294591"/>
<FCUInt Name="PageTextColor" Value="3453416703"/>
<FCUInt Name="BoxColor" Value="825378047"/>
<FCUInt Name="LinkColor" Value="2310339327"/>
<FCUInt Name="BackgroundColor2" Value="286333951"/>
<FCUInt Name="BackgroundColor1" Value="404235775" />
<FCUInt Name="BackgroundTextColor" Value="3453416703" />
<FCUInt Name="PageColor" Value="505294591" />
<FCUInt Name="PageTextColor" Value="3453416703" />
<FCUInt Name="BoxColor" Value="825378047" />
<FCUInt Name="LinkColor" Value="2310339327" />
<FCUInt Name="BackgroundColor2" Value="286333951" />
</FCParamGroup>
<FCParamGroup Name="Part">
<FCUInt Name="VertexColor" Value="3032415999"/>
<FCUInt Name="EdgeColor" Value="2310339327"/>
<FCUInt Name="VertexColor" Value="3032415999" />
<FCUInt Name="EdgeColor" Value="2310339327" />
</FCParamGroup>
<FCParamGroup Name="PartDesign">
<FCUInt Name="DefaultDatumColor" Value="3416717311"/>
<FCUInt Name="DefaultDatumColor" Value="3416717311" />
</FCParamGroup>
<FCParamGroup Name="Draft">
<FCUInt Name="snapcolor" Value="2799935999"/>
<FCUInt Name="snapcolor" Value="2799935999" />
</FCParamGroup>
<FCParamGroup Name="Sketcher">
<FCUInt Name="GridLineColor" Value="1162304255"/>
<FCUInt Name="GridLineColor" Value="1162304255" />
</FCParamGroup>
</FCParamGroup>
</FCParamGroup>

View File

@@ -341,6 +341,17 @@ void StartupPostProcess::migrateOldTheme(const std::string& style)
if (style == "FreeCAD Light.qss" || style == "FreeCAD Dark.qss") {
prefPackManager->apply("KindredCreate");
}
// Ensure the Theme parameter is set for KindredCreate so the style
// parameter YAML file (parameters/KindredCreate.yaml) is found.
if (style == "KindredCreate.qss") {
auto hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/MainWindow"
);
if (hGrp->GetASCII("Theme", "Classic") == "Classic") {
hGrp->SetASCII("Theme", "KindredCreate");
}
}
}
void StartupPostProcess::checkOpenGL()

View File

@@ -6,6 +6,8 @@ SET(Stylesheets_Files
)
SET(Parameters_Files
"parameters/Classic.yaml"
"parameters/KindredCreate.yaml"
)
SET(Overlay_Stylesheets_Files

View File

@@ -0,0 +1,85 @@
# KindredCreate theme parameters - Catppuccin Mocha palette
# Used by FreeCAD.qss and overlay stylesheets for token substitution
# Primary surfaces
PrimaryColor: "#1e1e2e"
PrimaryColorDarken2: "#181825"
DialogBackgroundColor: "#1e1e2e"
GeneralBackgroundColor: "#1e1e2e"
GeneralAlternateBackgroundColor: "#181825"
# Text
TextForegroundColor: "#cdd6f4"
TextDisabledColor: "#6c7086"
TextUrlColor: "#89b4fa"
TextSelectBackgroundColor: "#585b70"
# Input fields
TextEditFieldBackgroundColor: "#313244"
InputFieldBorderRadius: "2px"
# Borders
GeneralBorderColor: "#45475a"
GeneralBorderHoverColor: "#585b70"
# Buttons
ButtonTopBackgroundColor: "#313244"
ButtonBottomBackgroundColor: "#313244"
ButtonBorderColor: "#45475a"
DefaultButtonTopBackgroundColor: "#cba6f7"
DefaultButtonBottomBackgroundColor: "#cba6f7"
DefaultButtonBorderColor: "#cba6f7"
CheckedButtonTopBackgroundColor: "#45475a"
CheckedButtonBottomBackgroundColor: "#45475a"
# Accent
AccentColor: "#cba6f7"
AccentBackgroundColor: "#45475a"
AccentHoverColor: "#b4befe"
# Interactive states
GeneralBackgroundHoverColor: "#313244"
GeneralDisabledBackgroundColor: "#181825"
GeneralHeaderBackgroundColor: "#313244"
# Grid
GeneralGridLinesColor: "#313244"
3DViewBackgroundRefColor: "#181825"
# Groupbox
GroupboxBackgroundColor: "#1e1e2e"
GroupboxBorderColor: "#45475a"
# Menu
MenuBackgroundColor: "#181825"
# Scrollbar
ScrollbarBackgroundColor: "#181825"
# Tabs
TabbarBackgroundColor: "#181825"
ActiveTabBackgroundColor: "#1e1e2e"
InActiveTabBackgroundColor: "#313244"
# Checkbox and radio
CheckBoxBackgroundColor: "#313244"
CheckBoxBorderColor: "#585b70"
RadioButtonBackgroundColor: "#313244"
RadioButtonBorderColor: "#585b70"
# Toolbar
ToolbarButtonsPadding: "4px"
# Icons
IconsLocationFolderName: "images_classic"
StylesheetIconsColor: "white"
# Sketcher constraint colors
SketcherFullyConstrainedColor: "#a6e3a1"
SketcherUnderConstrainedColor: "#f9e2af"
SketcherConflictingConstraintsColor: "#f38ba8"
SketcherRedundantConstraintsColor: "#fab387"
SketcherMalformedConstraintsColor: "#f38ba8"
SketcherPartiallyRedundantConstraintsColor: "#fab387"
SketcherSolverFailedColor: "#f38ba8"
SketcherEmptySketchColor: "#6c7086"

View File

@@ -0,0 +1,85 @@
# KindredCreate theme parameters - Catppuccin Mocha palette
# Used by FreeCAD.qss and overlay stylesheets for token substitution
# Primary surfaces
PrimaryColor: "#1e1e2e"
PrimaryColorDarken2: "#181825"
DialogBackgroundColor: "#1e1e2e"
GeneralBackgroundColor: "#1e1e2e"
GeneralAlternateBackgroundColor: "#181825"
# Text
TextForegroundColor: "#cdd6f4"
TextDisabledColor: "#6c7086"
TextUrlColor: "#89b4fa"
TextSelectBackgroundColor: "#585b70"
# Input fields
TextEditFieldBackgroundColor: "#313244"
InputFieldBorderRadius: "2px"
# Borders
GeneralBorderColor: "#45475a"
GeneralBorderHoverColor: "#585b70"
# Buttons
ButtonTopBackgroundColor: "#313244"
ButtonBottomBackgroundColor: "#313244"
ButtonBorderColor: "#45475a"
DefaultButtonTopBackgroundColor: "#cba6f7"
DefaultButtonBottomBackgroundColor: "#cba6f7"
DefaultButtonBorderColor: "#cba6f7"
CheckedButtonTopBackgroundColor: "#45475a"
CheckedButtonBottomBackgroundColor: "#45475a"
# Accent
AccentColor: "#cba6f7"
AccentBackgroundColor: "#45475a"
AccentHoverColor: "#b4befe"
# Interactive states
GeneralBackgroundHoverColor: "#313244"
GeneralDisabledBackgroundColor: "#181825"
GeneralHeaderBackgroundColor: "#313244"
# Grid
GeneralGridLinesColor: "#313244"
3DViewBackgroundRefColor: "#181825"
# Groupbox
GroupboxBackgroundColor: "#1e1e2e"
GroupboxBorderColor: "#45475a"
# Menu
MenuBackgroundColor: "#181825"
# Scrollbar
ScrollbarBackgroundColor: "#181825"
# Tabs
TabbarBackgroundColor: "#181825"
ActiveTabBackgroundColor: "#1e1e2e"
InActiveTabBackgroundColor: "#313244"
# Checkbox and radio
CheckBoxBackgroundColor: "#313244"
CheckBoxBorderColor: "#585b70"
RadioButtonBackgroundColor: "#313244"
RadioButtonBorderColor: "#585b70"
# Toolbar
ToolbarButtonsPadding: "4px"
# Icons
IconsLocationFolderName: "images_classic"
StylesheetIconsColor: "white"
# Sketcher constraint colors
SketcherFullyConstrainedColor: "#a6e3a1"
SketcherUnderConstrainedColor: "#f9e2af"
SketcherConflictingConstraintsColor: "#f38ba8"
SketcherRedundantConstraintsColor: "#fab387"
SketcherMalformedConstraintsColor: "#f38ba8"
SketcherPartiallyRedundantConstraintsColor: "#fab387"
SketcherSolverFailedColor: "#f38ba8"
SketcherEmptySketchColor: "#6c7086"

View File

@@ -68,6 +68,9 @@ def _check_silo_first_start():
def _setup_silo_menu():
"""Inject Silo commands into the File menu and toolbar across all workbenches."""
try:
# Import silo_commands eagerly so commands are registered before the
# manipulator tries to add them to toolbars/menus.
import silo_commands # noqa: F401
class SiloMenuManipulator:
def modifyMenuBar(self):