Salome HOME
Initial version
[modules/gui.git] / src / SALOME_SWIG / testattr.py
1 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3
4 #  This library is free software; you can redistribute it and/or 
5 #  modify it under the terms of the GNU Lesser General Public 
6 #  License as published by the Free Software Foundation; either 
7 #  version 2.1 of the License. 
8
9 #  This library is distributed in the hope that it will be useful, 
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 #  Lesser General Public License for more details. 
13
14 #  You should have received a copy of the GNU Lesser General Public 
15 #  License along with this library; if not, write to the Free Software 
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17
18 #  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 #
20 #
21 #
22 #  File   : testattr.py
23 #  Module : SALOME
24
25 import SALOMEDS
26 #import SALOMEDS_Attributes_idl
27 import geompy
28 import salome
29 # ===============================================================
30
31 # creating new object ===========================================
32 obj = geompy.myBuilder.NewObject(geompy.father)
33
34 # adding Name attribute =========================================
35 A1 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeName")
36 name = A1._narrow(SALOMEDS.AttributeName)
37 name.SetValue("First Object")
38
39 # adding Comment attribute ======================================
40 A2 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeComment")
41 comment = A2._narrow(SALOMEDS.AttributeComment)
42 comment.SetValue("This is Comment attribute")
43
44 # adding IOR attribute ==========================================
45 #A3 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeIOR")
46 # ...
47
48 # adding integer attribute ======================================
49 A4 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeInteger")
50 integer = A4._narrow(SALOMEDS.AttributeInteger)
51 integer.SetValue(12)
52
53 # adding real attribute =========================================
54 A5 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeReal")
55 real = A5._narrow(SALOMEDS.AttributeReal)
56 real.SetValue(0.25)
57
58 # adding sequence of integer attribute ==========================
59 A6 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeSequenceOfInteger")
60 intseq = A6._narrow(SALOMEDS.AttributeSequenceOfInteger)
61 intseq.Add(1)
62 intseq.Add(2)
63 intseq.Add(3)
64
65
66 # adding sequence of real attribute =============================
67 A7 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeSequenceOfReal")
68 realseq = A7._narrow(SALOMEDS.AttributeSequenceOfReal)
69 realseq.Add(0.001)
70 realseq.Add(0.002)
71 realseq.Add(0.003)
72
73 # adding PersistentRef attribute ================================
74 #A8 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributePersistentRef")
75 # ...
76
77 # adding Drawable attribute =====================================
78 A9 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeDrawable")
79 drawable = A9._narrow(SALOMEDS.AttributeDrawable)
80 drawable.SetDrawable(1)
81
82 # adding Selectable attribute ===================================
83 #A10 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeSelectable")
84 # ...
85
86 # adding Expandable attribute ===================================
87 #A11 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeExpandable")
88 # ...
89
90 # adding Opened attribute =======================================
91 #A12 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeOpened")
92 # ...
93
94 # adding TextColor attribute ====================================
95 A13 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeTextColor")
96 textcolor = A13._narrow(SALOMEDS.AttributeTextColor)
97
98 # ...
99
100 # adding TextHighlightColor of real attribute ===================
101 #A14 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeTextHighlightColor")
102 # ...
103
104 # adding PixMap of real attribute ===============================
105 #A15 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributePixMap")
106 # ...
107
108 # opening OCAF Browser ==========================================
109 # result = salome.myStudy.OCAFBrowser()