| 3 |
|
# Action screen for trad |
| 4 |
|
# |
| 5 |
|
|
| 6 |
+ |
set batch_fmt "Process %d on %s started" |
| 7 |
+ |
set hostname [exec hostname] |
| 8 |
+ |
|
| 9 |
|
proc make_script {} { # make run script |
| 10 |
|
global scname rpview curmess |
| 11 |
|
set rfn /usr/tmp/rf[pid] |
| 40 |
|
set fi [open "|make $radvar(OCTREE) $args" r] |
| 41 |
|
while {[gets $fi curmess] >= 0} { update ; after 1000 } |
| 42 |
|
catch {close $fi} curmess |
| 40 |
– |
if {"$args" == {}} {return} |
| 43 |
|
} |
| 44 |
|
if {"$args" == {}} { |
| 45 |
|
run_rad -v 0 |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
proc run_batch {} { # start rendering in background |
| 70 |
< |
global rpview bfname batch_pid curmess rifname mywin |
| 70 |
> |
global rpview bfname batch_pid curmess rifname mywin batch_fmt hostname |
| 71 |
|
if {! [chksave]} {return} |
| 72 |
|
if [catch {set fo [open $bfname w]} curmess] { |
| 73 |
|
return |
| 74 |
|
} |
| 75 |
|
# Make space for PID to be written later |
| 76 |
< |
puts $fo " " |
| 76 |
> |
puts $fo \ |
| 77 |
> |
" " |
| 78 |
|
if {$rpview == " ALL"} { |
| 79 |
|
set radcom "rad" |
| 80 |
|
} else { |
| 88 |
|
set batch_pid [eval exec $radcom >>& $bfname &] |
| 89 |
|
# Now, write PID and close file |
| 90 |
|
seek $fo 0 |
| 91 |
< |
puts -nonewline $fo $batch_pid |
| 91 |
> |
puts -nonewline $fo "[format $batch_fmt $batch_pid $hostname]\ |
| 92 |
> |
[exec date]" |
| 93 |
|
close $fo |
| 94 |
|
set curmess "Batch rendering process $batch_pid started." |
| 95 |
|
# Correct button stati |
| 105 |
|
switch -glob [exec uname] { |
| 106 |
|
SunOS - |
| 107 |
|
ULTRIX {set ps "ps -lg"} |
| 108 |
< |
default {set ps "ps -lu $env(USER)"} |
| 108 |
> |
default {set ps "ps -lu $env(LOGNAME)"} |
| 109 |
|
} |
| 110 |
|
set fi [open "|$ps" r] |
| 111 |
|
gets $fi li |
| 151 |
|
catch {destroy $mywin.rbvmb.m} |
| 152 |
|
if {[llength $radvar(view)] < 2} { |
| 153 |
|
$mywin.rivmb configure -state disabled |
| 150 |
– |
$mywin.rbvmb configure -state disabled |
| 154 |
|
return |
| 155 |
|
} |
| 156 |
|
menu $mywin.rivmb.m |
| 160 |
|
-variable rvview -value [lindex $v 0] |
| 161 |
|
} |
| 162 |
|
menu $mywin.rbvmb.m |
| 163 |
< |
$mywin.rbvmb configure -menu $mywin.rbvmb.m -state normal |
| 163 |
> |
$mywin.rbvmb configure -menu $mywin.rbvmb.m |
| 164 |
|
$mywin.rbvmb.m add radiobutton -label ALL \ |
| 165 |
|
-variable rpview -value " ALL" |
| 166 |
|
$mywin.rbvmb.m add separator |
| 172 |
|
|
| 173 |
|
proc do_action w { # Action screen |
| 174 |
|
global rifname rvview rpview radvar bfname batch_pid \ |
| 175 |
< |
curmess scname mywin alldone |
| 175 |
> |
curmess scname mywin alldone batch_fmt hostname |
| 176 |
|
if {"$w" == "done"} { |
| 177 |
|
unset rpview bfname batch_pid mywin |
| 178 |
|
return |
| 225 |
|
helplink $w.rbce trad action checkerr |
| 226 |
|
if [file exists $bfname] { |
| 227 |
|
set fi [open $bfname r] |
| 228 |
< |
eval set batch_pid [gets $fi] |
| 228 |
> |
scan [gets $fi] $batch_fmt batch_pid batch_host |
| 229 |
|
gets $fi radcom |
| 230 |
|
close $fi |
| 231 |
< |
if [catch {exec /bin/kill -0 $batch_pid}] { |
| 231 |
> |
if [string match "rad -v *" $radcom] { |
| 232 |
> |
set rpview [lindex $radcom 2] |
| 233 |
> |
} else { |
| 234 |
> |
set rpview " ALL" |
| 235 |
> |
} |
| 236 |
> |
if {"$hostname" != "$batch_host"} { |
| 237 |
|
if $alldone { |
| 238 |
+ |
set curmess "Batch rendering finished\ |
| 239 |
+ |
on $batch_host." |
| 240 |
+ |
} else { |
| 241 |
+ |
set curmess "Batch rendering on\ |
| 242 |
+ |
$batch_host -- status UNKNOWN." |
| 243 |
+ |
$w.rbst configure -state disabled |
| 244 |
+ |
$w.rbvmb configure -state disabled |
| 245 |
+ |
} |
| 246 |
+ |
set batch_pid 0 |
| 247 |
+ |
$w.rbki configure -state disabled |
| 248 |
+ |
} elseif {[catch {exec /bin/kill -0 $batch_pid}]} { |
| 249 |
+ |
if $alldone { |
| 250 |
|
set curmess "Batch rendering finished." |
| 251 |
|
} else { |
| 252 |
|
set curmess "Batch rendering stopped." |
| 256 |
|
$w.rbki configure -state disabled |
| 257 |
|
} else { |
| 258 |
|
set curmess "Batch rendering process $batch_pid running." |
| 239 |
– |
if [string match "rad -v *" $radcom] { |
| 240 |
– |
set rpview [lindex $radcom 2] |
| 241 |
– |
} else { |
| 242 |
– |
set rpview " ALL" |
| 243 |
– |
} |
| 259 |
|
$w.rbst configure -state disabled |
| 260 |
|
$w.rbvmb configure -state disabled |
| 261 |
|
} |