Salome HOME
Merge branch 'V7_3_1_BR'
[samples/datafiles.git] / Superv / Python / test_events.py
1 # Copyright (C) 2007-2014  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, or (at your option) any later version.
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
23 # Generated python file of Graph aNewDataFlow
24 #
25 from SuperV import *
26 # Graph creation 
27 aNewDataFlow = Graph( 'aNewDataFlow' )
28 aNewDataFlow.SetName( 'aNewDataFlow' )
29 aNewDataFlow.SetAuthor( '' )
30 aNewDataFlow.SetComment( '' )
31 aNewDataFlow.Coords( 0 , 0 )
32
33 # Creation of Factory Nodes
34
35 # Creation of InLine Nodes
36 PyFunc = []
37 PyFunc.append( 'def Func( A ):     ' )
38 PyFunc.append( '  import batchmode_visu  ' )
39 PyFunc.append( '  batchmode_visu.myVisu.CreateTestView()   ' )
40 PyFunc.append( '  batchmode_visu.myVisu.ShowTestObject()   ' )
41 PyFunc.append( '  return A     ' )
42 Func = aNewDataFlow.INode( 'Func' , PyFunc )
43 Func.SetName( 'Func' )
44 Func.SetAuthor( '' )
45 Func.SetComment( 'Compute Node' )
46 Func.Coords( 375 , 162 )
47 Func.InPort( 'A' , 'int' )
48 Func.OutPort( 'B' , 'int' )
49
50 # Creation of Loop Nodes
51 PyInit = []
52 PyInit.append( 'def Init( A ):   ' )
53 PyInit.append( '  return A   ' )
54 PyMoreInit = []
55 PyMoreInit.append( 'def More( A ):   ' )
56 PyMoreInit.append( '  if A < 10:   ' )
57 PyMoreInit.append( '    return 1,A   ' )
58 PyMoreInit.append( '  return 0,A   ' )
59 PyNextInit = []
60 PyNextInit.append( 'def Next( A ):   ' )
61 PyNextInit.append( '  return (A + 1)   ' )
62 Init,EndInit = aNewDataFlow.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
63 EndInit.SetName( 'EndInit' )
64 EndInit.SetAuthor( '' )
65 EndInit.SetComment( '' )
66 EndInit.Coords( 740 , 168 )
67 PyEndInit = []
68 EndInit.SetPyFunction( 'EndInit' , PyEndInit )
69 Init.SetName( 'Init' )
70 Init.SetAuthor( '' )
71 Init.SetComment( '' )
72 Init.Coords( 118 , 160 )
73 Init.InPort( 'A' , 'int' )
74 Init.OutPort( 'A' , 'int' )
75
76 # Creation of Links
77 InitA = Init.Port( 'A' )
78 FuncA = aNewDataFlow.Link( InitA , Func.Port( 'A' ) )
79
80 FuncB = Func.Port( 'B' )
81 EndInitA = aNewDataFlow.Link( FuncB , EndInit.Port( 'A' ) )
82
83 # Creation of Input datas
84 InitA = Init.Input( 'A' , 0)
85
86 # Creation of Output variables
87 EndInitA = EndInit.Port( 'A' )