]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Allow to find an object ior in a study in sessionless mode cbr/sessionless_orb_study
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Tue, 9 Mar 2021 15:42:47 +0000 (16:42 +0100)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Thu, 11 Mar 2021 14:53:16 +0000 (15:53 +0100)
Do not init the study in session-less mode

src/KERNEL_PY/__init__.py
src/KERNEL_PY/salome_study.py

index 0d7603e058e1c804a67e780013c507ac0d61920d..ef18851c85aa97819b3b66d2dd0a83447d38e8fb 100644 (file)
@@ -205,6 +205,7 @@ def salome_init_without_session():
     poaManager = poa._get_the_POAManager()
     poaManager.activate()
     sg = SalomeOutsideGUI()
+    salome_study_init_without_session()
 
 def salome_init_with_session(path=None, embedded=False):
     """
index bf6a529869e45f042ee5cf32088b0197416fb30b..0d1ba67da070bd3210b167ce02a0b542f2df142e 100644 (file)
@@ -279,6 +279,35 @@ def openStudy(theStudyPath):
 
     #--------------------------------------------------------------------------
 
+def salome_study_init_without_session(theStudyPath=None):
+    """
+    Performs only once study creation or connection.
+    optional argument : theStudyPath
+        None        : attach to the currently active single study;
+                      create new empty study if there is active study
+        <URL> (str) : open study with the given file name
+    """
+    global myStudy, myStudyName
+    global orb, lcc, naming_service, cm
+
+    if verbose(): print("theStudyPath:", theStudyPath)
+    if not myStudy:
+        import CORBA
+        orb = CORBA.ORB_init([''])
+
+        # get Study reference
+        if verbose(): print("looking for study...")
+        import KernelDS
+        myStudy = KernelDS.myStudy()
+        if verbose(): print("Study found")
+        pass
+
+    myStudyName = myStudy._get_Name()
+
+    return myStudy, myStudyName
+
+    #--------------------------------------------------------------------------
+
 def salome_study_init(theStudyPath=None):
     """
     Performs only once study creation or connection.