set default directory for sanity (#15934)

Respond correctly if user cancels  Fixes #14796

Co-authored-by: Brad Collette <[email protected]>
This commit is contained in:
sliptonic
2024-09-10 10:24:59 -05:00
committed by Chris Hennes
co-authored by Brad Collette
parent 20065e644b
commit 6eefc8e649
+9 -1
View File
@@ -65,13 +65,21 @@ class CommandCAMSanity:
# Ask the user for a filename to save the report to
defaultDir = os.path.split(FreeCAD.ActiveDocument.getFileName())[0]
if defaultDir == "":
defaultDir = os.path.expanduser("~")
file_location = QFileDialog.getSaveFileName(
None,
translate("Path", "Save Sanity Check Report"),
os.path.expanduser("~"),
defaultDir,
"HTML files (*.html)",
)[0]
if file_location == "":
return
sanity_checker = Sanity.CAMSanity(obj, file_location)
html = sanity_checker.get_output_report()