Salome HOME
Merge from V6_main_20120808 08Aug12
[samples/datafiles.git] / Superv / Python / test_events.py
1 #  Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 # Generated python file of Graph aNewDataFlow
23 #
24 from SuperV import *
25 # Graph creation 
26 aNewDataFlow = Graph( 'aNewDataFlow' )
27 aNewDataFlow.SetName( 'aNewDataFlow' )
28 aNewDataFlow.SetAuthor( '' )
29 aNewDataFlow.SetComment( '' )
30 aNewDataFlow.Coords( 0 , 0 )
31
32 # Creation of Factory Nodes
33
34 # Creation of InLine Nodes
35 PyFunc = []
36 PyFunc.append( 'def Func( A ):     ' )
37 PyFunc.append( '  import batchmode_visu  ' )
38 PyFunc.append( '  batchmode_visu.myVisu.CreateTestView()   ' )
39 PyFunc.append( '  batchmode_visu.myVisu.ShowTestObject()   ' )
40 PyFunc.append( '  return A     ' )
41 Func = aNewDataFlow.INode( 'Func' , PyFunc )
42 Func.SetName( 'Func' )
43 Func.SetAuthor( '' )
44 Func.SetComment( 'Compute Node' )
45 Func.Coords( 375 , 162 )
46 Func.InPort( 'A' , 'int' )
47 Func.OutPort( 'B' , 'int' )
48
49 # Creation of Loop Nodes
50 PyInit = []
51 PyInit.append( 'def Init( A ):   ' )
52 PyInit.append( '  return A   ' )
53 PyMoreInit = []
54 PyMoreInit.append( 'def More( A ):   ' )
55 PyMoreInit.append( '  if A < 10:   ' )
56 PyMoreInit.append( '    return 1,A   ' )
57 PyMoreInit.append( '  return 0,A   ' )
58 PyNextInit = []
59 PyNextInit.append( 'def Next( A ):   ' )
60 PyNextInit.append( '  return (A + 1)   ' )
61 Init,EndInit = aNewDataFlow.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
62 EndInit.SetName( 'EndInit' )
63 EndInit.SetAuthor( '' )
64 EndInit.SetComment( '' )
65 EndInit.Coords( 740 , 168 )
66 PyEndInit = []
67 EndInit.SetPyFunction( 'EndInit' , PyEndInit )
68 Init.SetName( 'Init' )
69 Init.SetAuthor( '' )
70 Init.SetComment( '' )
71 Init.Coords( 118 , 160 )
72 Init.InPort( 'A' , 'int' )
73 Init.OutPort( 'A' , 'int' )
74
75 # Creation of Links
76 InitA = Init.Port( 'A' )
77 FuncA = aNewDataFlow.Link( InitA , Func.Port( 'A' ) )
78
79 FuncB = Func.Port( 'B' )
80 EndInitA = aNewDataFlow.Link( FuncB , EndInit.Port( 'A' ) )
81
82 # Creation of Input datas
83 InitA = Init.Input( 'A' , 0)
84
85 # Creation of Output variables
86 EndInitA = EndInit.Port( 'A' )