From: Anthony Geay Date: Sat, 16 Jan 2021 06:37:03 +0000 (+0100) Subject: Move Python Study ref creation to KERNEL X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a393dfe87bcd238f778d73989127da36d78a7af3;p=modules%2Fgeom.git Move Python Study ref creation to KERNEL --- diff --git a/src/GEOM_SWIG/GeomHelper.cxx b/src/GEOM_SWIG/GeomHelper.cxx index f971360be..ba89a1223 100644 --- a/src/GEOM_SWIG/GeomHelper.cxx +++ b/src/GEOM_SWIG/GeomHelper.cxx @@ -22,11 +22,9 @@ #include "GEOM_Gen_i.hh" #include "SALOME_Container_i.hxx" #include "SALOME_KernelServices.hxx" -#include "SALOMEDS_Study_i.hxx" #include - std::string BuildGEOMInstance() { CORBA::ORB_var orb; @@ -56,11 +54,3 @@ std::string BuildGEOMInstance() CORBA::String_var ior = orb->object_to_string(zeRef); return std::string(ior.in()); } - -std::string GetSessionInstance() -{ - SALOMEDS::Study_var study = KERNEL::getStudyServantSA(); - CORBA::ORB_ptr orb = KERNEL::getORB(); - CORBA::String_var ior = orb->object_to_string(study); - return std::string(ior.in()); -} diff --git a/src/GEOM_SWIG/GeomHelper.h b/src/GEOM_SWIG/GeomHelper.h index 0224e0c1f..92676977c 100644 --- a/src/GEOM_SWIG/GeomHelper.h +++ b/src/GEOM_SWIG/GeomHelper.h @@ -19,5 +19,4 @@ #include -std::string BuildGEOMInstance(); -std::string GetSessionInstance(); \ No newline at end of file +std::string BuildGEOMInstance(); \ No newline at end of file diff --git a/src/GEOM_SWIG/GeomHelper.i b/src/GEOM_SWIG/GeomHelper.i index 735be9c2d..64d70cad9 100644 --- a/src/GEOM_SWIG/GeomHelper.i +++ b/src/GEOM_SWIG/GeomHelper.i @@ -24,14 +24,4 @@ %inline { std::string BuildGEOMInstance(); - std::string GetSessionInstance(); } -%pythoncode %{ - -def myStudy(): - import SALOMEDS - import CORBA - orb=CORBA.ORB_init(['']) - return orb.string_to_object(GetSessionInstance()) - -%} \ No newline at end of file diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 0974aed98..a4c2d26fa 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -246,7 +246,7 @@ import omniORB # to avoid problems in some cases, e.g. when generating documentation try: import salome - #salome.salome_init() + salome.salome_init() from salome import * except: pass @@ -705,13 +705,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # 1. CORBA resolution of server # 2. the __new__ method is called again #print "==== FindOrLoadComponent ", engine, geom, doLcc, created - #geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" ) - import GeomHelper - geom_ior = GeomHelper.BuildGEOMInstance() - import GEOM - import CORBA - orb=CORBA.ORB_init(['']) - geom = orb.string_to_object(geom_ior) + geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" ) #print "====1 ",geom else: # FindOrLoadComponent not called @@ -837,8 +831,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): ## @addtogroup l1_geomBuilder_auxiliary ## @{ def init_geom(self): - import GeomHelper - self.myStudy = GeomHelper.myStudy() + self.myStudy = salome.myStudy self.myBuilder = self.myStudy.NewBuilder() # load data from the study file, if necessary