X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPY%2FSHAPERSTUDY.py;h=a1a3be30fd9a95b12b69454c86d19b4dae9f2249;hb=38a9445e4b2f7995c08e031e300c6ba688eecbd5;hp=ca876e72f57b93c14f0ac932a4c40f6005bf81d3;hpb=08d0277ef0a80940d3158dc16d465ef22e7229ac;p=modules%2Fshaper_study.git diff --git a/src/PY/SHAPERSTUDY.py b/src/PY/SHAPERSTUDY.py index ca876e7..a1a3be3 100644 --- a/src/PY/SHAPERSTUDY.py +++ b/src/PY/SHAPERSTUDY.py @@ -28,15 +28,28 @@ import SALOMEDS from SHAPERSTUDY_utils import findOrCreateComponent, moduleName, getStudy, getORB import salome import SHAPERSTUDY_Object +import GEOM __entry2IOR__ = {} + class SHAPERSTUDY(SHAPERSTUDY_ORB__POA.Gen, SALOME_ComponentPy.SALOME_ComponentPy_i, SALOME_DriverPy.SALOME_DriverPy_i): ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8, "FLAT":9} + + ShaperIcons = {GEOM.COMPOUND:"SHAPER_ICON_COMPSOLID", + GEOM.COMPSOLID:"SHAPER_ICON_COMPSOLID", + GEOM.SOLID:"SHAPER_ICON_SOLID", + GEOM.SHELL:"SHAPER_ICON_SHELL", + GEOM.FACE:"SHAPER_ICON_FACE", + GEOM.WIRE:"SHAPER_ICON_WIRE", + GEOM.EDGE:"SHAPER_ICON_EDGE", + GEOM.VERTEX:"SHAPER_ICON_VERTEX", + GEOM.SHAPE:"SHAPER_ICON_SOLID", + GEOM.FLAT:"SHAPER_ICON_FACE"} def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ): """ @@ -86,10 +99,18 @@ class SHAPERSTUDY(SHAPERSTUDY_ORB__POA.Gen, theFather = findOrCreateComponent() aResultSO = aBuilder.NewObject(theFather); aResultSO.SetAttrString("AttributeName", theName) - if theObject: - anIOR = salome.orb.object_to_string(theObject) - aResultSO.SetAttrString("AttributeIOR", anIOR) - theObject.SetSO(aResultSO) + + + if theObject is not None: + anIOR = salome.orb.object_to_string(theObject) + aResultSO.SetAttrString("AttributeIOR", anIOR) + theObject.SetSO(aResultSO) + + aType = theObject.GetShapeType() + aAttr = aBuilder.FindOrCreateAttribute(aResultSO, "AttributePixMap") + aPixmap = aAttr._narrow(salome.SALOMEDS.AttributePixMap) + aPixmap.SetPixMap(SHAPERSTUDY.ShaperIcons[aType]) + # add a red-reference that means that this is an active reference to SHAPER result aSub = aBuilder.NewObject(aResultSO) aBuilder.Addreference(aSub, aResultSO)