Changeset 907
- Timestamp:
- Dec 4, 2009 5:14:06 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/excledt.tcl
- Property rcs:date changed from 2004/10/04 20:28:29 to 2008/04/15 17:12:02
- Property rcs:lines changed from +12 -18 to +125 -82
- Property rcs:rev changed from 1.14 to 1.15
r825 r907 3 3 # create the main Excluded Region window 4 4 proc ExclReaddata {box} { 5 global expgui 5 global expgui graph 6 6 # if [catch { 7 7 set loadtime [time { … … 9 9 # }] 10 10 if $expgui(debug) { 11 tk_dialog .time "Timing info" \11 tk_dialog $graph(exclbox).time "Timing info" \ 12 12 "Histogram loading took $loadtime" "" 0 OK 13 13 } … … 217 217 # show tickmark options 218 218 proc minioptionsbox {num} { 219 global blt_version tcl_platform peakinfo expgui 220 set bx .opt$num219 global blt_version tcl_platform peakinfo expgui graph 220 set bx $graph(exclbox).opt$num 221 221 catch {destroy $bx} 222 222 toplevel $bx … … 263 263 } 264 264 265 proc makepostscriptout {} {265 proc MakePostscriptOut {{parent {}}} { 266 266 global graph 267 267 if !$graph(printout) { … … 280 280 } 281 281 if {$msg != ""} { 282 tk_dialog .msg "file created" \282 tk_dialog $parent.msg "file created" \ 283 283 "Postscript file processed with command \ 284 284 $graph(outcmd). Result: $msg" "" 0 OK 285 285 } else { 286 tk_dialog .msg "file created" \286 tk_dialog $parent.msg "file created" \ 287 287 "Postscript file processed with command \ 288 288 $graph(outcmd)" "" 0 OK … … 291 291 $graph(plot) postscript output $graph(outname) -landscape 1 \ 292 292 -decorations no -height 7.i -width 9.5i 293 tk_dialog .msg "file created" \293 tk_dialog $parent.msg "file created" \ 294 294 "Postscript file $graph(outname) created" "" 0 OK 295 295 } … … 311 311 } 312 312 313 proc setpostscriptout {} {313 proc SetPostscriptOut {{parent ""}} { 314 314 global graph tcl_platform 315 set box .out315 set box ${parent}.out 316 316 catch {destroy $box} 317 317 toplevel $box … … 340 340 } 341 341 342 proc getsymopts {"sym obs"} {342 proc GetSymbolOpts {"sym obs" {parent ""} { 343 343 global expgui peakinfo 344 set box .out344 set box $parent.out 345 345 catch {destroy $box} 346 346 toplevel $box 347 347 focus $box 348 wm title .out"Set $sym symbol"348 wm title $box "Set $sym symbol" 349 349 pack [frame $box.d] -side left -anchor n 350 350 pack [label $box.d.t -text "Symbol type"] -side top … … 362 362 pack [label $box.e.l -text "Symbol Size"] -side top 363 363 pack [scale $box.e.s -variable expgui(size) \ 364 -from .1 -to 3 -resolution 0.05] -side top364 -from 0.1 -to 3 -resolution 0.05] -side top 365 365 pack [frame $box.a] -side bottom 366 366 pack [button $box.a.1 -text "Apply" -command "setsymopts $sym"] -side left … … 518 518 global graph 519 519 if {$graph(exclPrompt)} { 520 set ans [MyMessageBox -parent .-message $msg \520 set ans [MyMessageBox -parent $graph(exclbox) -message $msg \ 521 521 -helplink "expguierr.html ExcludeRegion" \ 522 522 -title "Delete region" -type okcancel] … … 535 535 } else { 536 536 histinfo $hst excl set $newlist 537 RecordMacroEntry "histinfo $hst excl set [list $newlist]" 0 538 RecordMacroEntry "incr expgui(changed)" 0 537 539 updateplot 538 540 } … … 623 625 global graph 624 626 if {$graph(exclPrompt)} { 625 set ans [MyMessageBox -parent .-message $msg -title "Exclude?"\627 set ans [MyMessageBox -parent $graph(exclbox) -message $msg -title "Exclude?"\ 626 628 -type okcancel -helplink "expguierr.html ExcludeRegion"] 627 629 } else { … … 690 692 } 691 693 histinfo $graph(hst) excl set $exclist 694 RecordMacroEntry "histinfo $graph(hst) excl set [list $exclist]" 0 695 RecordMacroEntry "incr expgui(changed)" 0 692 696 } 693 697 … … 696 700 global expmap graph expgui 697 701 set hst $graph(hst) 702 set box $graph(exclbox).limit 698 703 if {[string trim [string range $expmap(htype_$hst) 3 3]] == "D"} { 699 704 if {[string range $expmap(htype_$hst) 2 2] == "T"} { … … 711 716 return 712 717 } 713 set box .limit714 718 toplevel $box 715 719 wm title $box "Set usable range" … … 830 834 if {$oldtmin != $tmin} { 831 835 # edited minimum time -- reset d-min & set CHANS -- use EXPEDT 832 SetTminTOF $tmin [winfo parent $graph(plot)]836 SetTminTOF $tmin $hst [winfo parent $graph(plot)] 833 837 # Qmax got bigger. Show the new data? 834 838 if {$tmin < $oldtmin} {QmaxIncreased} … … 839 843 # edited 2theta or Energy max -- reset d-min 840 844 histinfo $hst dmin set [tod $tmax $hst] 845 RecordMacroEntry "histinfo $hst dmin set [tod $tmax $hst]" 0 846 RecordMacroEntry "incr expgui(changed)" 0 841 847 if {$tmax > $oldtmax} {QmaxIncreased} 842 848 } … … 852 858 append msg "to see the full range of data displayed. Do you want to " 853 859 append msg "run POWPREF (& possibly GENLES with zero cycles)?" 854 set ans [MyMessageBox -parent .-message $msg -title "Process limits?"\860 set ans [MyMessageBox -parent $graph(exclbox) -message $msg -title "Process limits?"\ 855 861 -helplink "expguierr.html ProcessRegions" \ 856 862 -type {Skip {Run POWPREF} {Run POWPREF & GENLES}}] … … 912 918 } 913 919 append msg "OK to make this change?" 914 set ans [MyMessageBox -parent .-message $msg -title "Reset limits?"\920 set ans [MyMessageBox -parent $graph(exclbox) -message $msg -title "Reset limits?"\ 915 921 -helplink "expguierr.html RegionTooBig" \ 916 922 -type {OK Cancel}] … … 920 926 set exclist [lreplace $exclist end end $item] 921 927 histinfo $hst excl set $exclist 928 RecordMacroEntry "histinfo $hst excl set [list $exclist]" 0 922 929 histinfo $hst dmin set [tod $max $hst] 930 RecordMacroEntry "histinfo $hst dmin set [tod $max $hst]" 0 931 RecordMacroEntry "incr expgui(changed)" 0 923 932 updateplot 924 933 return … … 952 961 set i [expr {$reg -1}] 953 962 set range [lindex $exclist $i] 954 toplevel [set box .edit]963 toplevel [set box $graph(exclbox).edit] 955 964 wm title $box "Edit excluded region" 956 965 set beg minimum … … 1017 1026 set $v $graph($v) 1018 1027 } 1019 bind $box <Return> "destroy .edit"1028 bind $box <Return> "destroy $box" 1020 1029 grid [frame $box.c] -column 1 -row 99 -columnspan 99 1021 grid [button $box.c.1 -text "OK" -command "destroy .edit"] \1030 grid [button $box.c.1 -text "OK" -command "destroy $box"] \ 1022 1031 -column 1 -row 1 1023 1032 grid [button $box.c.2 -text "Cancel" \ 1024 -command "set graph(tmin) $tmin; set graph(tmax) $tmax;destroy .edit"] \1033 -command "set graph(tmin) $tmin; set graph(tmax) $tmax;destroy $box"] \ 1025 1034 -column 2 -row 1 1026 1035 putontop $box … … 1206 1215 1207 1216 # manual zoom option 1208 proc BLT manualZoom {} {1217 proc BLTplotManualZoom {} { 1209 1218 global graph 1210 catch {toplevel .zoom} 1211 wm title .zoom "Manual zoom" 1212 eval destroy [grid slaves .zoom] 1213 raise .zoom 1214 wm title .zoom {Manual Scaling} 1215 grid [label .zoom.l1 -text minimum] -row 1 -column 2 1216 grid [label .zoom.l2 -text maximum] -row 1 -column 3 1217 grid [label .zoom.l3 -text x] -row 2 -column 1 1218 grid [label .zoom.l4 -text y] -row 3 -column 1 1219 grid [entry .zoom.xmin -textvariable graph(xmin) -width 10] -row 2 -column 2 1220 grid [entry .zoom.xmax -textvariable graph(xmax) -width 10] -row 2 -column 3 1221 grid [entry .zoom.ymin -textvariable graph(ymin) -width 10] -row 3 -column 2 1222 grid [entry .zoom.ymax -textvariable graph(ymax) -width 10] -row 3 -column 3 1223 grid [frame .zoom.b] -row 4 -column 1 -columnspan 3 1224 grid [button .zoom.b.1 -text "Set Scaling" \ 1219 set parent [winfo parent graph(plot)] 1220 if {$parent == "."} {set parent ""} 1221 set box ${parent}.zoom 1222 catch {toplevel $box} 1223 wm title $box "Manual zoom" 1224 eval destroy [grid slaves $box] 1225 raise $box 1226 wm title $box {Manual Scaling} 1227 grid [label $box.l1 -text minimum] -row 1 -column 2 1228 grid [label $box.l2 -text maximum] -row 1 -column 3 1229 grid [label $box.l3 -text x] -row 2 -column 1 1230 grid [label $box.l4 -text y] -row 3 -column 1 1231 grid [entry $box.xmin -textvariable graph(xmin) -width 10] -row 2 -column 2 1232 grid [entry $box.xmax -textvariable graph(xmax) -width 10] -row 2 -column 3 1233 grid [entry $box.ymin -textvariable graph(ymin) -width 10] -row 3 -column 2 1234 grid [entry $box.ymax -textvariable graph(ymax) -width 10] -row 3 -column 3 1235 grid [frame $box.b] -row 4 -column 1 -columnspan 3 1236 grid [button $box.b.1 -text "Set Scaling" \ 1225 1237 -command "SetManualZoom set"] -row 4 -column 1 -columnspan 2 1226 grid [button .zoom.b.2 -text Reset \1238 grid [button $box.b.2 -text Reset \ 1227 1239 -command "SetManualZoom clear"] -row 4 -column 3 1228 grid [button .zoom.b.3 -text Close -command "destroy .zoom"] -row 4 -column 41229 grid rowconfigure .zoom1 -weight 1 -pad 51230 grid rowconfigure .zoom2 -weight 1 -pad 51231 grid rowconfigure .zoom3 -weight 1 -pad 51232 grid rowconfigure .zoom4 -weight 0 -pad 51233 grid columnconfigure .zoom1 -weight 1 -pad 201234 grid columnconfigure .zoom1 -weight 11235 grid columnconfigure .zoom3 -weight 1 -pad 101240 grid [button $box.b.3 -text Close -command "destroy $box"] -row 4 -column 4 1241 grid rowconfigure $box 1 -weight 1 -pad 5 1242 grid rowconfigure $box 2 -weight 1 -pad 5 1243 grid rowconfigure $box 3 -weight 1 -pad 5 1244 grid rowconfigure $box 4 -weight 0 -pad 5 1245 grid columnconfigure $box 1 -weight 1 -pad 20 1246 grid columnconfigure $box 1 -weight 1 1247 grid columnconfigure $box 3 -weight 1 -pad 10 1236 1248 foreach item {min min max max} \ 1237 1249 format {3 2 3 2} \ … … 1241 1253 catch {set graph(${axis}${item}) [format %.${format}f $val]} 1242 1254 } 1243 putontop .zoom1244 tkwait window .zoom1255 putontop $box 1256 tkwait window $box 1245 1257 afterputontop 1246 1258 } … … 1304 1316 set graph(plot) [graph $graph(exclbox).g -plotbackground white] 1305 1317 } errmsg] { 1306 MyMessageBox -parent .-title "BLT Error" \1318 MyMessageBox -parent $graph(exclbox) -title "BLT Error" \ 1307 1319 -message "BLT Setup Error: could not create a graph \ 1308 1320 (error msg: $errmsg). \ … … 1317 1329 Blt_ZoomStack $graph(plot) 1318 1330 } errmsg] { 1319 MyMessageBox -parent .-title "BLT Error" \1331 MyMessageBox -parent $graph(exclbox) -title "BLT Error" \ 1320 1332 -message "BLT Setup Error: could not access a Blt_ routine \ 1321 1333 (msg: $errmsg). \ … … 1358 1370 -label "Update Plot" -command "CheckChanges $startchanges;updateplot" 1359 1371 $graph(exclmenu).file.menu add command \ 1360 -label "Make PostScript" -command makepostscriptout1372 -label "Make PostScript" -command "MakePostscriptOut $graph(exclbox)" 1361 1373 $graph(exclmenu).file.menu add command \ 1362 1374 -label Finish -command "CheckChanges $startchanges;destroy $graph(exclbox)" … … 1382 1394 foreach var {excl obs} lbl {Excluded Observed} { 1383 1395 $graph(exclmenu).options.menu.sym add command -label $lbl \ 1384 -command " getsymopts $var"1396 -command "GetSymbolOpts $var $graph(exclbox)" 1385 1397 } 1386 1398 … … 1412 1424 -variable graph(exclPrompt) 1413 1425 $graph(exclmenu).options.menu add command -label "Set PS output" \ 1414 -command setpostscriptout1426 -command "SetPostscriptOut $graph(exclbox)" 1415 1427 # phase options 1416 1428 set box $graph(plot) … … 1424 1436 -command "minioptionsbox $num" 1425 1437 } 1426 bind $win <Key-Up> "ScanZoom $box %K .1"1427 bind $win <Key-Left> "ScanZoom $box %K .1"1428 bind $win <Key-Right> "ScanZoom $box %K .1"1429 bind $win <Key-Down> "ScanZoom $box %K .1"1438 bind $win <Key-Up> "ScanZoom $box %K 0.1" 1439 bind $win <Key-Left> "ScanZoom $box %K 0.1" 1440 bind $win <Key-Right> "ScanZoom $box %K 0.1" 1441 bind $win <Key-Down> "ScanZoom $box %K 0.1" 1430 1442 bind $win <Control-Key-Up> "ScanZoom $box %K 1.0" 1431 1443 bind $win <Control-Key-Left> "ScanZoom $box %K 1.0" … … 1535 1547 set cycle [getcycle];readdata .g 1536 1548 } 1537 bind $graph(exclbox) <Key-z> {BLT manualZoom}1538 bind $graph(exclbox) <Key-Z> {BLT manualZoom}1549 bind $graph(exclbox) <Key-z> {BLTplotManualZoom} 1550 bind $graph(exclbox) <Key-Z> {BLTplotManualZoom} 1539 1551 updateplot 1540 1552 trace variable peakinfo w plotExclData … … 1561 1573 1562 1574 proc SetDummyRangeBox {hst tmin tmax tstep} { 1563 global newhist expmap 1575 global newhist expmap graph 1564 1576 if {[histinfo $hst dtype] != "CONST"} { 1565 MyMessageBox -parent $ np-title "Change Range Error" \1577 MyMessageBox -parent $graph(exclbox) -title "Change Range Error" \ 1566 1578 -message "This histogram (#$hst) does not have constant steps. The range must be changed in EXPEDT." \ 1567 1579 -icon error -type ok -default ok \ … … 1569 1581 return 1570 1582 } 1571 catch {toplevel [set np " .dummy"]}1583 catch {toplevel [set np "$graph(exclbox).dummy"]} 1572 1584 wm title $np "Dummy Histogram Range" 1573 1585 eval destroy [winfo children $np] … … 1765 1777 histinfo $hst dstep set [expr {$newhist(tstep)*1000.}] 1766 1778 histinfo $hst dmin set [tod $newhist(tmin) $hst] 1779 RecordMacroEntry "histinfo $hst excl set [list $exclist]" 0 1780 RecordMacroEntry "histinfo $hst dpoints set $pnts" 0 1781 RecordMacroEntry "histinfo $hst dstart set [expr {$newhist(tmin)*1000.}]" 0 1782 RecordMacroEntry "histinfo $hst dstep set [expr {$newhist(tstep)*1000.}]" 0 1783 RecordMacroEntry "histinfo $hst dmin set [tod $newhist(tmin) $hst]" 0 1767 1784 } elseif {[string range $expmap(htype_$hst) 2 2] == "C"} { 1768 1785 lappend exclist "0 [expr {$newhist(tmin)-$newhist(tstep)}]" \ … … 1773 1790 histinfo $hst dstep set [expr {$newhist(tstep)*100.}] 1774 1791 histinfo $hst dmin set [tod $newhist(tmax) $hst] 1792 RecordMacroEntry "histinfo $hst excl set [list $exclist]" 0 1793 RecordMacroEntry "histinfo $hst dpoints set $pnts" 0 1794 RecordMacroEntry "histinfo $hst dstart set [expr {$newhist(tmin)*100.}]" 0 1795 RecordMacroEntry "histinfo $hst dstep set [expr {$newhist(tstep)*100.}]" 0 1796 RecordMacroEntry "histinfo $hst dmin set [tod $newhist(tmin) $hst]" 0 1775 1797 } else { 1776 1798 lappend exclist "0 [expr {$newhist(tmin)-$newhist(tstep)}]" \ … … 1781 1803 histinfo $hst dstep set $newhist(tstep) 1782 1804 histinfo $hst dmin set [tod $newhist(tmax) $hst] 1805 RecordMacroEntry "histinfo $hst excl set [list $exclist]" 0 1806 RecordMacroEntry "histinfo $hst dpoints set $pnts" 0 1807 RecordMacroEntry "histinfo $hst dstart set $newhist(tmin)" 0 1808 RecordMacroEntry "histinfo $hst dstep set $newhist(tstep)" 0 1809 RecordMacroEntry "histinfo $hst dmin set [tod $newhist(tmin) $hst]" 0 1783 1810 } 1784 1811 global expgui 1785 1812 incr expgui(changed) 5 1813 RecordMacroEntry "incr expgui(changed)" 0 1786 1814 destroy $np 1787 1815 updateplot … … 1789 1817 1790 1818 # set the minimum tof/d-space using the EXPEDT program 1791 proc SetTminTOF {tmin parent} { 1792 global expgui reflns graph tcl_platform 1793 set hst $graph(hst) 1819 proc SetTminTOF {tmin hst parent} { 1820 global expgui 1821 1822 set errmsg [runSetTminTOF $tmin $hst] 1823 # save call to Macro file 1824 RecordMacroEntry "runSetTminTOF $tmin $hst" 0 1825 RecordMacroEntry "incr expgui(changed)" 0 1826 1827 if {$expgui(showexptool) || $errmsg != ""} { 1828 if {$errmsg != ""} { 1829 set err 1 1830 append errmsg "\n" $expgui(exptoolout) 1831 } else { 1832 set err 0 1833 set errmsg $expgui(exptoolout) 1834 } 1835 set msg "Please review the result from listing the phase." 1836 if {$errmsg != ""} {append msg "\nIt appears an error occurred!"} 1837 ShowBigMessage $parent.msg $msg $errmsg OK "" $err 1838 } 1839 } 1840 proc runSetTminTOF {tmin hst} { 1841 global expgui tcl_platform 1794 1842 set input [open excl$hst.inp w] 1795 1843 puts $input "Y" … … 1813 1861 } 1814 1862 } errmsg] 1863 set fp [open excl$hst.out r] 1864 set expgui(exptoolout) [read $fp] 1865 close $fp 1815 1866 loadexp $expgui(expfile) 1816 catch {file delete excl$hst.inp} 1817 if {$expgui(showexptool) || $err} { 1818 set fp [open excl$hst.out r] 1819 set out [read $fp] 1820 close $fp 1821 if {$errmsg != ""} { 1822 append errmsg "\n" $out 1823 } else { 1824 set errmsg $out 1825 } 1826 set msg "Please review the result from changing the TOF minimum." 1827 if {$err} {append msg "\nIt appears an error occurred!"} 1828 ShowBigMessage $parent.msg $msg $errmsg OK "" $err 1829 } 1830 } 1867 catch {file delete excl$hst.inp excl$hst.out} 1868 if {$err} { 1869 return $errmsg 1870 } else { 1871 return "" 1872 } 1873 }
Note: See TracChangeset
for help on using the changeset viewer.