Move Python Study ref creation to KERNEL

This commit is contained in:
Anthony Geay 2021-01-16 07:37:03 +01:00
parent 9596745007
commit a393dfe87b
4 changed files with 4 additions and 32 deletions

View File

@ -22,11 +22,9 @@
#include "GEOM_Gen_i.hh" #include "GEOM_Gen_i.hh"
#include "SALOME_Container_i.hxx" #include "SALOME_Container_i.hxx"
#include "SALOME_KernelServices.hxx" #include "SALOME_KernelServices.hxx"
#include "SALOMEDS_Study_i.hxx"
#include <cstring> #include <cstring>
std::string BuildGEOMInstance() std::string BuildGEOMInstance()
{ {
CORBA::ORB_var orb; CORBA::ORB_var orb;
@ -56,11 +54,3 @@ std::string BuildGEOMInstance()
CORBA::String_var ior = orb->object_to_string(zeRef); CORBA::String_var ior = orb->object_to_string(zeRef);
return std::string(ior.in()); 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());
}

View File

@ -19,5 +19,4 @@
#include <string> #include <string>
std::string BuildGEOMInstance(); std::string BuildGEOMInstance();
std::string GetSessionInstance();

View File

@ -24,14 +24,4 @@
%inline %inline
{ {
std::string BuildGEOMInstance(); std::string BuildGEOMInstance();
std::string GetSessionInstance();
} }
%pythoncode %{
def myStudy():
import SALOMEDS
import CORBA
orb=CORBA.ORB_init([''])
return orb.string_to_object(GetSessionInstance())
%}

View File

@ -246,7 +246,7 @@ import omniORB
# to avoid problems in some cases, e.g. when generating documentation # to avoid problems in some cases, e.g. when generating documentation
try: try:
import salome import salome
#salome.salome_init() salome.salome_init()
from salome import * from salome import *
except: except:
pass pass
@ -705,13 +705,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# 1. CORBA resolution of server # 1. CORBA resolution of server
# 2. the __new__ method is called again # 2. the __new__ method is called again
#print "==== FindOrLoadComponent ", engine, geom, doLcc, created #print "==== FindOrLoadComponent ", engine, geom, doLcc, created
#geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" ) 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)
#print "====1 ",geom #print "====1 ",geom
else: else:
# FindOrLoadComponent not called # FindOrLoadComponent not called
@ -837,8 +831,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
## @addtogroup l1_geomBuilder_auxiliary ## @addtogroup l1_geomBuilder_auxiliary
## @{ ## @{
def init_geom(self): def init_geom(self):
import GeomHelper self.myStudy = salome.myStudy
self.myStudy = GeomHelper.myStudy()
self.myBuilder = self.myStudy.NewBuilder() self.myBuilder = self.myStudy.NewBuilder()
# load data from the study file, if necessary # load data from the study file, if necessary