]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
0023299: [CEA] Finalize multi-study removal mpa/23299_rebase
authorimn <imn@opencascade.com>
Thu, 13 Oct 2016 09:45:45 +0000 (12:45 +0300)
committermpa <mpa@opencascade.com>
Fri, 14 Oct 2016 06:15:28 +0000 (09:15 +0300)
- update python scripts and examples

38 files changed:
bin/runConsole.py
bin/runSalome.py
doc/salome/examples/example1
doc/salome/examples/example10
doc/salome/examples/example11
doc/salome/examples/example12
doc/salome/examples/example13
doc/salome/examples/example14
doc/salome/examples/example15
doc/salome/examples/example16
doc/salome/examples/example19
doc/salome/examples/example20
doc/salome/examples/example21
doc/salome/examples/example22
doc/salome/examples/example3
doc/salome/examples/example4
doc/salome/examples/example5
doc/salome/examples/example6
doc/salome/examples/example7
doc/salome/examples/example8
doc/salome/examples/example9
doc/salome/kernel_salome.dox
doc/salome/kernel_services.dox
doc/salome/salome_application.dox
idl/SALOME_Component.idl
src/Container/SALOME_ComponentPy.py
src/Container/SALOME_ContainerPy.py
src/KERNEL_PY/Help.py
src/KERNEL_PY/PyInterp.py
src/KERNEL_PY/__init__.py
src/KERNEL_PY/batchmode_salome.py
src/KERNEL_PY/kernel/parametric/study_exchange_vars.py
src/KERNEL_PY/kernel/services.py
src/KERNEL_PY/kernel/studyedit.py
src/KERNEL_PY/salome_iapp.py
src/KERNEL_PY/salome_study.py
src/KERNEL_PY/salome_test.py
src/Launcher/Test/test_launcher.py

index bb2192c8695744ba86258f6a8a811d3de23594f5..718321094be914617d1054ee1a8f3c49bf80452a 100644 (file)
@@ -162,7 +162,7 @@ def start_client():
   if session_server:
     session = clt.waitNS("/Kernel/Session")
   catalog = clt.waitNS("/Kernel/ModulCatalog")
-  studyMgr = clt.waitNS("/myStudyManager")
+  study = clt.waitNS("/Study")
 
   import salome
   salome.salome_init()
index c8a092a3ab399416deb99d137b14ea0d5be0200c..b547c3703b69e025e538fa587125469f1964888b 100755 (executable)
@@ -502,9 +502,9 @@ def startSalome(args, modules_list, modules_root_dir):
         myServer=SalomeDSServer(args)
         myServer.run()
         if sys.platform == "win32":
-          clt.waitNS("/myStudyManager")
+          clt.waitNS("/Study")
         else:
-          clt.waitNSPID("/myStudyManager",myServer.PID)
+          clt.waitNSPID("/Study",myServer.PID)
 
     #
     # Launch LauncherServer
index eae882caee60b5ea3fbbe45fdabe751a89f90d69..7092166104ae149b2644627185d3e1b6df6bc290 100644 (file)
@@ -21,8 +21,8 @@ file = str+"/test.hdf"
 
 print " -------  We will save to", file, "-----------"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy=batchmode_geompy.myStudyManager.Open(file)
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy=batchmode_geompy.myStudy.Open(file)
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 756e4a3f125e5e02d3de311d211f50abc52cb71a..3c2345d9c519b2de144df93b490624bc1e106ede 100644 (file)
@@ -22,8 +22,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file,  batchmode_geompy.myStudy)
-openedStudy = batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy = batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 4cfd732fd3abd70a68a2e7bf5373112570e88e4f..99dac3761325060b70f9e39583288de143c80fde 100644 (file)
@@ -22,8 +22,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy=batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy=batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 7605877363ffc1d6f42d73321770f1be28a1908c..7b69a136b89eab15fb7ee43d6da891be0bae9383 100644 (file)
@@ -28,8 +28,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy = batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy = batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index c05aaff5258a3e259f3199284bcef1f608179892..ced0f5a5f6c678bcb3c1bd97e831d1540d7a027a 100644 (file)
@@ -29,8 +29,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy=batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy=batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index a0acf346d20b866c018e487321386fb89f6e0553..384ae8fc7bd65c7dea47fea20f2ddd5f0c55da20 100644 (file)
@@ -19,8 +19,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy = batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy = batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 42493fe019816b4fa378f952a735d3767d693bcc..c959cd7eea9bef1ff9ae46c5e4bd438be46d40d4 100644 (file)
@@ -18,8 +18,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy = batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy = batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 3be50d9b64da8cc7a758811254445d237450b8a9..724fb89fd4707fc82c0980ab866027b460293155 100644 (file)
@@ -39,7 +39,7 @@ if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) !=
         raise  RuntimeError, "Wrong  value of  AttributeSequenceOfInteger"
 
 file1 = dir + "/test1.hdf"
-batchmode_geompy.myStudyManager.SaveAs(file1, batchmode_geompy.myStudy)
+batchmode_geompy.myStudy.SaveAs(file1)
 
 # 1st Undo ---------------------------------------
 batchmode_geompy.myBuilder.Undo()
@@ -53,7 +53,7 @@ if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 500 or A.Value(4) !=
         raise  RuntimeError, "Wrong  value of  AttributeSequenceOfInteger after the first 'undo'!"
 # save 
 file2 = dir + "/test2.hdf"
-batchmode_geompy.myStudyManager.SaveAs(file2, batchmode_geompy.myStudy)
+batchmode_geompy.myStudy.SaveAs(file2)
 #-------------------------------------------------
 # 2nd Undo ---------------------------------------
 batchmode_geompy.myBuilder.Undo()
@@ -61,7 +61,7 @@ res, attr = batchmode_geompy.myBuilder.FindAttribute(batchmode_geompy.father, "A
 if res !=0 or attr != None :
         raise  RuntimeError, "After the second 'undo' AttributeSequenceOfInteger exists but must not!"
 file3 = dir + "/test3.hdf"
-batchmode_geompy.myStudyManager.SaveAs(file3, batchmode_geompy.myStudy)
+batchmode_geompy.myStudy.SaveAs(file3)
 #-------------------------------------------------
 
 #make redo twice ---------------------------------
@@ -79,7 +79,7 @@ if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) !=
 
 
 #----------------------------------------------------------------------
-openedStudy=batchmode_geompy.myStudyManager.Open(file1);
+openedStudy=batchmode_geompy.myStudy.Open(file1);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
@@ -104,7 +104,7 @@ if A.Length() != 4:
 if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) != 500:
         print "Wrong  value of  AttributeSequenceOfInteger"
 #----------------------------------------------------------------------
-openedStudy=batchmode_geompy.myStudyManager.Open(file2);
+openedStudy=batchmode_geompy.myStudy.Open(file2);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
@@ -130,7 +130,7 @@ if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 500 or A.Value(4) !=
         raise  RuntimeError, "Wrong  value of  AttributeSequenceOfInteger after the first 'undo'!"
 
 #----------------------------------------------------------------------
-openedStudy=batchmode_geompy.myStudyManager.Open(file3);
+openedStudy=batchmode_geompy.myStudy.Open(file3);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 4cf37eb34c438d4e35f4f3e68026aafd999c9387..dbbd80e523d1873a177a207afb19be05910cd5d6 100644 (file)
@@ -60,7 +60,7 @@ idedge= batchmode_geompy.addToStudyInFather(face,edge,name)
 smesh =  batchmode_smesh.smesh
 #  --  Init  --
 shape = batchmode_geompy.IDToObject(idbox)
-mesh=smesh.Init(geom, batchmode_geompy.myStudyId, shape)
+mesh=smesh.Init(geom, shape)
 
 orb = batchmode_geompy.orb
 
@@ -72,7 +72,7 @@ batchmode_smesh.SetShape(idbox, idmesh);
 
 print "-------------------------- create Hypothesis ----------------------"
 print "-------------------------- LocalLength"
-hyp1 = smesh.CreateHypothesis("LocalLength", batchmode_geompy.myStudyId )
+hyp1 = smesh.CreateHypothesis("LocalLength")
 hypLen1 = hyp1._narrow(SMESH.SMESH_LocalLength)
 hypLen1.SetLength(100)
 print hypLen1.GetName()
@@ -83,7 +83,7 @@ idlength = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypLen1) );
 batchmode_smesh.SetName(idlength, "Local_Length_100");
 
 print "-------------------------- NumberOfSegments"
-hyp2 =  smesh.CreateHypothesis("NumberOfSegments", batchmode_geompy.myStudyId )
+hyp2 =  smesh.CreateHypothesis("NumberOfSegments")
 hypNbSeg1=hyp2._narrow(SMESH.SMESH_NumberOfSegments)
 hypNbSeg1.SetNumberOfSegments(7)
 print hypNbSeg1.GetName()
@@ -94,7 +94,7 @@ idseg =  batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypNbSeg1) );
 batchmode_smesh.SetName(idseg, "NumberOfSegments_7");
 
 print "-------------------------- MaxElementArea"
-hyp3 = smesh.CreateHypothesis("MaxElementArea",  batchmode_geompy.myStudyId)
+hyp3 = smesh.CreateHypothesis("MaxElementArea")
 hypArea1=hyp3._narrow(SMESH.SMESH_MaxElementArea)
 hypArea1.SetMaxElementArea(2500)
 print hypArea1.GetName()
@@ -105,7 +105,7 @@ idarea1 = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypArea1) );
 batchmode_smesh.SetName(idarea1, "MaxElementArea_2500");
 
 print "-------------------------- MaxElementArea"
-hyp3 = smesh.CreateHypothesis("MaxElementArea",  batchmode_geompy.myStudyId)
+hyp3 = smesh.CreateHypothesis("MaxElementArea")
 hypArea2 = hyp3._narrow(SMESH.SMESH_MaxElementArea)
 hypArea2.SetMaxElementArea(500)
 print hypArea2.GetName()
@@ -116,7 +116,7 @@ idarea2 = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypArea2) );
 batchmode_smesh.SetName(idarea2, "MaxElementArea_500");
 
 print "-------------------------- Regular_1D"
-alg1 = smesh.CreateHypothesis("Regular_1D",  batchmode_geompy.myStudyId)
+alg1 = smesh.CreateHypothesis("Regular_1D")
 algo1 = alg1._narrow(SMESH.SMESH_Algo)
 listHyp = algo1.GetCompatibleHypothesis()
 for hyp in listHyp:
@@ -129,7 +129,7 @@ idreg = batchmode_smesh.AddNewAlgorithms( orb.object_to_string(algoReg) );
 batchmode_smesh.SetName(idreg, "Regular_1D");
 
 print "-------------------------- MEFISTO_2D"
-alg2 = smesh.CreateHypothesis("MEFISTO_2D",  batchmode_geompy.myStudyId)
+alg2 = smesh.CreateHypothesis("MEFISTO_2D")
 algo2 = alg2._narrow(SMESH.SMESH_Algo)
 listHyp=algo2.GetCompatibleHypothesis()
 for hyp in listHyp:
@@ -328,8 +328,8 @@ file = str+"/test.hdf"
 #==================================================
 print " -------  We will save to", file, "-----------"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-batchmode_geompy.myStudyManager.Close(batchmode_geompy.myStudy)
+batchmode_geompy.myStudy.SaveAs(file)
+batchmode_geompy.myStudy.Clear()
 
 #rename the file and try to reread it again
 
@@ -345,7 +345,7 @@ os.rename(file, str+"/test_dir/test_new.hdf")
 print " ------- We try to open " + str + "/test_dir/test_new.hdf"
 
 try:
-        openedStudy=batchmode_geompy.myStudyManager.Open(str+"/test_dir/test_new.hdf")
+        openedStudy=batchmode_geompy.myStudy.Open(str+"/test_dir/test_new.hdf")
 except Exception:
         raise  RuntimeError, "Can't open saved study!"
 
@@ -441,13 +441,13 @@ if names != Names :
 #==================================================
 #4. Save
 #==================================================
-batchmode_geompy.myStudyManager.Save(openedStudy)
-batchmode_geompy.myStudyManager.Close(openedStudy)
+batchmode_geompy.myStudy.Save()
+batchmode_geompy.myStudy.Clear()
 #==================================================
 #5. Open
 #==================================================
 try:
-        openedStudy = batchmode_geompy.myStudyManager.Open(str+"/test_dir/test_new.hdf")
+        openedStudy = batchmode_geompy.myStudy.Open(str+"/test_dir/test_new.hdf")
 except Exception:
         raise  RuntimeError, "Can't open saved study!"
 
index 9326da1150bd66ce548d65390fe5b86cc3a14fb3..20affe6dcc6c4b84a13a845d64a90110582dfdc6 100644 (file)
@@ -65,7 +65,7 @@ file = str+"/test.hdf"
 
 print " -------  We will save to", file, "-----------"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
+batchmode_geompy.myStudy.SaveAs(file)
 
 
 #--------------------------------------------------------------------------#
@@ -74,7 +74,7 @@ batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
 
 print" -------------- Open  " + file + "-------------- " 
 
-openedStudy = batchmode_geompy.myStudyManager.Open(file)
+openedStudy = batchmode_geompy.myStudy.Open(file)
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
 
index 33526d9564ae26902fa7d84e3972b0a36f5d9ce6..9d456d04bb206910e6ebe8bb6819d8bc3dc2054b 100644 (file)
@@ -79,7 +79,7 @@ file = str+"/test.hdf"
 
 print " -------  We will save to", file, "-----------"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
+batchmode_geompy.myStudy.SaveAs(file)
 
 #--------------------------------------------------------------------------#
 #---------------------------- Open file -----------------------------------# 
@@ -87,7 +87,7 @@ batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
 
 print" -------------- Open  " + file + "-------------- " 
 
-openedStudy=batchmode_geompy.myStudyManager.Open(file)
+openedStudy=batchmode_geompy.myStudy.Open(file)
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
 
index bba273be632b08bd842ff8a07d067d1fe890e8e9..6f9eee0a901a11fb9d127ab6fe51dd83ea1a7b84 100644 (file)
@@ -80,7 +80,7 @@ file = str+"/test.hdf"
 
 print " -------  We will save to", file, "-----------"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
+batchmode_geompy.myStudy.SaveAs(file)
 
 #--------------------------------------------------------------------------#
 #---------------------------- Open file -----------------------------------# 
@@ -88,7 +88,7 @@ batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
 
 print" -------------- Open  " + file + "-------------- " 
 
-openedStudy = batchmode_geompy.myStudyManager.Open(file)
+openedStudy = batchmode_geompy.myStudy.Open(file)
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
 
index 95e18e8e7cca162695a9fed10691cc751b63c5e6..2aff52ed147ce754a13dc503faabc63939a3f799 100644 (file)
@@ -31,8 +31,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy=batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy=batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 2dd1966db98b46c87c0bcb6cfbbdf99d5c968e42..a9669304e3e47f534c2771badf144623ffae0b75 100644 (file)
@@ -30,8 +30,8 @@ str= os.getenv("TmpDir")
 if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy=batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy=batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 59e3bc6a031b59a5f8addd793a4065674859a6bb..47263aa2f41c5d3e71ee35667e8f6597df0e35c7 100644 (file)
@@ -21,8 +21,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy = batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy = batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 71a5859e73724968cc623f16e00ff6951c1cbc12..4685f2b7abcaad5d21896647a9cd19d53f9aafb6 100644 (file)
@@ -19,8 +19,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy = batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy = batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 8ddf8bb2bf9511138a41439ac3ebb1654c13e282..2477a3e072b40f13586c434d01277e5e5d91da89 100644 (file)
@@ -18,8 +18,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy = batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy = batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index eadb13feb99a6a7b382ee43ca7c3ee3749e0242a..3d79cab4470fee2bb72571b3f2f524264fa11333 100644 (file)
@@ -26,8 +26,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy=batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy=batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index d29c9bab7baa087abc3900c93db5153b5d9fe490..68d9394d38b187426ae777d3d1b73b9e02b53ab1 100644 (file)
@@ -22,8 +22,8 @@ if str == None:
         str = "/tmp"
 file = str+"/test.hdf"
 
-batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
-openedStudy = batchmode_geompy.myStudyManager.Open(file);
+batchmode_geompy.myStudy.SaveAs(file)
+openedStudy = batchmode_geompy.myStudy.Open(file);
 
 if openedStudy == None:
         raise  RuntimeError, "Can't open saved study!"
index 75deb29601f9bc856fb4ab1e3c527b170772f237..1ca3018026608f5fc7decbd36c91a99f3c8e9ad3 100644 (file)
@@ -72,46 +72,6 @@ geom = salome.lcc.FindOrLoadComponent('FactoryServer', 'GEOM')
 \b Note, that in the above example, \e "FactoryServer" is a name of the
 SALOME container, where Geometry module engine should be loaded.
 
-\li \b myStudyManager Reference to the study manager
-
-SALOMEDS Study manager is used to manipulate with the studies: create,
-open, save, close. It also can be used to find the study by its
-numerical ID or name. The code below demonstrates main
-functionalities of a study manager:
-\code
-# create new study with the name "MyStudy"
-new_study = salome.myStudyManager.NewStudy("MyStudy")
-
-# open study from file /home/user/MyStudy.hdf
-study = salome.myStudyManager.OpenStudy("/home/user/MyStudy.hdf")
-
-# save study
-salome.myStudyManager.Save(study, False) # not using multifile save mode
-
-# save study in ASCII format
-salome.myStudyManager.SaveASCII(study, True) # using multifile save mode
-
-# save study with the new file path
-salome.myStudyManager.SaveAs("/home/user/MyStudy.hdf", study, False)
-
-# save study with the new file path in ASCII format
-salome.myStudyManager.SaveAsASCII("/home/user/MyStudy.hdf", study, False)
-
-# close study
-salome.myStudyManager.Close(study)
-
-# get list of all opened studies
-studies = salome.myStudyManager.GetOpenStudies()
-
-# find study by its numerical ID (integer value starting from 1)
-study = salome.myStudyManager.GetStudyByID(studyID)
-
-# find study by its name
-study = salome.myStudyManager.GetStudyByName("/home/user/MyStudy.hdf")
-
-# ...
-\endcode
-
 \anchor salome_myStudy
 \li \b myStudy Reference to the current (active) study
 
@@ -136,8 +96,23 @@ documentation.
 # get study name
 studyName = salome.myStudy._get_Name()
 
-# get study numerical ID
-studyID = salome.myStudy._get_StudyId()
+# open study from file /home/user/MyStudy.hdf
+study = salome.myStudy.OpenStudy("/home/user/MyStudy.hdf")
+
+# save study
+salome.myStudy.Save(study, False) # not using multifile save mode
+
+# save study in ASCII format
+salome.myStudy.SaveASCII(study, True) # using multifile save mode
+
+# save study with the new file path
+salome.myStudy.SaveAs("/home/user/MyStudy.hdf", study, False)
+
+# save study with the new file path in ASCII format
+salome.myStudy.SaveAsASCII("/home/user/MyStudy.hdf", study, False)
+
+# clear study
+salome.myStudy.Clear()
 
 # find SALOMEDS component by its type
 scomponent = FindComponent("MyComponent")
@@ -192,12 +167,6 @@ while iter.More():
 # ...
 \endcode
 
-\li \b myStudyId Identifier of the current (active) study
-
-This variable contains the numerical identifier of the current
-(active) study. It is an equivalent of \c
-salome.myStudy._get_StudyId() code.
-
 \li \b myStudyName Name of the current (active) study
 
 This variable contains the name of the current (active) study. It is
@@ -279,15 +248,6 @@ else:
    entry = ""
 \endcode
 
-\li \b createNewStudy() Create new study
-
-This function can be used to create new SALOME study. Returns an ID of
-the created study.
-\code
-studyId = salome.createNewStudy()
-study   = salome.myStudyManager.GetStudyByID(s)
-\endcode
-
 \li \b generateName() Generate unique name
 
 This function adds random numerical suffix to the passed string
index d68ced648db211a54cc87fe4081fa05b6676001e..211b4dd2e281200c55803a8100b1bc7f0c51ad1d 100644 (file)
@@ -135,7 +135,6 @@ Study.dir
   extStudy_1.object
   extStudy_2.object
   extStudy_3.object
-myStudyManager.object
 SalomeAppEngine.object
 \endcode
 
index bd79433d910aab44bbbf6adca0c3b9ff320f3474..e1661dee498fcaf9bcf69ee50901b88e26adda3c 100644 (file)
@@ -289,8 +289,7 @@ python
 \endcode
 
 Import salome module. salome_init() without arguments creates a new study
-in the running session (note: salome_init(n) attachs to a running session whose
-studyId is n):
+in the running session:
 
 \code
 import salome
index 012cfc6447543d436f8d07aaaf94901d424dfb89..c18277c905c8435b3dffb8d83b64cf7e0f976476 100644 (file)
@@ -101,8 +101,6 @@ module Engines
           Warning: no internal registration is done, so it is up to the caller to
           manage the various instanciation.
           \param serviceName Name of the service
-
-                                >0 otherwise (== study id)
           \param reason  in case of error (return void string) a string explaining the error
           \return the IOR of the loaded service.
         */
index 5386477ce2bdc217bea16f66547050e814b500a8..89d1ab0aaa0ce2ef8f6a0daa353b4ecd80eec5ee 100755 (executable)
@@ -59,7 +59,6 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent):
     _orb = None
     _poa = None
     _fieldsDict = []
-    _studyId = -1
 
     #-------------------------------------------------------------------------
 
@@ -301,17 +300,12 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent):
 
     #-------------------------------------------------------------------------
 
-    def getStudyId(self):
-        return self._studyId
-
-    #-------------------------------------------------------------------------
-
     def hasObjectInfo(self):
         return 0
 
     #-------------------------------------------------------------------------
 
-    def getObjectInfo(self, studyId, entry):
+    def getObjectInfo(self, entry):
         return ""
 
     #-------------------------------------------------------------------------
index 4da4bacad72a5bc514c529ade61c08aa1dce5a1b..3a8b2bf4043874c53e5fc93bce6bdd486214617c 100755 (executable)
@@ -199,40 +199,36 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
     
     #-------------------------------------------------------------------------
 
-    def create_component_instance_env(self, componentName, studyId, env):
-      return self.create_component_instance(componentName, studyId), ""
-
-    def create_component_instance(self, componentName, studyId):
-        MESSAGE( "SALOME_ContainerPy_i::create_component_instance ==> " + str(componentName) + ' ' + str(studyId) )
-        if studyId < 0:
-            MESSAGE( "Study ID is lower than 0!" )
-            return None
-        else:
-            self._numInstance = self._numInstance +1
-            instanceName = componentName + "_inst_" + `self._numInstance`
-            comp_iors=""
-            try:
-                component=__import__(componentName)
-                factory=getattr(component,componentName)
-                comp_i=factory(self._orb,
-                               self._poa,
-                               self._this(),
-                               self._containerName,
-                               instanceName,
-                               componentName)
-                
-                MESSAGE( "SALOME_Container_i::create_component_instance : OK")
-                comp_o = comp_i._this()
-                self._listInstances_map[instanceName] = comp_i
-            except:
-                import traceback
-                traceback.print_exc()
-                MESSAGE( "SALOME_Container_i::create_component_instance : NOT OK")
-            return comp_o
+    def create_component_instance_env(self, componentName, env):
+      return self.create_component_instance(componentName), ""
+
+    def create_component_instance(self, componentName):
+        MESSAGE( "SALOME_ContainerPy_i::create_component_instance ==> " + str(componentName) )
+        self._numInstance = self._numInstance +1
+        instanceName = componentName + "_inst_" + `self._numInstance`
+        comp_iors=""
+        try:
+            component=__import__(componentName)
+            factory=getattr(component,componentName)
+            comp_i=factory(self._orb,
+                           self._poa,
+                           self._this(),
+                           self._containerName,
+                           instanceName,
+                           componentName)
+            
+            MESSAGE( "SALOME_Container_i::create_component_instance : OK")
+            comp_o = comp_i._this()
+            self._listInstances_map[instanceName] = comp_i
+        except:
+            import traceback
+            traceback.print_exc()
+            MESSAGE( "SALOME_Container_i::create_component_instance : NOT OK")
+        return comp_o
 
     #-------------------------------------------------------------------------
 
-    def find_component_instance(self, registeredName, studyId):
+    def find_component_instance(self, registeredName):
         anEngine = None
         keysList = self._listInstances_map.keys()
         i = 0
@@ -240,8 +236,7 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
             instance = keysList[i]
             if find(instance,registeredName) == 0:
                 anEngine = self._listInstances_map[instance]
-                if studyId == anEngine.getStudyId():
-                    return anEngine._this()
+                return anEngine._this()
             i = i + 1
         return anEngine._this()
         
index 7948abe7f5dc99d7187f2d15e9e0884f104e0d28..d349d3f2fccf3af4c95f861c2ecf36b915a4d7e9 100755 (executable)
@@ -53,8 +53,7 @@ variables:
   salome.sg
       methods:
          updateObjBrowser(bool):
-         getActiveStudyId():
-         getActiveStudyName():
+         getStudyName():
          
          SelectedCount():      returns number of selected objects
          getSelected(i):       returns entry of selected object number i
@@ -71,8 +70,7 @@ variables:
 
          IDToObject(Entry):    returns CORBA reference from entry
 
-  salome.myStudyName     : active Study Name
-  salome.myStudyId       : active Study Id
+  salome.myStudyName     : the Study Name
   salome.myStudy         : the active Study itself (CORBA ior)
                            methods : defined in SALOMEDS.idl
                                                          
index f10973927e59a639e7d321877b66782a5d9c563d..8e4595e65af18cf46bae799182d3ae78b9ff1cc7 100755 (executable)
@@ -88,16 +88,10 @@ sg = SALOMEGUI_Swig()
 #create an naming service instance
 naming_service = SALOME_NamingServicePy_i(orb)
 
-# get active study name and id
-myStudyName = sg.getActiveStudyName()
+# get active study name
+myStudyName = sg.getStudyName()
 print myStudyName
 
-myStudyId = sg.getActiveStudyId()
-print myStudyId
-
-# get Study Manager reference
-obj = naming_service.Resolve('myStudyManager')
-myStudyManager = obj._narrow(SALOMEDS.StudyManager)
-
-# get active study
-myStudy = myStudyManager.GetStudyByName(myStudyName)
+# get Study reference
+obj = naming_service.Resolve('Study')
+myStudy = obj._narrow(SALOMEDS.Study)
index 84f40c655522f7f09a873504c14e9752910dd7ed..5d0cb75e7ac8613797f314273638261f200e6f21 100755 (executable)
@@ -46,8 +46,6 @@ variables:
   - salome.sg              : salome object to communicate with the graphical user interface (if any)
       - methods:
          - updateObjBrowser(bool):
-         - getActiveStudyId():
-         - getActiveStudyName():
 
          - SelectedCount():      returns number of selected objects
          - getSelected(i):       returns entry of selected object number i
@@ -65,7 +63,6 @@ variables:
          - IDToObject(Entry):    returns CORBA reference from entry
 
   - salome.myStudyName     : active Study Name
-  - salome.myStudyId       : active Study Id
   - salome.myStudy         : the active Study itself (CORBA ior)
       - methods : defined in SALOMEDS.idl
 
@@ -78,7 +75,6 @@ variables:
 #  \param salome.lcc             : instance of lifeCycleCORBA class (SALOME_LifeCycleCORBA)
 #  \param salome.sg              : Salome object to communicate with the graphical user interface, if running (see interface in salome_iapp::SalomeOutsideGUI)
 #  \param salome.myStudyName     : active Study Name
-#  \param salome.myStudyId       : active Study Id
 #  \param salome.myStudy         : the active Study (interface SALOMEDS::Study)
 
 #
@@ -166,62 +162,32 @@ if not flags:
 #    pass
 
 orb, lcc, naming_service, cm,sg=None,None,None,None,None
-myStudyManager, myStudyId, myStudy, myStudyName=None,None,None,None
-
-def setCurrentStudy(theStudy):
-    """
-    Change current study : an existing one given by a study object.
-
-    :param theStudy: the study CORBA object to set as current study
-    """
-    global myStudyId, myStudy, myStudyName
-    myStudyId, myStudy, myStudyName =salome_study.setCurrentStudy(theStudy)
-
-def setCurrentStudyId(theStudyId=0):
-    """
-    Change current study : an existing or new one given by Id.
-
-    :param theStudyId: the study Id (optional argument)
-           0      : create a new study (default).
-           n (>0) : try connection to study with Id = n, or create a new one
-                      if study not found.
-    """
-    global myStudyId, myStudy, myStudyName
-    myStudyId, myStudy, myStudyName =salome_study.setCurrentStudyId(theStudyId)
+myStudy, myStudyName=None,None
 
 salome_initial=1
-def salome_init(theStudyId=0,embedded=0):
+def salome_init(embedded=0):
     """
     Performs only once SALOME general purpose intialisation for scripts.
-    optional argument : theStudyId
-      When in embedded interpreter inside IAPP, theStudyId is not used
-      When used without GUI (external interpreter)
-        0      : create a new study (default).
-        n (>0) : try connection to study with Id = n, or create a new one
-                 if study not found.
-                 If study creation, its Id may be different from theStudyId !
     Provides:
     orb             reference to CORBA
     lcc             a LifeCycleCorba instance
     naming_service  a naming service instance
     cm              reference to the container manager
     sg              access to SALOME GUI (when linked with IAPP GUI)
-    myStudyManager  the study manager
-    myStudyId       active study identifier
     myStudy         active study itself (CORBA reference)
     myStudyName     active study name
     """
     global salome_initial
     global orb, lcc, naming_service, cm
     global sg
-    global myStudyManager, myStudyId, myStudy, myStudyName
+    global myStudy, myStudyName
 
     try:
         if salome_initial:
             salome_initial=0
             sg = salome_iapp_init(embedded)
             orb, lcc, naming_service, cm = salome_kernel_init()
-            myStudyManager, myStudyId, myStudy, myStudyName = salome_study_init(theStudyId)
+            myStudy, myStudyName = salome_study_init()
             pass
         pass
     except RuntimeError, inst:
@@ -240,16 +206,16 @@ def salome_init(theStudyId=0,embedded=0):
         raise
     
 def salome_close():
-    global salome_initial, myStudy, myStudyId, myStudyName
+    global salome_initial, myStudy, myStudyName
     try:
-        # study can be closed either from GUI or directly with salome.myStudy.Close()
-        myStudy.Close()
+        # study can be clear either from GUI or directly with salome.myStudy.Clear()
+        myStudy.Clear()
     except:
         pass
     salome_initial=1
     salome_iapp_close()
     salome_study_close()
-    myStudyId, myStudy, myStudyName=None,None,None
+    myStudy, myStudyName=None,None
     pass
 
 
index 7a7ae9e819a1f075f0f1d8daa0dc3ea09946de65..9e036ec88755b6ff484e5b2a4709cd05c0e49eb7 100755 (executable)
@@ -180,14 +180,14 @@ def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
     aTree = GetTree(aRoot)
     aStudyPersist = PersistentPresentation(myStudy, aRoot, 1)
 
-    if not myStudyManager.CanCopy(theSO):
+    if not myStudy.CanCopy(theSO):
         raise RuntimeError, "<CanCopy> for "+theInfo+" returns false"
     
-    if not myStudyManager.Copy(theSO):
+    if not myStudy.Copy(theSO):
         raise RuntimeError, "<Copy> for "+theInfo+" returns false"
 
     
-    if not myStudyManager.CanPaste(theSO):
+    if not myStudy.CanPaste(theSO):
         raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
 
     # check: before paste study is not changed check
@@ -198,7 +198,7 @@ def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
     if theComponentPaste:
         aSObj = theSO.GetFatherComponent()
         theInfo = theInfo + "(paste for component)"
-    if myStudyManager.Paste(aSObj) == None:
+    if myStudy.Paste(aSObj) == None:
         raise RuntimeError, "<Paste> for "+theInfo+" returns None object"
     aNewTree = GetTree(aRoot)
     aLen = len(aTree)
@@ -269,14 +269,14 @@ if lcc is None:
 #create a naming service instance
 naming_service = SALOME_NamingServicePy_i(orb)
 
-# get Study Manager reference
+# get Study reference
 obj = None
 
 step = 0
 sleeping_time = 0.01
 sleeping_time_max = 1.0
 while 1:
-    obj = naming_service.Resolve('myStudyManager')
+    obj = naming_service.Resolve('Study')
     if obj is not None:break
     step = step + 1
     if step > 100: break
@@ -284,22 +284,9 @@ while 1:
     sleeping_time = max(sleeping_time_max, 2*sleeping_time)
     pass
      
-myStudyManager = obj._narrow(SALOMEDS.StudyManager)
+myStudy = obj._narrow(SALOMEDS.Study)
 
-if myStudyManager is None:
-    print "Warning: SALOMEDS.StudyManager has not been created !!!"
-
-# create new study
-aListOfOpenStudies = myStudyManager.GetOpenStudies();
-myStudy = None;
-if len(aListOfOpenStudies) == 0 :
-    myStudy = myStudyManager.NewStudy("Study1")
-else:
-    myStudyName = aListOfOpenStudies[0]
-    myStudy = myStudyManager.GetStudyByName(myStudyName)
+if myStudy is None:
+    print "Warning: SALOMEDS.Study has not been created !!!"
     
 myStudyName = myStudy._get_Name()
-
-myStudyId = myStudy._get_StudyId()
-#print myStudyId
-
index 0ac0490fcbb8e4d04f90aa7e9afb9b2d4629577f..7b7fdf88739bb32a2dd3013248c1fee185180467 100644 (file)
@@ -182,8 +182,7 @@ def createSObjectForExchangeVariables(fatherSobj, exchangeVariables,
     :return: the newly created SObject.
 
     """
-    studyId = fatherSobj.GetStudy()._get_StudyId()
-    editor = getStudyEditor(studyId)
+    editor = getStudyEditor()
     sobj = editor.createItem(fatherSobj,
                              name = name,
                              icon = icon,
@@ -210,8 +209,7 @@ def updateSObjectForExchangeVariables(sobj, exchangeVariables,
     other parameters.
 
     """
-    studyId = sobj.GetStudy()._get_StudyId()
-    editor = getStudyEditor(studyId)
+    editor = getStudyEditor()
     editor.setItem(sobj, name = name, icon = icon, typeId = typeId)
     editor.builder.RemoveAttribute(sobj, "AttributeParameter")
     _setSObjectForExchangeVariables(editor, sobj, exchangeVariables)
index a2d4feaa684eefe2f41da1e238c1bc8ab74de9eb..b1b3db9c1e21276e9bf9943b3b9a8e1bb499e546 100644 (file)
@@ -47,8 +47,8 @@ if not is_called_by_sphinx() and salome.lcc is None:
 
 # Note that the salome module provides you with standard SALOME
 # objects: CORBA broker (orb): salome.orb lyfe cycle (lcc) :
-# salome.lcc naming service : salome.naming_service study manager :
-# salome.myStudyManager The default study : salome.myStudy
+# salome.lcc naming service : salome.naming_service 
+# The default study : salome.myStudy
 #
 # Alternatively, you may obtain these objects directly with the
 # following instructions:
@@ -123,27 +123,21 @@ def getComponentList():
         raise RuntimeError, "Can't accesss module catalog"
     return catalog.GetComponentList()
 
-## Get a study manager to create and manage %SALOME studies
-#  \ingroup service
-def getStudyManager():
-    """Get a study manager to create and manage SALOME studies"""
-    return salome.myStudyManager
-
 import SALOMEDS
-## Get a study manager to create and manage SALOME studies
-#  \warning you should use instead the variable salome.myStudyManager
+## Get a study to create SALOME study
+#  \warning you should use instead the variable salome.myStudy. 
 #  This function is given for illustration of usage of the naming service
 #  \ingroup service
-def __getStudyManager_demo():
+def __getStudy_demo():
     """
-    Get a study manager to create and manage SALOME studies. WARN: you
-    should use instead the variable salome.myStudyManager. This
+    Get a study to create SALOME study. WARN: you
+    should use instead the variable salome.myStudy. This
     function is given for illustration of usage of the naming service
     """
     naming_service = SALOME_NamingServicePy_i( orb )
-    obj = naming_service.Resolve( '/myStudyManager' )
-    studyManager = obj._narrow( SALOMEDS.StudyManager)
-    return studyManager
+    obj = naming_service.Resolve( '/Study' )
+    study = obj._narrow( SALOMEDS.Study)
+    return study
 
 
 #
index 463b70fb859d7160472f005c8a14e0e3ee1ca538..499a183921d9dfa70297826f6017e079f96cf766 100644 (file)
@@ -36,68 +36,31 @@ from salome.kernel.logger import Logger
 from salome.kernel import termcolor
 logger = Logger("salome.kernel.studyedit", color = termcolor.PURPLE)
 
-_editors = {}
+_editor = None
 _DEFAULT_CONTAINER = "FactoryServer"
 
 # The codec to use for strings that are displayed in Salome study tree is Latin-1
 ENCODING_FOR_SALOME_STUDY = "iso-8859-1"
 
-## Return the ID of the active study. In GUI mode, this function is equivalent
-#  to salome.sg.getActiveStudyId(). Outside GUI, it returns <b> salome.myStudyId </b>
-#  variable.
-#  \ingroup studyedit
-def getActiveStudyId():
-    """
-    Return the ID of the active study. In GUI mode, this function is equivalent
-    to ``salome.sg.getActiveStudyId()``. Outside GUI, it returns
-    ``salome.myStudyId`` variable.
-    """
-    salome.salome_init()
-    # Warning: we don't use salome.getActiveStudy() here because it doesn't
-    # work properly when called from Salome modules (multi-study interpreter
-    # issue)
-    if salome.hasDesktop():
-        return salome.sg.getActiveStudyId()
-    else:
-        return salome.myStudyId
-
-def getActiveStudy():
-    return getStudyFromStudyId(getActiveStudyId())
-
-def getStudyFromStudyId(studyId):
-    salome.salome_init()
-    study = salome.myStudyManager.GetStudyByID(studyId)
-    return study
-
-def getStudyIdFromStudy(study):
-    studyId = study._get_StudyId()
-    return studyId
-
-## Return a \b StudyEditor instance to edit the study with ID studyId. 
-#  If \b studyId is \b None, return an editor for the current study.
+def getStudy():
+    return salome.myStudy
+
+## Return a \b StudyEditor instance to edit the study. 
 #  \ingroup studyedit
-def getStudyEditor(studyId = None):
+def getStudyEditor():
     """
-    Return a :class:`StudyEditor` instance to edit the study with ID
-    `studyId`. If `studyId` is :const:`None`, return an editor for the current
-    study.
+    Return a :class:`StudyEditor` instance to edit the study.
     """
-    if studyId is None:
-        studyId = getActiveStudyId()
-    if not _editors.has_key(studyId):
-        _editors[studyId] = StudyEditor(studyId)
-    return _editors[studyId]
+    if _editor is None:
+        _editor = StudyEditor()
+    return _editor
 
 ## This class provides utility methods to complement \b Study and
 #  \b StudyBuilder classes. Those methods may be moved in those classes
-#  in the future. The parameter \b studyId defines the ID of the study to
-#  edit. If it is \em None, the edited study will be the current study.
+#  in the future.
 #  The preferred way to get a StudyEditor object is through the method
 #  \b getStudyEditor which allows to reuse existing instances.
 #
-#  \param studyId This instance attribute contains the ID of the edited study. 
-#  This attribute should not be modified.
-#
 #  \param study This instance attribute contains the underlying \b Study object.
 #  It can be used to access the study but the attribute itself should not
 #  be modified.
@@ -110,16 +73,10 @@ class StudyEditor:
     """
     This class provides utility methods to complement :class:`Study` and
     :class:`StudyBuilder` classes. Those methods may be moved in those classes
-    in the future. The parameter `studyId` defines the ID of the study to
-    edit. If it is :const:`None`, the edited study will be the current study.
+    in the future.
     The preferred way to get a StudyEditor object is through the method
     :meth:`getStudyEditor` which allows to reuse existing instances.
 
-    .. attribute:: studyId
-    
-       This instance attribute contains the ID of the edited study. This
-       attribute should not be modified.
-
     .. attribute:: study
     
        This instance attribute contains the underlying :class:`Study` object.
@@ -133,15 +90,12 @@ class StudyEditor:
        should not be modified.
 
     """
-    def __init__(self, studyId = None):
+    def __init__(self):
         salome.salome_init()
-        if studyId is None:
-            studyId = getActiveStudyId()
-        self.studyId = studyId
-        self.study = salome.myStudyManager.GetStudyByID(studyId)
+        self.study = salome.myStudy
         if self.study is None:
             raise Exception("Can't create StudyEditor object: "
-                            "Study %d doesn't exist" % studyId)
+                            "Study doesn't exist")
         self.builder = self.study.NewBuilder()
 
     ## Find a component corresponding to the Salome module \b moduleName in
index 283c5685c79997a4dfb57e919db92bc1b9d63c7a..ac3c674efe0f3ca648f97f2dd91f70ded6771c88 100755 (executable)
@@ -71,7 +71,7 @@ class SalomeOutsideGUI(object):
     Provides a replacement for class SalomeGUI outside GUI process.
     Do almost nothing
     """
-    global myStudyId, myStudyName
+    global myStudyName
     
     def hasDesktop(self):
         """Indicate if GUI is running"""
@@ -82,14 +82,9 @@ class SalomeOutsideGUI(object):
         print "SalomeOutsideGUI: no objectBrowser update outside GUI"
         pass
     
-    def getActiveStudyId(self):
-        """Get the active study id"""
-        print "SalomeOutsideGUI.getActiveStudyId: avoid use outside GUI"
-        return myStudyId
-    
-    def getActiveStudyName(self):
-        """Get the active study name"""
-        print "SalomeOutsideGUI.getActiveStudyName: avoid use outside GUI"
+    def getStudyName(self):
+        """Get the study name"""
+        print "SalomeOutsideGUI.getStudyName: avoid use outside GUI"
         return myStudyName
     
     def SelectedCount(self):
index c084373255be678b239bc6187924f7babd1d13f5..7269f8b1c694fe9d21dee9313b2764aa1b55efd0 100755 (executable)
@@ -31,8 +31,6 @@ import SALOMEDS
 import salome_iapp
 from launchConfigureParser import verbose
 
-myStudyManager = None
-myStudyId = None
 myStudy = None
 myStudyName = None
 
@@ -71,17 +69,6 @@ def DumpStudy(Study):
       DumpComponent(Study, SC,Builder, 1)
       itcomp.Next()
 
-def DumpStudies():
-  """
-    Dump all studies in a StudyManager
-  """
-  global myStudyManager
-  for name in myStudyManager.GetOpenStudies():
-    s = myStudyManager.GetStudyByName(name)
-    print "study:",name, s._get_StudyId()
-    DumpStudy(s)
-
-
 #--------------------------------------------------------------------------
 
 def IDToObject(id):
@@ -197,7 +184,7 @@ def GetTree(theSO):
     #--------------------------------------------------------------------------
 
 def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
-    global myStudyManager, myStudy
+    global myStudy
 
     aRoot = theSO
     while aRoot.GetID() != "0:":
@@ -205,14 +192,14 @@ def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
     aTree = GetTree(aRoot)
     aStudyPersist = PersistentPresentation(myStudy, aRoot, 1)
 
-    if not myStudyManager.CanCopy(theSO):
+    if not myStudy.CanCopy(theSO):
         raise RuntimeError, "<CanCopy> for "+theInfo+" returns false"
     
-    if not myStudyManager.Copy(theSO):
+    if not myStudy.Copy(theSO):
         raise RuntimeError, "<Copy> for "+theInfo+" returns false"
 
     
-    if not myStudyManager.CanPaste(theSO):
+    if not myStudy.CanPaste(theSO):
         raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
 
     # check: before paste study is not changed check
@@ -223,7 +210,7 @@ def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
     if theComponentPaste:
         aSObj = theSO.GetFatherComponent()
         theInfo = theInfo + "(paste for component)"
-    if myStudyManager.Paste(aSObj) == None:
+    if myStudy.Paste(aSObj) == None:
         raise RuntimeError, "<Paste> for "+theInfo+" returns None object"
     aNewTree = GetTree(aRoot)
     aLen = len(aTree)
@@ -279,33 +266,6 @@ def FindFileInDataDir(filename):
 
     #--------------------------------------------------------------------------
 
-salome_study_ID = -1
-
-# *args are used here to support backward compatibility
-# previously it was possible to pass theStudyId parameter to this function
-# which is no more supported.
-def getActiveStudy(*args):
-    global myStudyManager
-    global salome_study_ID
-
-    if not myStudyManager:
-        print "No active study"
-        return None
-        pass
-
-    if verbose(): print "getActiveStudy"
-    if salome_study_ID == -1:
-        listOpenStudies = myStudyManager.GetOpenStudies()
-        if len(listOpenStudies) == 0:
-            return None
-        else:
-            s = myStudyManager.GetStudyByName(listOpenStudies[0])
-            salome_study_ID = s._get_StudyId()
-    if verbose(): print"--- Study Id ", salome_study_ID
-    return salome_study_ID
-
-    #--------------------------------------------------------------------------
-
 def setCurrentStudy(theStudy):
     """
     Change current study : an existing one given by a study object.
@@ -317,59 +277,28 @@ def setCurrentStudy(theStudy):
     corresponds to the currently opened study.
     Kept for backward compatibility only.
     """
-    global myStudyId, myStudy, myStudyName
-    global salome_study_ID
+    global myStudy, myStudyName
     myStudy = theStudy
-    myStudyId = theStudy._get_StudyId()
     myStudyName = theStudy._get_Name()
-    return myStudyId, myStudy, myStudyName
-
-    #--------------------------------------------------------------------------
-
-# *args are used here to support backward compatibility
-# previously it was possible to pass theStudyId parameter to this function
-# which is no more supported.
-def setCurrentStudyId(*args):
-    """
-    Change current study : an existing or new one.
-
-    This function connects to the single opened study if there is any; otherwise
-    new empty study is created.
-
-    Obsolete: only one study can be opened at the moment.
-    Kept for backward compatibility only.
-    """
-    global myStudyManager, myStudyId, myStudy, myStudyName
-    global salome_study_ID
-    salome_study_ID = -1
-    myStudyId = getActiveStudy()
-    if not myStudyId:
-      myStudyId = createNewStudy()
-    if verbose(): print "myStudyId",myStudyId
-    myStudy = myStudyManager.GetStudyByID(myStudyId)
-    myStudyName = myStudy._get_Name()
-    return myStudyId, myStudy, myStudyName
-
-    #--------------------------------------------------------------------------
-
-def createNewStudy():
-    global myStudyManager
-    print "createNewStudy"
-    aStudyName = "extStudy"
-    theStudy = myStudyManager.NewStudy(aStudyName)
-    theStudyId = theStudy._get_StudyId()
-    print aStudyName, theStudyId
-    return theStudyId
+    return myStudy, myStudyName
 
     #--------------------------------------------------------------------------
 
 def openStudy(theStudyPath):
-    global myStudyManager
+    global myStudy
     print "openStudy"
-    theStudy = myStudyManager.Open(theStudyPath)
-    theStudyId = theStudy._get_StudyId()
-    print theStudyPath, theStudyId
-    return theStudyId
+    theStudy = myStudy.Open(theStudyPath)
+    theStudyName = theStudy._get_Name()
+    print theStudyPath, theStudyName
+    return theStudyName
+
+    #--------------------------------------------------------------------------
+def clearStudy():
+    global myStudy
+    print "clearStudy"
+    myStudy.Clear()
+    myStudy = None
+    pass
 
     #--------------------------------------------------------------------------
 
@@ -381,40 +310,26 @@ def salome_study_init(theStudyPath=None):
                       create new empty study if there is active study
         <URL> (str) : open study with the given file name
     """
-    global myStudyManager, myStudyId, myStudy, myStudyName
+    global myStudy, myStudyName
     global orb, lcc, naming_service, cm
 
     if verbose(): print "theStudyPath:", theStudyPath
-    if not myStudyManager:
+    if not myStudy:
         orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init()
 
-        # get Study Manager reference
-        if verbose(): print "looking for studyManager ..."
-        obj = naming_service.Resolve('myStudyManager')
-        myStudyManager = obj._narrow(SALOMEDS.StudyManager)
-        if verbose(): print "studyManager found"
+        # get Study reference
+        if verbose(): print "looking for study..."
+        obj = naming_service.Resolve('Study')
+        myStudy = obj._narrow(SALOMEDS.Study)
+        if verbose(): print "Study found"
         pass
 
-    # get active study Id, ref and name
-    myStudy = None
-    myStudyId = getActiveStudy()
-    if myStudyId == None :
-        import types
-        if theStudyPath and type(theStudyPath) == types.StringType:
-            myStudyId = openStudy(theStudyPath)
-        else:
-            myStudyId = createNewStudy()
-    if verbose(): print "myStudyId", myStudyId
-
-    if myStudy == None:
-        myStudy = myStudyManager.GetStudyByID(myStudyId)
+    # get study name
     myStudyName = myStudy._get_Name()
 
-    return myStudyManager, myStudyId, myStudy, myStudyName
+    return myStudy, myStudyName
 
 def salome_study_close():
-    global salome_study_ID
-    global myStudyId, myStudy, myStudyName
-    salome_study_ID = -1
-    myStudyId, myStudy, myStudyName = None, None, None
+    global myStudy, myStudyName
+    myStudy, myStudyName = None, None
     pass
index c70a0f5b357c13f84ed945b5c9c7a059c33bc1e7..5628182c5796ce631904b3c47a6e94dc736e23f8 100755 (executable)
@@ -178,7 +178,7 @@ from salome.smesh import smeshBuilder
 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
 if salome.hasDesktop():
     smeshgui = salome.ImportComponentGUI("SMESH")
-    smeshgui.Init(salome.myStudyId);
+    smeshgui.Init();
 else:
     smesh = smeshBuilder.New(salome.myStudy)
 
index 53fe67af54fff949a236ac2290915f7f8255a1be..61915baf1d3c0a12cdf37c57b167092c2483b44c 100755 (executable)
@@ -262,7 +262,6 @@ f.close()
     # job script
     script_text = """<?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <container name="DefaultContainer">
       <property name="container_kind" value="Salome"/>
       <property name="attached_on_cloning" value="0"/>
@@ -367,7 +366,6 @@ f.close()
     # job script
     script_text = """<?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="myschema">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <type name="bool" kind="bool"/>
    <type name="double" kind="double"/>