Skip to content

Commit d9e0e75

Browse files
committed
Closes #1301, closes #1310, closes #1303
1 parent e842c56 commit d9e0e75

File tree

2 files changed

+315
-1
lines changed

2 files changed

+315
-1
lines changed
Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<!DOCTYPE boost_serialization>
3+
<boost_serialization signature="serialization::archive" version="12">
4+
<networkFile class_id="0" tracking_level="0" version="3">
5+
<networkInfo class_id="1" tracking_level="0" version="0">
6+
<modules class_id="2" tracking_level="0" version="0">
7+
<count>3</count>
8+
<item_version>0</item_version>
9+
<item class_id="3" tracking_level="0" version="0">
10+
<first>CreateString:0</first>
11+
<second class_id="4" tracking_level="0" version="0">
12+
<module class_id="5" tracking_level="0" version="0">
13+
<package_name_>SCIRun</package_name_>
14+
<category_name_>String</category_name_>
15+
<module_name_>CreateString</module_name_>
16+
</module>
17+
<state class_id="6" tracking_level="0" version="0">
18+
<stateMap class_id="7" tracking_level="0" version="0">
19+
<count>1</count>
20+
<item_version>0</item_version>
21+
<item class_id="8" tracking_level="0" version="0">
22+
<first class_id="9" tracking_level="0" version="0">
23+
<name>InputString</name>
24+
</first>
25+
<second class_id="10" tracking_level="0" version="0">
26+
<name>InputString</name>
27+
<value class_id="11" tracking_level="0" version="0">
28+
<which>2</which>
29+
<value>y = x</value>
30+
</value>
31+
</second>
32+
</item>
33+
</stateMap>
34+
</state>
35+
</second>
36+
</item>
37+
<item>
38+
<first>InterfaceWithPython:0</first>
39+
<second>
40+
<module>
41+
<package_name_>SCIRun</package_name_>
42+
<category_name_>Python</category_name_>
43+
<module_name_>InterfaceWithPython</module_name_>
44+
</module>
45+
<state>
46+
<stateMap>
47+
<count>13</count>
48+
<item_version>0</item_version>
49+
<item>
50+
<first>
51+
<name>InputString:0</name>
52+
</first>
53+
<second>
54+
<name>InputString:0</name>
55+
<value>
56+
<which>2</which>
57+
<value>x</value>
58+
</value>
59+
</second>
60+
</item>
61+
<item>
62+
<first>
63+
<name>NumberOfRetries</name>
64+
</first>
65+
<second>
66+
<name>NumberOfRetries</name>
67+
<value>
68+
<which>0</which>
69+
<value>50</value>
70+
</value>
71+
</second>
72+
</item>
73+
<item>
74+
<first>
75+
<name>PollingIntervalMilliseconds</name>
76+
</first>
77+
<second>
78+
<name>PollingIntervalMilliseconds</name>
79+
<value>
80+
<which>0</which>
81+
<value>200</value>
82+
</value>
83+
</second>
84+
</item>
85+
<item>
86+
<first>
87+
<name>PythonCode</name>
88+
</first>
89+
<second>
90+
<name>PythonCode</name>
91+
<value>
92+
<which>2</which>
93+
<value># Insert Python code here using the SCIRun API.
94+
y = x</value>
95+
</value>
96+
</second>
97+
</item>
98+
<item>
99+
<first>
100+
<name>PythonOutputField1Name</name>
101+
</first>
102+
<second>
103+
<name>PythonOutputField1Name</name>
104+
<value>
105+
<which>2</which>
106+
<value>fieldOutput1</value>
107+
</value>
108+
</second>
109+
</item>
110+
<item>
111+
<first>
112+
<name>PythonOutputField2Name</name>
113+
</first>
114+
<second>
115+
<name>PythonOutputField2Name</name>
116+
<value>
117+
<which>2</which>
118+
<value>fieldOutput2</value>
119+
</value>
120+
</second>
121+
</item>
122+
<item>
123+
<first>
124+
<name>PythonOutputField3Name</name>
125+
</first>
126+
<second>
127+
<name>PythonOutputField3Name</name>
128+
<value>
129+
<which>2</which>
130+
<value>fieldOutput3</value>
131+
</value>
132+
</second>
133+
</item>
134+
<item>
135+
<first>
136+
<name>PythonOutputMatrix1Name</name>
137+
</first>
138+
<second>
139+
<name>PythonOutputMatrix1Name</name>
140+
<value>
141+
<which>2</which>
142+
<value>matrixOutput1</value>
143+
</value>
144+
</second>
145+
</item>
146+
<item>
147+
<first>
148+
<name>PythonOutputMatrix2Name</name>
149+
</first>
150+
<second>
151+
<name>PythonOutputMatrix2Name</name>
152+
<value>
153+
<which>2</which>
154+
<value>matrixOutput2</value>
155+
</value>
156+
</second>
157+
</item>
158+
<item>
159+
<first>
160+
<name>PythonOutputMatrix3Name</name>
161+
</first>
162+
<second>
163+
<name>PythonOutputMatrix3Name</name>
164+
<value>
165+
<which>2</which>
166+
<value>matrixOutput3</value>
167+
</value>
168+
</second>
169+
</item>
170+
<item>
171+
<first>
172+
<name>PythonOutputString1Name</name>
173+
</first>
174+
<second>
175+
<name>PythonOutputString1Name</name>
176+
<value>
177+
<which>2</which>
178+
<value>y</value>
179+
</value>
180+
</second>
181+
</item>
182+
<item>
183+
<first>
184+
<name>PythonOutputString2Name</name>
185+
</first>
186+
<second>
187+
<name>PythonOutputString2Name</name>
188+
<value>
189+
<which>2</which>
190+
<value>stringOutput2</value>
191+
</value>
192+
</second>
193+
</item>
194+
<item>
195+
<first>
196+
<name>PythonOutputString3Name</name>
197+
</first>
198+
<second>
199+
<name>PythonOutputString3Name</name>
200+
<value>
201+
<which>2</which>
202+
<value>stringOutput3</value>
203+
</value>
204+
</second>
205+
</item>
206+
</stateMap>
207+
</state>
208+
</second>
209+
</item>
210+
<item>
211+
<first>ReportStringInfo:0</first>
212+
<second>
213+
<module>
214+
<package_name_>SCIRun</package_name_>
215+
<category_name_>String</category_name_>
216+
<module_name_>ReportStringInfo</module_name_>
217+
</module>
218+
<state>
219+
<stateMap>
220+
<count>0</count>
221+
<item_version>0</item_version>
222+
</stateMap>
223+
</state>
224+
</second>
225+
</item>
226+
</modules>
227+
<connections class_id="12" tracking_level="0" version="0">
228+
<count>2</count>
229+
<item_version>0</item_version>
230+
<item class_id="13" tracking_level="0" version="0">
231+
<moduleId1_>CreateString:0</moduleId1_>
232+
<port1_ class_id="14" tracking_level="0" version="0">
233+
<name>NewString</name>
234+
<id>0</id>
235+
</port1_>
236+
<moduleId2_>InterfaceWithPython:0</moduleId2_>
237+
<port2_>
238+
<name>InputString</name>
239+
<id>0</id>
240+
</port2_>
241+
</item>
242+
<item>
243+
<moduleId1_>InterfaceWithPython:0</moduleId1_>
244+
<port1_>
245+
<name>PythonString1</name>
246+
<id>0</id>
247+
</port1_>
248+
<moduleId2_>ReportStringInfo:0</moduleId2_>
249+
<port2_>
250+
<name>Input</name>
251+
<id>0</id>
252+
</port2_>
253+
</item>
254+
</connections>
255+
</networkInfo>
256+
<modulePositions class_id="15" tracking_level="0" version="0">
257+
<count>3</count>
258+
<item_version>0</item_version>
259+
<item class_id="16" tracking_level="0" version="0">
260+
<first>CreateString:0</first>
261+
<second class_id="17" tracking_level="0" version="0">
262+
<first>-2.90000000000000000e+002</first>
263+
<second>-3.31000000000000000e+002</second>
264+
</second>
265+
</item>
266+
<item>
267+
<first>InterfaceWithPython:0</first>
268+
<second>
269+
<first>-2.89000000000000000e+002</first>
270+
<second>-2.02000000000000000e+002</second>
271+
</second>
272+
</item>
273+
<item>
274+
<first>ReportStringInfo:0</first>
275+
<second>
276+
<first>-2.78000000000000000e+002</first>
277+
<second>-6.20000000000000000e+001</second>
278+
</second>
279+
</item>
280+
</modulePositions>
281+
<moduleNotes class_id="18" tracking_level="0" version="0">
282+
<count>0</count>
283+
<item_version>0</item_version>
284+
</moduleNotes>
285+
<connectionNotes>
286+
<count>0</count>
287+
<item_version>0</item_version>
288+
</connectionNotes>
289+
<moduleTags class_id="19" tracking_level="0" version="0">
290+
<count>3</count>
291+
<item_version>0</item_version>
292+
<item class_id="20" tracking_level="0" version="0">
293+
<first>CreateString:0</first>
294+
<second>0</second>
295+
</item>
296+
<item>
297+
<first>InterfaceWithPython:0</first>
298+
<second>0</second>
299+
</item>
300+
<item>
301+
<first>ReportStringInfo:0</first>
302+
<second>0</second>
303+
</item>
304+
</moduleTags>
305+
</networkFile>
306+
</boost_serialization>
307+

src/Modules/Python/InterfaceWithPython.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,14 @@ std::string InterfaceWithPython::convertInputSyntax(const std::string& code) con
132132
if (port->nconnections() > 0)
133133
{
134134
auto inputName = get_state()->getValue(Name(port->id().toString())).toString();
135-
std::cout << "FOUND INPUT VARIABLE NAME: " << inputName << " for port " << port->id().toString() << std::endl;
135+
//std::cout << "FOUND INPUT VARIABLE NAME: " << inputName << " for port " << port->id().toString() << std::endl;
136+
//std::cout << "NEED TO REPLACE " << inputName << " with\n\t" << "scirun_get_module_input_value(\"" << get_id() << "\", \"" << port->id().toString() << "\")" << std::endl;
137+
auto index = code.find(inputName);
138+
if (index != std::string::npos)
139+
{
140+
auto codeCopy = code;
141+
return codeCopy.replace(index, inputName.length(), "scirun_get_module_input_value(\"" + get_id().id_ + "\", \"" + port->id().toString() + "\")");
142+
}
136143
}
137144
}
138145
return code;

0 commit comments

Comments
 (0)