-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmasterObject
executable file
·196 lines (174 loc) · 5.63 KB
/
masterObject
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Amira-Script-Object V3.0
# Master script object to load subsidiry loadAllFiles objects
$this proc constructor { } {
global this
$this newPortFilename filename
$this newPortButtonList Action 5
$this Action setLabel Action:
$this Action setLabel 0 LoadAll
$this Action setLabel 1 Remove
$this Action setLabel 2 Update
$this Action setLabel 3 HideAll
$this Action setLabel 4 ShowIcons
$this newPortFloatSlider red
$this red setMinMax 0 1
$this newPortFloatSlider green
$this green setMinMax 0 1
$this newPortFloatSlider blue
$this blue setMinMax 0 1
$this newPortFloatSlider width
$this width setMinMax 0 2.5
$this width setValue 1
$this newPortIntSlider ScoreThreshold
$this ScoreThreshold setMinMax 0 4
$this ScoreThreshold setValue 4
$this newPortInfo dirName
$this setVar lafObjectList ""
$this setVar fileList ""
$this setVar glomTogList ""
$this setVar glomActive ""
$this setVar thresholds ""
$this setVar widths ""
$this setVar lafScriptFile "C:\\Documents and Settings\\Greg\\My Documents\\amirawork\\loadAllFile.scro"
}
$this proc compute { } {
if { [ $this Action isNew ] && [$this Action getValue]==0} {
$this makeFileListFromDir
$this loadFiles
}
if { [ $this Action isNew ] && [$this Action getValue]==2} {
#$this myupdate
}
if { [ $this Action isNew ] && [$this Action getValue]==3} {
if { [ $this Action getLabel 3]=="ShowAll" } {
$this showLafObjects 1
} elseif {[ $this Action getLabel 3]=="HideAll" } {
$this showLafObjects 0
}
}
if { [ $this Action isNew ] && [$this Action getValue]==4} {
if { [ $this Action getLabel 4]=="ShowIcons" } {
$this showIcons 1
} elseif {[ $this Action getLabel 4]=="HideIcons" } {
$this showIcons 0
}
}
if { [ $this ScoreThreshold isNew ] } {
$this updateLafObjectsThreshold
}
if { [ $this red isNew ] || [ $this green isNew ] || [ $this blue isNew ] || [ $this width isNew ]} {
$this updateLafObjectsColor
}
set glomActive ""
foreach glomTog [$this getVar glomTogList] {
for {set i 0} {$i < 6} {incr i} {
set obj [$this $glomTog getLabel $i]
#echo "checking obj $obj"
if {[exists $obj]} {
#echo "obj $obj exists"
if {[ $this $glomTog isNew ]} {
$obj showLineViews [$this $glomTog getValue $i]
}
if {[$this $glomTog getValue $i]} {
lappend glomActive [$this $glomTog getLabel $i]
#echo [concat "added " [$this $glomTog getLabel $i]]
}
}
}
}
$this setVar glomActive $glomActive
#echo $glomActive
# uncomment to turn on continuous update
#$this myupdate
}
$this proc showLafObjects {mask} {
set glomActive ""
foreach glomTog [$this getVar glomTogList] {
for {set i 0} {$i < 6} {incr i} {
set obj [$this $glomTog getLabel $i]
#echo "checking obj $obj"
if {[exists $obj]} {
#echo "obj $obj exists"
$this $glomTog setValue $i $mask
if {$mask} {
lappend glomActive [$this $glomTog getLabel $i]
#echo [concat "added " [$this $glomTog getLabel $i]]
}
}
}
}
$this setVar glomActive $glomActive
if {$mask == 0} { $this Action setLabel 3 ShowAll}
if {$mask == 1} { $this Action setLabel 3 HideAll}
}
$this proc updateLafObjectsThreshold {} {
foreach glom [$this getVar glomActive] {
if {[exists $glom]} {
$glom ScoreThreshold setValue [$this ScoreThreshold getValue]
$glom fire
}
}
}
$this proc updateLafObjectsColor {} {
foreach glom [$this getVar glomActive] {
if {[exists $glom]} {
$glom red setValue [$this red getValue]
$glom green setValue [$this green getValue]
$glom blue setValue [$this blue getValue]
$glom width setValue [$this width getValue]
$glom fire
}
}
}
$this proc showIcons {mask} {
}
$this proc makeFileListFromDir {} {
set filename [ $this filename getValue ]
set fileList [glob [file dirname $filename]/*[file extension $filename]]
# set the instance variable fileList to the value of the local fileList
$this setVar fileList $fileList
$this dirName setValue [file dirname $filename]
}
$this proc loadFiles {} {
set fileList [$this getVar fileList]
set lafObjectList [$this getVar lafObjectList]
set thresholds [$this getVar thresholds]
set widths [$this getVar widths]
#echo $fileList
foreach file $fileList {
if {[file size $file] > 0} {
set newModule [load [$this getVar lafScriptFile]]
# set the correct file list name for the new object
$newModule fileListName setValue $file
# tell the new module to load in the file list
$newModule Action setValue 4
$newModule width setValue [$this width getValue]
$newModule ScoreThreshold setValue [$this ScoreThreshold getValue]
$newModule fire
#$newModule hideIcon
set splitFile [file split $file]
set justfilename [lindex $splitFile [expr [llength $splitFile]-1]]
set glom [lindex [split $justfilename _] 0]
$newModule setLabel $glom
lappend lafObjectList $glom
lappend widths [$this width getValue]
lappend thresholds [$this ScoreThreshold getValue]
}
}
#set hideNewModules 0
$this setVar lafObjectList $lafObjectList
$this makeGlomeruliToggles
}
$this proc makeGlomeruliToggles {} {
set lafObjectList [$this getVar lafObjectList]
for {set i 0} {$i<[llength $lafObjectList]} { set i [expr $i + 6]} {
set j [expr $i / 6]
$this newPortToggleList "Glomeruli$j" 6
lappend glomTogList "Glomeruli$j"
for {set k 0} {[expr $k + $i] < [llength $lafObjectList]} { incr k} {
$this "Glomeruli$j" setLabel $k [lindex $lafObjectList [expr $k + $i]]
$this "Glomeruli$j" setValue $k 1
}
}
$this setVar glomTogList $glomTogList
}