| 1 |
< |
# SCCSid "$SunId$ LBL" |
| 1 |
> |
# RCSid: $Id$ |
| 2 |
|
# |
| 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] |
| 11 |
> |
set rfn /tmp/rf[pid] |
| 12 |
|
if {! [save_vars $rfn]} { |
| 13 |
|
beep |
| 14 |
|
set curmess "Cannot save variables to temporary file!" |
| 19 |
|
lappend radcom -v $rpview |
| 20 |
|
} |
| 21 |
|
if {"$scname" == {}} { |
| 22 |
< |
set rof /usr/tmp/ro[pid] |
| 22 |
> |
set rof /tmp/ro[pid] |
| 23 |
|
} else { |
| 24 |
|
set rof $scname |
| 25 |
|
} |
| 50 |
|
|
| 51 |
|
proc run_rad args { # Run rad command with given arguments |
| 52 |
|
global curmess |
| 53 |
< |
set rfn /usr/tmp/rf[pid] |
| 53 |
> |
set rfn /tmp/rf[pid] |
| 54 |
|
if {! [save_vars $rfn]} { |
| 55 |
|
beep |
| 56 |
|
set curmess "Cannot save variables to temporary file!" |
| 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 |
| 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 |
| 177 |
> |
unset rvview rpview bfname batch_pid mywin |
| 178 |
|
return |
| 179 |
|
} |
| 180 |
|
set bfname [file rootname [file tail $rifname]].err |
| 196 |
|
# Render interactively |
| 197 |
|
label $w.ril -text {Render interactively} |
| 198 |
|
place $w.ril -relx .1429 -rely .2439 |
| 199 |
< |
button $w.rirv -text rview -relief raised \ |
| 199 |
> |
button $w.rirv -text rvu -relief raised \ |
| 200 |
|
-command {run_rad -v $rvview -o x11} |
| 201 |
|
place $w.rirv -relwidth .1071 -relheight .0610 -relx .4643 -rely .2439 |
| 202 |
< |
helplink $w.rirv trad action rview |
| 202 |
> |
helplink $w.rirv trad action rvu |
| 203 |
|
label $w.rivl -text View: |
| 204 |
|
place $w.rivl -relx .6072 -rely .2439 |
| 205 |
|
menubutton $w.rivmb -textvariable rvview -anchor w -relief raised |
| 223 |
|
-command {view_txt $bfname} |
| 224 |
|
place $w.rbce -relwidth .1786 -relheight .0610 -relx .6429 -rely .5488 |
| 225 |
|
helplink $w.rbce trad action checkerr |
| 226 |
< |
if [file exists $bfname] { |
| 226 |
> |
if [file isfile $bfname] { |
| 227 |
|
set fi [open $bfname r] |
| 228 |
< |
eval set batch_pid [gets $fi] |
| 229 |
< |
gets $fi radcom |
| 228 |
> |
if {[scan [gets $fi] $batch_fmt batch_pid batch_host] != 2} { |
| 229 |
> |
set batch_host unknown |
| 230 |
> |
set radcom {} |
| 231 |
> |
} else { |
| 232 |
> |
gets $fi radcom |
| 233 |
> |
} |
| 234 |
|
close $fi |
| 235 |
< |
if [catch {exec /bin/kill -0 $batch_pid}] { |
| 235 |
> |
if [string match "rad -v *" $radcom] { |
| 236 |
> |
set rpview [lindex $radcom 2] |
| 237 |
> |
} else { |
| 238 |
> |
set rpview " ALL" |
| 239 |
> |
} |
| 240 |
> |
if {"$hostname" != "$batch_host"} { |
| 241 |
|
if $alldone { |
| 242 |
+ |
set curmess "Batch rendering finished\ |
| 243 |
+ |
on $batch_host." |
| 244 |
+ |
} else { |
| 245 |
+ |
set curmess "Batch rendering on\ |
| 246 |
+ |
$batch_host -- status UNKNOWN." |
| 247 |
+ |
$w.rbst configure -state disabled |
| 248 |
+ |
$w.rbvmb configure -state disabled |
| 249 |
+ |
} |
| 250 |
+ |
set batch_pid 0 |
| 251 |
+ |
$w.rbki configure -state disabled |
| 252 |
+ |
} elseif {[catch {exec /bin/kill -0 $batch_pid}]} { |
| 253 |
+ |
if $alldone { |
| 254 |
|
set curmess "Batch rendering finished." |
| 255 |
|
} else { |
| 256 |
|
set curmess "Batch rendering stopped." |
| 260 |
|
$w.rbki configure -state disabled |
| 261 |
|
} else { |
| 262 |
|
set curmess "Batch rendering process $batch_pid running." |
| 237 |
– |
if [string match "rad -v *" $radcom] { |
| 238 |
– |
set rpview [lindex $radcom 2] |
| 239 |
– |
} else { |
| 240 |
– |
set rpview " ALL" |
| 241 |
– |
} |
| 263 |
|
$w.rbst configure -state disabled |
| 264 |
|
$w.rbvmb configure -state disabled |
| 265 |
|
} |