-# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
"modulePixmap",
"verbose",
"getORB",
- "getNS",
"getLCC",
- "getStudy",
"getEngine",
+ "getStudy",
"getEngineIOR",
"findOrCreateComponent",
"getObjectID",
]
+
from omniORB import CORBA
from SALOME_NamingServicePy import SALOME_NamingServicePy_i
from LifeCycleCORBA import LifeCycleCORBA
+import salome
import SALOMEDS
import SALOMEDS_Attributes_idl
import PYHELLO_ORB
###
# Get ORB reference
###
-__orb__ = None
def getORB():
- global __orb__
- if __orb__ is None:
- __orb__ = CORBA.ORB_init( [''], CORBA.ORB_ID )
- pass
- return __orb__
-
-###
-# Get naming service instance
-###
-__naming_service__ = None
-def getNS():
- global __naming_service__
- if __naming_service__ is None:
- __naming_service__ = SALOME_NamingServicePy_i( getORB() )
- pass
- return __naming_service__
+ salome.salome_init()
+ return salome.orb
##
# Get life cycle CORBA instance
##
-__lcc__ = None
def getLCC():
- global __lcc__
- if __lcc__ is None:
- __lcc__ = LifeCycleCORBA( getORB() )
- pass
- return __lcc__
+ salome.salome_init()
+ return salome.lcc
##
# Get study
###
-__study__ = None
def getStudy():
- global __study__
- if __study__ is None:
- obj = getNS().Resolve( '/Study' )
- __study__ = obj._narrow( SALOMEDS.Study )
- pass
- return __study__
+ salome.salome_init()
+ return salome.myStudy
###
# Get PYHELLO engine
def getEngine():
global __engine__
if __engine__ is None:
- __engine__ = getLCC().FindOrLoadComponent( "FactoryServerPy", moduleName() )
+ __engine__ = getLCC().FindOrLoadComponent( "FactoryServer", moduleName() )
pass
return __engine__
###
# Find or create PYHELLO component object in a study
###
-def findOrCreateComponent( study ):
- father = study.FindComponent( moduleName() )
+def findOrCreateComponent():
+ study = getStudy()
+ father =study.FindComponent( moduleName() )
if father is None:
builder = study.NewBuilder()
father = builder.NewComponent( moduleName() )
###
# Get object's ID
###
-def getObjectID( study, entry ):
+def getObjectID( entry ):
ID = unknownID()
- if study and entry:
+ study = getStudy()
+ if entry:
sobj = study.FindObjectID( entry )
if sobj is not None:
test, anAttr = sobj.FindAttribute( "AttributeLocalID" )