1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
\r
3 <!-- hennerik CVSweb $Revision$ -->
\r
4 <TITLE>Example</TITLE></HEAD>
\r
5 <BODY BGCOLOR="#eeeeee">
\r
6 <HR noshade><PRE>#%Test AttributeTextHighlightColor interface(creations/saving/restoring)%
\r
7 #%SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open%
\r
8 #%Attribute methods : SetTextHighlightColor TextHighlightColor%
\r
10 #--------------------------------------------------------------------------
\r
11 # create AttributeTextHighlightColor
\r
12 #===========================================================
\r
14 import SALOMEDS_Attributes_idl
\r
15 highlightcolor=SALOMEDS_Attributes_idl._0_SALOMEDS.Color(256,256,256)
\r
17 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeTextHighlightColor")
\r
20 raise RuntimeError, "Can't create AttributeTextHighlightColor attribute"
\r
21 A = A._narrow(SALOMEDS.AttributeTextHighlightColor)
\r
24 raise RuntimeError, "Can't create AttributeTextHighlightColor attribute"
\r
26 A.SetTextHighlightColor(highlightcolor)
\r
28 c = A.TextHighlightColor();
\r
29 if c.R != 256 or c.G != 256 or c.B != 256:
\r
30 print "Error: wrong value of AttributeTextHighlightColor"
\r
33 # save / restore study
\r
34 #============================================================
\r
35 str= os.getenv("TmpDir")
\r
37 str = "/tmp"
\r
38 file = str+"/test.hdf"
\r
40 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
\r
41 openedStudy=batchmode_geompy.myStudyManager.Open(file);
\r
43 if openedStudy == None:
\r
44 raise RuntimeError, "Can't open saved study!"
\r
46 father = openedStudy.FindComponent("GEOM")
\r
48 raise RuntimeError, "Geom component is not found! Wrong study is opened."
\r
51 # find AttributeTextHighlightColor
\r
52 #============================================================
\r
54 res, A = father.FindAttribute("AttributeTextHighlightColor")
\r
56 if res == 0 or A == None:
\r
57 raise RuntimeError, "Error: not found AttributeTextHighlightColor"
\r
59 A = A._narrow(SALOMEDS.AttributeTextHighlightColor)
\r
62 raise RuntimeError, "Can't create AttributeTextHighlightColor attribute"
\r
64 c = A.TextHighlightColor();
\r
66 if c.R != 256 or c.G != 256 or c.B != 256:
\r
67 print "Error: wrong value of AttributeTextTextHighlightColor"
\r