diff --git a/ztools/InitGui.py b/ztools/InitGui.py index c04cdcb..2f1fd52 100644 --- a/ztools/InitGui.py +++ b/ztools/InitGui.py @@ -306,6 +306,12 @@ class ZToolsWorkbench(Gui.Workbench): + self.ztools_spreadsheet_tools, ) + # Register the PartDesign manipulator now that commands exist. + # Guard so it only registers once even if Initialize is called again. + if not getattr(ZToolsWorkbench, "_manipulator_installed", False): + ZToolsWorkbench._manipulator_installed = True + Gui.addWorkbenchManipulator(_ZToolsPartDesignManipulator()) + App.Console.PrintMessage("ztools workbench initialized\n") def Activated(self): @@ -334,6 +340,8 @@ Gui.addWorkbench(ZToolsWorkbench()) # --------------------------------------------------------------------------- # WorkbenchManipulator: inject ZTools commands into PartDesign workbench # --------------------------------------------------------------------------- +# Registered in ZToolsWorkbench.Initialize() after commands are imported, +# so the commands exist before the manipulator references them. class _ZToolsPartDesignManipulator: @@ -376,6 +384,3 @@ class _ZToolsPartDesignManipulator: "after": "", }, ] - - -Gui.addWorkbenchManipulator(_ZToolsPartDesignManipulator())