From 484e053ca1826c0d15793a5ba0b3b8ac415085f6 Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Fri, 7 Dec 2012 10:33:41 +0100 Subject: [PATCH] When generating batch job, use Save Study instead of SaveAs when possible to avoid changing the study name. --- src/salome/parametric/genjob.py | 10 +++++++--- src/salome/parametric/gui/genjob.ui | 8 ++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/salome/parametric/genjob.py b/src/salome/parametric/genjob.py index 351d4bd..c7ccc20 100644 --- a/src/salome/parametric/genjob.py +++ b/src/salome/parametric/genjob.py @@ -52,9 +52,13 @@ def generate_job(param_study, result_study_file_name, result_dir, resource): # Save Salome study ed = getStudyEditor() name_wo_space = param_study.name.replace(" ", "_") - (fd, input_study) = tempfile.mkstemp(prefix = name_wo_space + "_Input_", suffix = ".hdf") - os.close(fd) - salome.myStudyManager.SaveAs(input_study, ed.study, False) + if ed.study._get_IsSaved(): + input_study = ed.study._get_Name() + salome.myStudyManager.Save(ed.study, False) + else: + (fd, input_study) = tempfile.mkstemp(prefix = name_wo_space + "_", suffix = ".hdf") + os.close(fd) + salome.myStudyManager.SaveAs(input_study, ed.study, False) # Generate job script job_script = job_script_template % {"input_study": os.path.basename(input_study), diff --git a/src/salome/parametric/gui/genjob.ui b/src/salome/parametric/gui/genjob.ui index ec126b3..8df9add 100644 --- a/src/salome/parametric/gui/genjob.ui +++ b/src/salome/parametric/gui/genjob.ui @@ -66,6 +66,14 @@ + + + + Please note that your Salome study will automatically be saved when the job is generated. +Remember to make a copy before if you don't want to overwrite your study. + + + -- 2.39.2