]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Edited python commands for single-study
authormpa <mpa@opencascade.com>
Thu, 25 Sep 2014 06:49:48 +0000 (10:49 +0400)
committermpa <mpa@opencascade.com>
Thu, 25 Sep 2014 06:49:48 +0000 (10:49 +0400)
src/KERNEL_PY/__init__.py
src/KERNEL_PY/salome_study.py

index 7cebb6be8c414d9f5700c4e8823a3b14458381d1..6d36a78e00ab501f4bdf4ce67a09cdcc3d153faa 100755 (executable)
@@ -216,7 +216,6 @@ def salome_init(theStudyId=0,embedded=0):
     global sg
     global myStudyManager, myStudyId, myStudy, myStudyName
 
-    print "*** import salome ***"
     try:
         if salome_initial:
             salome_initial=0
@@ -241,23 +240,22 @@ def salome_init(theStudyId=0,embedded=0):
         raise
     
 def study_close():
-    print "*** study_close ***"
-    if myStudy.IsEmpty():
-        raise RuntimeError, "Study is already closed!"
-    else:
+    global myStudy
+    if salome_study.myStudy:
+        global myStudyId, myStudyName
         myStudy.Close()
-        salome_close()
-        pass 
+        salome_study_close()
+        myStudyId, myStudy, myStudyName=None,None,None
+    else:
+        raise RuntimeError, "Study is already closed!"
     pass
 
 def salome_close():
-    print "*** salome_close ***"
     global salome_initial
     salome_initial=1
     salome_iapp_close()
     salome_kernel_close()
     salome_study_close()
-    myStudyId, myStudy, myStudyName=None,None,None
     pass
 
 
index cbe7106cda023050487dc4b5c6bfeee0192edd4a..7bec020679c402be80f60df3622d3e11f43f68a7 100755 (executable)
@@ -282,7 +282,6 @@ def getActiveStudy(theStudyId=0):
         if len(listOpenStudies) == 0:
             return None
         else:
-            print "getActiveStudy: GetStudyByName, salome_study_ID = ",salome_study_ID
             s = myStudyManager.GetStudyByName(listOpenStudies[0])
             salome_study_ID = s._get_StudyId()
     if verbose(): print"--- Study Id ", salome_study_ID
@@ -347,7 +346,6 @@ def salome_study_init(theStudyId=0):
         n (>0) : try connection to study with Id = n, or create a new one
                  if study not found.
     """
-    print "*** salome_study_init ***"
     global salome_study_initial
     global myStudyManager, myStudyId, myStudy, myStudyName
     global orb, lcc, naming_service, cm
@@ -367,7 +365,6 @@ def salome_study_init(theStudyId=0):
         myStudyId = getActiveStudy(theStudyId)
         if myStudyId == None :
             myStudyId = createNewStudy()
-            print "getActiveStudy: createNewStudy, salome_study_ID = ",salome_study_ID
         if verbose(): print "myStudyId",myStudyId
         myStudy = myStudyManager.GetStudyByID(myStudyId)
         myStudyName = myStudy._get_Name()
@@ -375,8 +372,7 @@ def salome_study_init(theStudyId=0):
     return myStudyManager, myStudyId, myStudy, myStudyName
 
 def salome_study_close():
-    print "*** salome_study_close ***"
-    global salome_study_initial, salome_study_ID
+    global salome_study_initial, salome_study_ID, myStudyId, myStudy, myStudyName
     salome_study_initial=1
     salome_study_ID=-1
     myStudyId, myStudy, myStudyName=None,None,None