From 815c2f8fcf00f2048f6bef2e6d21b0102aa1db20 Mon Sep 17 00:00:00 2001 From: Jon Escombe Date: Fri, 2 Sep 2022 09:11:23 +0100 Subject: [PATCH] Fix for Path output file naming issues. Use the fullPath name when opening dialog, handle cancel cleanly. These changes fixes the output file file naming for me. Without it, I just get the unprocessed substitution strings in the current working directory. --- src/Mod/Path/PathScripts/PathPost.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py index 0799573a14..e89ccc6224 100644 --- a/src/Mod/Path/PathScripts/PathPost.py +++ b/src/Mod/Path/PathScripts/PathPost.py @@ -238,19 +238,21 @@ def resolveFileName(job, subpartname, sequencenumber): if openDialog: foo = QtGui.QFileDialog.getSaveFileName( - QtGui.QApplication.activeWindow(), "Output File", filename + QtGui.QApplication.activeWindow(), "Output File", fullPath ) if foo[0]: fullPath = foo[0] else: fullPath = None - # remove any unused substitution strings: - for s in validPathSubstitutions + validFilenameSubstitutions: - fullPath = fullPath.replace(f"%{s}", "") + if fullPath: + # remove any unused substitution strings: + for s in validPathSubstitutions + validFilenameSubstitutions: + fullPath = fullPath.replace(f"%{s}", "") + + fullPath = os.path.normpath(fullPath) + PathLog.track(fullPath) - fullPath = os.path.normpath(fullPath) - PathLog.track(fullPath) return fullPath @@ -591,7 +593,7 @@ class CommandPathPost: filenames.append(name) PathLog.track(result, gcode, name) - if result is None: + if name is None: success = False else: finalgcode += gcode