From 2dee048f0ec07aea94ab6be84e368cedbe641cfe Mon Sep 17 00:00:00 2001 From: sliptonic Date: Tue, 16 Sep 2025 11:12:25 -0500 Subject: [PATCH] template directory to camassets --- src/Mod/CAM/Path/Main/Gui/JobCmd.py | 2 +- src/Mod/CAM/Path/Preferences.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Mod/CAM/Path/Main/Gui/JobCmd.py b/src/Mod/CAM/Path/Main/Gui/JobCmd.py index 0867a9e9c4..30dcfbc00d 100644 --- a/src/Mod/CAM/Path/Main/Gui/JobCmd.py +++ b/src/Mod/CAM/Path/Main/Gui/JobCmd.py @@ -134,7 +134,7 @@ class CommandJobTemplateExport: foo = QtGui.QFileDialog.getSaveFileName( QtGui.QApplication.activeWindow(), "Path - Job Template", - Path.Preferences.filePath(), + str(Path.Preferences.getTemplateDirectory()), "job_*.json", )[0] if foo: diff --git a/src/Mod/CAM/Path/Preferences.py b/src/Mod/CAM/Path/Preferences.py index 965b896c3c..6cb04c7cd9 100644 --- a/src/Mod/CAM/Path/Preferences.py +++ b/src/Mod/CAM/Path/Preferences.py @@ -158,6 +158,13 @@ def getToolBitPath() -> pathlib.Path: return getAssetPath() / "Tools" / "Bit" +def getTemplateDirectory() -> pathlib.Path: + """Returns the directory where job templates should be saved.""" + template_path = getAssetPath() / "Templates" + template_path.mkdir(parents=True, exist_ok=True) + return template_path + + def getLastToolLibrary() -> Optional[str]: pref = tool_preferences() return pref.GetString(LastToolLibrary) or None @@ -239,6 +246,9 @@ def macroFilePath(): def searchPaths(): paths = [] + # Add new CamAssets/Templates directory first (highest priority) + paths.append(str(getTemplateDirectory())) + # Add legacy locations for backward compatibility p = defaultFilePath() if p: paths.append(p)