Salome HOME
Provide icons for objects in object browser
authorvsv <vsv@opencascade.com>
Tue, 24 Dec 2019 08:19:14 +0000 (11:19 +0300)
committervsv <vsv@opencascade.com>
Tue, 24 Dec 2019 08:19:14 +0000 (11:19 +0300)
CMakeLists.txt
resources/CMakeLists.txt
resources/SHAPERSTUDY_images.ts [new file with mode: 0644]
resources/compsolid.png [new file with mode: 0644]
resources/edge.png [new file with mode: 0644]
resources/face.png [new file with mode: 0644]
resources/shell.png [new file with mode: 0644]
resources/solid.png [new file with mode: 0644]
resources/vertex.png [new file with mode: 0644]
resources/wire.png [new file with mode: 0644]
src/PY/SHAPERSTUDY.py

index 758ece0c3fa4d0033b64378e163a9b46abba2543..87b80c48a3f3e6520da1116045971dc6f2902c17 100644 (file)
@@ -85,6 +85,7 @@ FIND_PACKAGE(SalomePythonLibs REQUIRED)
 FIND_PACKAGE(SalomeOmniORB REQUIRED)
 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
 FIND_PACKAGE(SalomeSWIG REQUIRED)
+FIND_PACKAGE(SalomeQt5 REQUIRED)
 
 # Find GUI
 # ===========
index 57537f970872b5e0190916cad88584228737c248..5f472ad6046417ee3a8e2a6f2ad3f81572986971 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+INCLUDE(UseQtExt)
+
+
 SET(SHAPERSTUDY_RESOURCES_FILES
-  shaper.png
+    compsolid.png
+    edge.png
+    face.png
+    shaper.png
+    shell.png
+    solid.png
+    vertex.png
+    wire.png
+)
+
+SET(_ts_RESOURCES
+    SHAPERSTUDY_images.ts
 )
 
+
+
 INSTALL(FILES ${SHAPERSTUDY_RESOURCES_FILES} DESTINATION ${SALOME_SHAPERSTUDY_INSTALL_RES_DATA})
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_SHAPERSTUDY_INSTALL_RES_DATA}")
 
 SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml INSTALL ${SALOME_SHAPERSTUDY_INSTALL_RES_DATA})
 SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SHAPERSTUDYCatalog.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SHAPERSTUDYCatalog.xml INSTALL ${SALOME_SHAPERSTUDY_INSTALL_RES_DATA})
diff --git a/resources/SHAPERSTUDY_images.ts b/resources/SHAPERSTUDY_images.ts
new file mode 100644 (file)
index 0000000..4598464
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+    <context>
+        <name>@default</name>
+        <message>
+            <source>SHAPER_ICON_SOLID</source>
+            <translation>solid.png</translation>
+        </message>
+        <message>
+            <source>SHAPER_ICON_COMPSOLID</source>
+            <translation>compsolid.png</translation>
+        </message>
+        <message>
+            <source>SHAPER_ICON_FACE</source>
+            <translation>face.png</translation>
+        </message>
+        <message>
+            <source>SHAPER_ICON_EDGE</source>
+            <translation>edge.png</translation>
+        </message>
+        <message>
+            <source>SHAPER_ICON_SHELL</source>
+            <translation>shell.png</translation>
+        </message>
+        <message>
+            <source>SHAPER_ICON_VERTEX</source>
+            <translation>vertex.png</translation>
+        </message>
+        <message>
+            <source>SHAPER_ICON_WIRE</source>
+            <translation>wire.png</translation>
+        </message>
+    </context>
+</TS>
diff --git a/resources/compsolid.png b/resources/compsolid.png
new file mode 100644 (file)
index 0000000..6a16570
Binary files /dev/null and b/resources/compsolid.png differ
diff --git a/resources/edge.png b/resources/edge.png
new file mode 100644 (file)
index 0000000..4970612
Binary files /dev/null and b/resources/edge.png differ
diff --git a/resources/face.png b/resources/face.png
new file mode 100644 (file)
index 0000000..6abc697
Binary files /dev/null and b/resources/face.png differ
diff --git a/resources/shell.png b/resources/shell.png
new file mode 100644 (file)
index 0000000..5144ea8
Binary files /dev/null and b/resources/shell.png differ
diff --git a/resources/solid.png b/resources/solid.png
new file mode 100644 (file)
index 0000000..dbffe4c
Binary files /dev/null and b/resources/solid.png differ
diff --git a/resources/vertex.png b/resources/vertex.png
new file mode 100644 (file)
index 0000000..6795c4c
Binary files /dev/null and b/resources/vertex.png differ
diff --git a/resources/wire.png b/resources/wire.png
new file mode 100644 (file)
index 0000000..87b8556
Binary files /dev/null and b/resources/wire.png differ
index ca876e72f57b93c14f0ac932a4c40f6005bf81d3..a1a3be30fd9a95b12b69454c86d19b4dae9f2249 100644 (file)
@@ -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)