1
#!/bin/ksh ~/.mgltools/pythonsh
2
########################################################################
4
# Vision Network - Python source code - file generated by vision
5
# Tuesday 13 November 2007 14:49:16
7
# The Scripps Research Institute (TSRI)
8
# Molecular Graphics Lab
9
# La Jolla, CA 92037, USA
11
# Copyright: Daniel Stoffler, Michel Sanner and TSRI
13
# revision: Guillaume Vareille
15
#########################################################################
17
# $Header: /opt/cvs/python/packages/share1.5/Vision/doc/Tutorial/cartoon/cartoon5_net.py,v 1.9 2007/11/13 23:23:43 vareille Exp $
19
# $Id: cartoon5_net.py,v 1.9 2007/11/13 23:23:43 vareille Exp $
23
if __name__=='__main__':
24
from Vision import launchVisionToRunNetworkAsApplication, mainLoopVisionToRunNetworkAsApplication
25
masterNet = launchVisionToRunNetworkAsApplication()
27
masterNet.filename = os.path.abspath(__file__)
28
from traceback import print_exc
29
masterNet.createUserPanel('MyApp' ,width=178, height=245)
30
## loading libraries ##
31
from Vision.PILNodes import imagelib
32
masterNet.getEditor().addLibraryInstance(imagelib,"Vision.PILNodes", "imagelib")
34
from Vision.StandardNodes import stdlib
35
masterNet.getEditor().addLibraryInstance(stdlib,"Vision.StandardNodes", "stdlib")
38
## saving node Filelist ##
39
from Vision.StandardNodes import Filelist
40
Filelist_0 = Filelist(constrkw = {}, name='Filelist', library=stdlib)
41
masterNet.addNode(Filelist_0,14,6)
42
apply(Filelist_0.inputPortByName['match_str'].widget.configure, (), {'master': 'MyApp', 'widgetPlacerCfg': {'rely': '0.8816', 'relx': '0.5787'}})
43
Filelist_0.inputPortByName['match_str'].widget.set("cartoonMovie/*.png", run=False)
45
print "WARNING: failed to restore Filelist named Filelist in network masterNet"
50
## saving node Read Image ##
51
from Vision.PILNodes import ReadImage
52
Read_Image_1 = ReadImage(constrkw = {}, name='Read Image', library=imagelib)
53
masterNet.addNode(Read_Image_1,20,264)
54
apply(Read_Image_1.inputPortByName['filename'].configure, (), {'datatype': 'string', 'originalDatatype': 'str'})
55
Read_Image_1.inputPortByName['filename'].widget.set("", run=False)
56
Read_Image_1.inputPortByName['filename'].unbindWidget()
58
print "WARNING: failed to restore ReadImage named Read Image in network masterNet"
63
## saving node Scale ##
64
from Vision.PILNodes import ResizeImage
65
Scale_2 = ResizeImage(constrkw = {}, name='Scale', library=imagelib)
66
masterNet.addNode(Scale_2,22,317)
67
apply(Scale_2.inputPortByName['scale'].widget.configure, (), {'widgetGridCfg': {'labelSide': 'left'}, 'master': 'MyApp', 'widgetPlacerCfg': {'rely': '0.5143', 'relx': '0.5112'}, 'widgetGridCfgMyApp': {'labelSide': 'left'}})
68
Scale_2.inputPortByName['scale'].widget.set(0.376964776024, run=False)
70
print "WARNING: failed to restore ResizeImage named Scale in network masterNet"
75
## saving node Show Image ##
76
from Vision.PILNodes import ShowImage
77
Show_Image_3 = ShowImage(constrkw = {}, name='Show Image', library=imagelib)
78
masterNet.addNode(Show_Image_3,21,374)
80
print "WARNING: failed to restore ShowImage named Show Image in network masterNet"
85
## saving node call method ##
86
from Vision.StandardNodes import CallMethod
87
call_method_4 = CallMethod(constrkw = {}, name='call method', library=stdlib)
88
masterNet.addNode(call_method_4,3,85)
89
call_method_4.inputPortByName['signature'].widget.set("sort", run=False)
90
apply(call_method_4.configure, (), {'expanded': True})
92
print "WARNING: failed to restore CallMethod named call method in network masterNet"
97
## saving node Index ##
98
from Vision.StandardNodes import Index
99
Index_5 = Index(constrkw = {}, name='Index', library=stdlib)
100
masterNet.addNode(Index_5,41,182)
101
apply(Index_5.inputPortByName['index'].widget.configure, (), {'max': 100, 'master': 'MyApp', 'widgetPlacerCfg': {'rely': '0.1429', 'relx': '0.5225'}})
103
print "WARNING: failed to restore Index named Index in network masterNet"
110
## saving connections for network cartoon5 ##
111
if Read_Image_1 is not None and Scale_2 is not None:
113
masterNet.connectNodes(
114
Read_Image_1, Scale_2, "image", "image", blocking=True)
116
print "WARNING: failed to restore connection between Read_Image_1 and Scale_2 in network masterNet"
117
if Scale_2 is not None and Show_Image_3 is not None:
119
masterNet.connectNodes(
120
Scale_2, Show_Image_3, "scaledImage", "image", blocking=True)
122
print "WARNING: failed to restore connection between Scale_2 and Show_Image_3 in network masterNet"
123
if Filelist_0 is not None and call_method_4 is not None:
125
masterNet.connectNodes(
126
Filelist_0, call_method_4, "filelist", "objects", blocking=True)
128
print "WARNING: failed to restore connection between Filelist_0 and call_method_4 in network masterNet"
129
if call_method_4 is not None and Index_5 is not None:
131
masterNet.connectNodes(
132
call_method_4, Index_5, "objects", "data", blocking=True)
134
print "WARNING: failed to restore connection between call_method_4 and Index_5 in network masterNet"
135
if Index_5 is not None and Read_Image_1 is not None:
137
masterNet.connectNodes(
138
Index_5, Read_Image_1, "data", "filename", blocking=True)
140
print "WARNING: failed to restore connection between Index_5 and Read_Image_1 in network masterNet"
145
if __name__=='__main__':
146
mainLoopVisionToRunNetworkAsApplication(masterNet.editor)