PR: geom must be a true singleton

This commit is contained in:
prascle 2013-04-10 14:06:25 +00:00
parent f75fe04874
commit 0370a2b150
2 changed files with 47 additions and 44 deletions

View File

@ -506,7 +506,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
global geom global geom
global doLcc global doLcc
global created global created
#print "__new__ ", engine, geom, doLcc, created #print "==== __new__ ", engine, geom, doLcc, created
if geom is None: if geom is None:
# geom engine is either retrieved from engine, or created # geom engine is either retrieved from engine, or created
geom = engine geom = engine
@ -517,50 +517,53 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
doLcc = False doLcc = False
if doLcc and not created: if doLcc and not created:
doLcc = False doLcc = False
created = True
# FindOrLoadComponent called: # FindOrLoadComponent called:
# 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" )
#print "====1 ",geom
else: else:
# FindOrLoadComponent not called # FindOrLoadComponent not called
if geom is None: if geom is None:
# geomBuilder instance is created from lcc.FindOrLoadComponent # geomBuilder instance is created from lcc.FindOrLoadComponent
created = True #print "==== super ", engine, geom, doLcc, created
#print "super ", engine, geom, doLcc, created
geom = super(geomBuilder,cls).__new__(cls) geom = super(geomBuilder,cls).__new__(cls)
#print "====2 ",geom
else: else:
# geom engine not created: existing engine found # geom engine not created: existing engine found
#print "existing ", engine, geom, doLcc, created #print "==== existing ", engine, geom, doLcc, created
pass pass
#print "return geom 1 ", geom
return geom return geom
#print "return geom 2 ", geom
return geom return geom
def __init__(self): def __init__(self):
#global created global created
#print "-------- geomBuilder __init__ --- ", created, self #print "-------- geomBuilder __init__ --- ", created, self
GEOM._objref_GEOM_Gen.__init__(self) if not created:
self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default created = True
self.myBuilder = None GEOM._objref_GEOM_Gen.__init__(self)
self.myStudyId = 0 self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
self.father = None self.myBuilder = None
self.myStudyId = 0
self.father = None
self.BasicOp = None self.BasicOp = None
self.CurvesOp = None self.CurvesOp = None
self.PrimOp = None self.PrimOp = None
self.ShapesOp = None self.ShapesOp = None
self.HealOp = None self.HealOp = None
self.InsertOp = None self.InsertOp = None
self.BoolOp = None self.BoolOp = None
self.TrsfOp = None self.TrsfOp = None
self.LocalOp = None self.LocalOp = None
self.MeasuOp = None self.MeasuOp = None
self.BlocksOp = None self.BlocksOp = None
self.GroupOp = None self.GroupOp = None
self.AdvOp = None self.AdvOp = None
pass pass
## Process object publication in the study, as follows: ## Process object publication in the study, as follows:

View File

@ -55,23 +55,23 @@ except:
print """ print """
=============================================================================== ===============================================================================
WARNING: | WARNING:
Usage of geompy.py is deprecated after SALOME V7.2! | Usage of geompy.py is deprecated after SALOME V7.2!
geompy.py will be removed in a future version! | geompy.py will be removed in a future version!
TODO: | TODO:
The following changes in your scripts are required to avoid this message: | The following changes in your scripts are required to avoid this message:
|
replace | replace
------- | -------
|
import geompy | import geompy
geompy.init_geom(theStudy) | geompy.init_geom(theStudy)
|
with | with
---- | ----
|
from salome.geom import geomBuilder | from salome.geom import geomBuilder
geompy = geomBuilder.New(theStudy) | geompy = geomBuilder.New(theStudy)
|
=============================================================================== ===============================================================================
""" """