From 0370a2b15076621a24680e8b6e719bc42580c2e3 Mon Sep 17 00:00:00 2001 From: prascle Date: Wed, 10 Apr 2013 14:06:25 +0000 Subject: [PATCH] PR: geom must be a true singleton --- src/GEOM_SWIG/geomBuilder.py | 57 +++++++++++++++++++----------------- src/GEOM_SWIG/geompy.py | 36 +++++++++++------------ 2 files changed, 48 insertions(+), 45 deletions(-) diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 3aedabb4d..4d3c6a5ac 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -506,7 +506,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): global geom global doLcc global created - #print "__new__ ", engine, geom, doLcc, created + #print "==== __new__ ", engine, geom, doLcc, created if geom is None: # geom engine is either retrieved from engine, or created geom = engine @@ -517,50 +517,53 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): doLcc = False if doLcc and not created: doLcc = False - created = True # FindOrLoadComponent called: # 1. CORBA resolution of server # 2. the __new__ method is called again - #print "FindOrLoadComponent ", engine, geom, doLcc, created + #print "==== FindOrLoadComponent ", engine, geom, doLcc, created geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" ) + #print "====1 ",geom else: # FindOrLoadComponent not called if geom is None: # 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) + #print "====2 ",geom else: # geom engine not created: existing engine found - #print "existing ", engine, geom, doLcc, created + #print "==== existing ", engine, geom, doLcc, created pass - + #print "return geom 1 ", geom return geom + #print "return geom 2 ", geom return geom def __init__(self): - #global created + global created #print "-------- geomBuilder __init__ --- ", created, self - GEOM._objref_GEOM_Gen.__init__(self) - self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default - self.myBuilder = None - self.myStudyId = 0 - self.father = None - - self.BasicOp = None - self.CurvesOp = None - self.PrimOp = None - self.ShapesOp = None - self.HealOp = None - self.InsertOp = None - self.BoolOp = None - self.TrsfOp = None - self.LocalOp = None - self.MeasuOp = None - self.BlocksOp = None - self.GroupOp = None - self.AdvOp = None + if not created: + created = True + GEOM._objref_GEOM_Gen.__init__(self) + self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default + self.myBuilder = None + self.myStudyId = 0 + self.father = None + + self.BasicOp = None + self.CurvesOp = None + self.PrimOp = None + self.ShapesOp = None + self.HealOp = None + self.InsertOp = None + self.BoolOp = None + self.TrsfOp = None + self.LocalOp = None + self.MeasuOp = None + self.BlocksOp = None + self.GroupOp = None + self.AdvOp = None pass ## Process object publication in the study, as follows: diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index a84a87dd2..ff41828e4 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -55,23 +55,23 @@ except: print """ =============================================================================== -WARNING: | -Usage of geompy.py is deprecated after SALOME V7.2! | -geompy.py will be removed in a future version! | -TODO: | -The following changes in your scripts are required to avoid this message: | - | -replace | -------- | - | -import geompy | -geompy.init_geom(theStudy) | - | -with | ----- | - | -from salome.geom import geomBuilder | -geompy = geomBuilder.New(theStudy) | - | +WARNING: +Usage of geompy.py is deprecated after SALOME V7.2! +geompy.py will be removed in a future version! +TODO: +The following changes in your scripts are required to avoid this message: + +replace +------- + +import geompy +geompy.init_geom(theStudy) + +with +---- + +from salome.geom import geomBuilder +geompy = geomBuilder.New(theStudy) + =============================================================================== """ -- 2.39.2