From c72bb434a335a192526a6f52b13a2138fd1d9045 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Wed, 28 Aug 2019 14:06:52 +0200 Subject: [PATCH] Easy access to the shared dataserver manager from SALOME client --- src/KERNEL_PY/__init__.py | 7 ++++--- src/KERNEL_PY/salome_kernel.py | 8 ++++++-- src/KERNEL_PY/salome_study.py | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/KERNEL_PY/__init__.py b/src/KERNEL_PY/__init__.py index 4ac646bcc..70c310e6e 100644 --- a/src/KERNEL_PY/__init__.py +++ b/src/KERNEL_PY/__init__.py @@ -161,7 +161,7 @@ if not flags: # sys.setdlopenflags(flags) # pass -orb, lcc, naming_service, cm, sg, esm = None,None,None,None,None,None +orb, lcc, naming_service, cm, sg, esm, dsm = None,None,None,None,None,None,None myStudy, myStudyName = None,None salome_initial=True @@ -174,12 +174,13 @@ def salome_init(path=None, embedded=False): naming_service a naming service instance cm reference to the container manager esm reference to external server manager + dsm reference to shared dataserver manager sg access to SALOME GUI (when linked with IAPP GUI) myStudy active study itself (CORBA reference) myStudyName active study name """ global salome_initial - global orb, lcc, naming_service, cm, esm + global orb, lcc, naming_service, cm, esm, dsm global sg global myStudy, myStudyName @@ -187,7 +188,7 @@ def salome_init(path=None, embedded=False): if salome_initial: salome_initial=False sg = salome_iapp_init(embedded) - orb, lcc, naming_service, cm, esm = salome_kernel_init() + orb, lcc, naming_service, cm, esm, dsm = salome_kernel_init() myStudy, myStudyName = salome_study_init(path) pass pass diff --git a/src/KERNEL_PY/salome_kernel.py b/src/KERNEL_PY/salome_kernel.py index 098d2d9f2..371262ced 100644 --- a/src/KERNEL_PY/salome_kernel.py +++ b/src/KERNEL_PY/salome_kernel.py @@ -38,9 +38,10 @@ lcc = None naming_service = None cm = None esm = None +dsm = None def salome_kernel_init(): - global orb, lcc, naming_service, cm, esm + global orb, lcc, naming_service, cm, esm, dsm if not orb: # initialise the ORB @@ -58,5 +59,8 @@ def salome_kernel_init(): # get External Server Manager obj = naming_service.Resolve('/ExternalServers') esm = obj._narrow(SALOME.ExternalServerLauncher) + # + obj = naming_service.Resolve('/DataServerManager') + dsm = obj._narrow(SALOME.DataServerManager) - return orb, lcc, naming_service, cm, esm + return orb, lcc, naming_service, cm, esm, dsm diff --git a/src/KERNEL_PY/salome_study.py b/src/KERNEL_PY/salome_study.py index b2574c66c..f1612e7e1 100644 --- a/src/KERNEL_PY/salome_study.py +++ b/src/KERNEL_PY/salome_study.py @@ -292,7 +292,7 @@ def salome_study_init(theStudyPath=None): if verbose(): print("theStudyPath:", theStudyPath) if not myStudy: - orb, lcc, naming_service, cm, _ = salome_kernel.salome_kernel_init() + orb, lcc, naming_service, cm, _, _ = salome_kernel.salome_kernel_init() # get Study reference if verbose(): print("looking for study...") -- 2.39.2