From: Paul RASCLE Date: Sat, 12 Apr 2014 16:20:27 +0000 (+0200) Subject: control the presence of active studies in Python salome.salome_init() X-Git-Tag: V7_4_0b1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f740c1f4ed62cdbbee0f81a48de7b33337f951a;p=modules%2Fkernel.git control the presence of active studies in Python salome.salome_init() --- diff --git a/src/KERNEL_PY/salome_study.py b/src/KERNEL_PY/salome_study.py index 5e01b758c..29ba67d03 100755 --- a/src/KERNEL_PY/salome_study.py +++ b/src/KERNEL_PY/salome_study.py @@ -285,7 +285,14 @@ def getActiveStudy(theStudyId=0): if verbose(): print "connection to existing study ", theStudyId salome_study_ID = theStudyId if salome_study_ID == -1: - salome_study_ID = createNewStudy() + listOpenStudies = myStudyManager.GetOpenStudies() + if len(listOpenStudies) == 0: + salome_study_ID = createNewStudy() + else: + s = myStudyManager.GetStudyByName(listOpenStudies[0]) + salome_study_ID = s._get_StudyId() + else: + pass if verbose(): print"--- Study Id ", salome_study_ID return salome_study_ID