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 "SALOME_Container_i.hxx"
#include "SALOME_KernelServices.hxx"
#include "SALOMEDS_Study_i.hxx"
#include <cstring>
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());
}

View File

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

View File

@ -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())
%}

View File

@ -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