From: Christophe Bourcier Date: Tue, 9 Mar 2021 15:42:47 +0000 (+0100) Subject: Allow to find an object ior in a study in sessionless mode X-Git-Tag: V9_7_0a1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=31f02551b4346e45211f095a2135c61f46b0fcbd;p=modules%2Fkernel.git Allow to find an object ior in a study in sessionless mode Do not init the study in session-less mode --- diff --git a/src/KERNEL_PY/__init__.py b/src/KERNEL_PY/__init__.py index 0d7603e05..ef18851c8 100644 --- a/src/KERNEL_PY/__init__.py +++ b/src/KERNEL_PY/__init__.py @@ -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): """ diff --git a/src/KERNEL_PY/salome_study.py b/src/KERNEL_PY/salome_study.py index bf6a52986..0d1ba67da 100644 --- a/src/KERNEL_PY/salome_study.py +++ b/src/KERNEL_PY/salome_study.py @@ -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 + (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.