Changeset 670
- Timestamp:
- Dec 4, 2009 5:10:03 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expgui
- Property rcs:date changed from 2002/10/31 17:29:18 to 2003/04/10 22:03:45
- Property rcs:lines changed from +13 -14 to +238 -25
- Property rcs:rev changed from 1.59 to 1.60
r660 r670 1 #!/usr/local/bin/wish 1 #!/bin/sh 2 # the next line restarts this script using wish found in the path\ 3 exec wish "$0" "$@" 4 # If this does not work, change the #!/usr/bin/wish line below 5 # to reflect the actual wish location and delete all preceeding lines 6 # 7 # (delete here and above) 8 #!/usr/bin/wish 2 9 # $Id$ 3 10 set expgui(Revision) {$Revision$ $Date$} … … 70 77 # default for autoexec load = off 71 78 set expgui(autoexpload) 0 79 # default for autostart GRWND = off 80 set expgui(autoGRWND) 0 72 81 # by default expgui is iconified while GENLES, etc runs 73 82 set expgui(autoiconify) 1 … … 88 97 # default: keep current atoms when replacing a phase 89 98 set expgui(DeleteAllAtoms) 0 99 # flags for running POWPREF 100 set expgui(needpowpref) 0 101 set expgui(needpowpref_why) "" 90 102 #============================================================================= 91 103 #---------------------------------------------------------------- … … 141 153 # override options with locally defined values 142 154 if {[catch { 143 foreach file [list \ 144 [file join $expgui(scriptdir) localconfig] \ 145 [file join ~ .gsas_config]] { 155 set filelist [list \ 156 [file join $expgui(scriptdir) localconfig] \ 157 [file join ~ .gsas_config] \ 158 [file join ~ gsas.config]] 159 foreach file $filelist { 146 160 if [file exists $file] {source $file} 147 161 } … … 208 222 #--------------------------------------------------------------------------- 209 223 if {$expgui(expfile) != ""} { 210 # is there a space in the name?211 if {[string first " " $expgui(expfile)] != -1} {224 # is there a space in the EXP name? 225 if {[string first " " [file tail $expgui(expfile)]] != -1} { 212 226 update 213 227 MyMessageBox -parent . -title "File Name Error" \ 214 -message "File name $expgui(expfile)is invalid -- EXPGUI cannot process experiment files with spaces in the name" \228 -message "File name \"$expgui(expfile)\" is invalid -- EXPGUI cannot process experiment files with spaces in the name" \ 215 229 -icon warning -type Continue -default continue 216 230 # -helplink "expguierr.html OpenErr" 217 231 set expgui(expfile) {} 232 } elseif {[string first " " [file dirname $expgui(expfile)]] != -1} { 233 update 234 MyMessageBox -parent . -title "Good luck..." \ 235 -message "You are using a directory with a space in the name ([file dirname $expgui(expfile)]) -- You may encounter bugs in EXPGUI. Please e-mail them to Brian.Toby@NIST.gov so they can be fixed." \ 236 -icon warning -type Continue -default continue 237 # -helplink "expguierr.html OpenErr" 218 238 } elseif ![file exists $expgui(expfile)] { 219 239 update … … 527 547 ############################################################################## 528 548 529 # save some of the global options in ~/.gsas_config 549 # save some of the global options in ~/.gsas_config or ~/gsas.config in Windows 530 550 proc SaveOptions {} { 531 551 global expgui env tcl_platform graph peakinfo 532 set fp [open [file join ~ .gsas_config] a] 552 if {$tcl_platform(platform) == "windows"} { 553 set fp [open [file join ~ gsas.config] a] 554 } else { 555 set fp [open [file join ~ .gsas_config] a] 556 } 557 558 puts $fp "# saved options from [clock format [clock ticks]]" 533 559 foreach item {archive asorttype hsorttype filesort disaglSeparateBox \ 534 font autoexpload autoiconify autotick } {560 font autoexpload autoiconify autotick autoGRWND} { 535 561 puts $fp "set expgui($item) [list $expgui($item)]" 536 562 } … … 861 887 set entrycmd(phasename) "" 862 888 set entryvar(phasename) "" 863 foreach ent {a b c alpha beta gamma cellref celldamp} { 889 foreach ent {a b c alpha beta gamma} { 890 set entryvar($ent) "" 891 } 892 foreach ent {cellref celldamp} { 864 893 set entrycmd($ent) "" 865 894 set entryvar($ent) "" … … 888 917 set entryvar(phasename) [phaseinfo $crsPhase name] 889 918 # cell parameters & flags 890 foreach ent {a b c alpha beta gamma cellref celldamp} { 919 foreach ent {a b c alpha beta gamma} { 920 set entryvar($ent) [phaseinfo $crsPhase $ent] 921 } 922 foreach ent {cellref celldamp} { 891 923 set entrycmd($ent) "phaseinfo $crsPhase $ent" 892 924 set entryvar($ent) [phaseinfo $crsPhase $ent] 893 # reset item to black894 catch {$entrybox($ent) config -fg black}895 925 } 896 926 … … 2008 2038 SetPhaseFlag $hist $plist 2009 2039 incr expgui(changed) 2040 # set the powpref warning (1 = suggested) 2041 set expgui(needpowpref) 2 2042 set msg "Phase flags" 2043 if {[string first $msg $expgui(needpowpref_why)] == -1} { 2044 append expgui(needpowpref_why) "\t$msg were changed\n" 2045 } 2010 2046 mapexp 2011 2047 } … … 3206 3242 -column $col -row $row -padx 5 -sticky e 3207 3243 incr col 3208 grid [entry $frameLatt.e$var -textvariable entryvar($var) -width 10] \ 3209 -column $col -row $row -padx 5 3210 set entrybox($var) $frameLatt.e$var 3244 grid [label $frameLatt.e$var -textvariable entryvar($var) \ 3245 -relief groove -bd 2 -width 10] \ 3246 -column $col -row $row -padx 5 3247 # grid [entry $frameLatt.e$var -textvariable entryvar($var) -width 10] \ 3248 # -column $col -row $row -padx 5 3249 # set entrybox($var) $frameLatt.e$var 3211 3250 } 3212 3251 incr row … … 3218 3257 3219 3258 incr col 3220 grid [entry $frameLatt.e$var -textvariable entryvar($var) -width 10] \ 3259 grid [label $frameLatt.e$var -textvariable entryvar($var)\ 3260 -relief groove -bd 2 -width 10] \ 3221 3261 -column $col -row $row -padx 5 3222 set entrybox($var) $frameLatt.e$var 3262 # grid [entry $frameLatt.e$var -textvariable entryvar($var) -width 10] \ 3263 # -column $col -row $row -padx 5 3264 # set entrybox($var) $frameLatt.e$var 3223 3265 } 3224 3266 3225 grid [label $frameLatt.lr -text "Refine Cell"] -column 8 -row 0 -padx 5 -sticky e 3226 grid [label $frameLatt.ld -text "Cell damping"] -column 8 -row 1 -padx 5 -sticky e 3267 grid [button $frameLatt.edit -text "Edit\nCell" -command EditCellConstants] \ 3268 -column 8 -row 0 -rowspan 2 -padx 5 -sticky e 3269 grid [label $frameLatt.lr -text "Refine Cell"] -column 9 -row 0 -padx 5 -sticky e 3270 grid [label $frameLatt.ld -text "Cell damping"] -column 9 -row 1 -padx 5 -sticky e 3227 3271 set cFlag [checkbutton $frameLatt.c -text "" -variable entryvar(cellref)] 3228 grid $cFlag -column 9-row 0 -padx 5 -sticky e3272 grid $cFlag -column 10 -row 0 -padx 5 -sticky e 3229 3273 tk_optionMenu $frameLatt.om entryvar(celldamp) 0 1 2 3 4 5 6 7 8 9 3230 grid $frameLatt.om -column 9-row 1 -padx 5 -sticky e3274 grid $frameLatt.om -column 10 -row 1 -padx 5 -sticky e 3231 3275 grid [label $frameLatt.phasetype -textvariable expgui(phasetype) -fg blue] \ 3232 3276 -column 1 -row 0 -rowspan 2 … … 3368 3412 # resize in case the pane needs more space 3369 3413 ResizeNotebook 3414 } 3415 3416 # called to create a window for editing unit cell constants 3417 proc EditCellConstants {} { 3418 global expgui entrybox 3419 set spg [phaseinfo $expgui(curPhase) spacegroup] 3420 set laueaxis [GetLaue $spg] 3421 set vary "" 3422 set equivL "" 3423 set equivA "" 3424 switch -exact $laueaxis { 3425 1bar {set vary "a b c alpha beta gamma"} 3426 2/ma {set vary "a b c alpha"} 3427 2/mb {set vary "a b c beta"} 3428 2/mc {set vary "a b c gamma"} 3429 mmm {set vary "a b c"} 3430 4/m - 3431 4/mmm {set vary "a c"; set equivL "a b"} 3432 3barR - 3433 "3bar mR" { 3434 set vary "a alpha" 3435 set equivL "a b c" 3436 set equivA "alpha beta gamma" 3437 } 3438 3bar - 3439 3barm1 - 3440 3bar1m - 3441 6/m - 3442 6/mmm {set vary "a c";set equivL "a b"} 3443 "m 3" - 3444 m3m {set vary a;set equivL "a b c"} 3445 default { 3446 MyMessageBox -parent . -title "Laue problem" \ 3447 -message "Error processing Laue code: $laueaxis\nError in space group \"$spg\"?\nUnable to edit cell. Fix or use EXPEDT." \ 3448 -icon warning -type OK -default ok \ 3449 -helplink "expguierr.html BadLaue" 3450 } 3451 } 3452 set row 0 3453 set w .cell 3454 toplevel $w -bg beige 3455 wm title $w "Edit Cell Parameters" 3456 # bind $w <Key-F1> "MakeWWWHelp expgui3.html EditBackground" 3457 bind $w <Return> "set expgui(temp) 1; destroy $w" 3458 pack [label $w.l1 -bg yellow -anchor center -justify center \ 3459 -text "Edit unit cell parameters for phase #$expgui(curPhase)" \ 3460 ] -side top -expand yes -fill both 3461 pack [label $w.l2 -bg beige -justify left \ 3462 -text "title: [phaseinfo $expgui(curPhase) name]\nSpace group: $spg\nLaue class: $laueaxis" \ 3463 ] -side top -expand yes -fill both 3464 pack [frame $w.0 -bd 6 -relief groove -bg beige \ 3465 ] -side top -expand yes -fill both 3466 pack [frame $w.b -bg beige] -fill x -expand yes -side top 3467 grid [button $w.b.2 -text Set -command "set expgui(temp) 1; destroy $w"] -row 0 -column 1 3468 grid [button $w.b.3 -text Quit \ 3469 -command "set expgui(temp) 0; destroy $w"] -row 0 -column 2 3470 # grid [button $w.b.help -text Help -bg yellow \ 3471 # -command "MakeWWWHelp expgui3.html EditBackground"] \ 3472 # -row 0 -column 4 3473 3474 global tmpvar 3475 trace variable tmpvar w TestCellEdit 3476 foreach ent {a b c alpha beta gamma} { 3477 set tmpvar($ent) [phaseinfo $expgui(curPhase) $ent] 3478 } 3479 3480 set frameLatt $w.0 3481 foreach col {2 4 6} var {a b c} lbl {a b c} { 3482 grid [label $frameLatt.l$var -text $lbl -bg beige] \ 3483 -column $col -row $row -padx 5 -sticky e 3484 incr col 3485 if {[lsearch $equivL $var] == -1} { 3486 set v $var 3487 } else { 3488 set v [lindex $equivL 0] 3489 } 3490 if {[lsearch $vary $var] == -1} { 3491 grid [label $frameLatt.e$var -textvariable tmpvar($v) \ 3492 -width 10 -bg beige] \ 3493 -column $col -row $row -padx 5 3494 } else { 3495 grid [entry $frameLatt.e$var -textvariable tmpvar($v) \ 3496 -width 10] -column $col -row $row -padx 5 3497 set entrybox($var) $frameLatt.e$var 3498 } 3499 } 3500 incr row 3501 foreach col {2 4 6} var {alpha beta gamma} lbl {a b g} { 3502 grid [label $frameLatt.l$var -text $lbl -bg beige] \ 3503 -column $col -row $row -padx 5 -sticky e 3504 set font [$frameLatt.l$var cget -font] 3505 $frameLatt.l$var config -font "Symbol [lrange $font 1 end]" 3506 3507 incr col 3508 if {[lsearch $equivA $var] == -1} { 3509 set v $var 3510 } else { 3511 set v [lindex $equivA 0] 3512 } 3513 if {[lsearch $vary $var] == -1} { 3514 grid [label $frameLatt.e$var -textvariable tmpvar($v)\ 3515 -width 10 -bg beige] \ 3516 -column $col -row $row -padx 5 3517 } else { 3518 grid [entry $frameLatt.e$var -textvariable tmpvar($v) \ 3519 -width 10] -column $col -row $row -padx 5 3520 set entrybox($var) $frameLatt.e$var 3521 } 3522 } 3523 putontop $w 3524 tkwait window $w 3525 afterputontop 3526 global entryvar 3527 set change 0 3528 if {$expgui(temp)} { 3529 foreach var {a b c} { 3530 if {[lsearch $equivL $var] == -1} { 3531 set v $var 3532 } else { 3533 set v [lindex $equivL 0] 3534 } 3535 catch { 3536 expr [set val $tmpvar($v)] 3537 if {[phaseinfo $expgui(curPhase) $var] != $val} { 3538 phaseinfo $expgui(curPhase) $var set $val 3539 set entryvar($var) $val 3540 incr expgui(changed) 3541 set change 1 3542 } 3543 } 3544 } 3545 foreach var {alpha beta gamma} { 3546 if {[lsearch $equivA $var] == -1} { 3547 set v $var 3548 } else { 3549 set v [lindex $equivA 0] 3550 } 3551 catch { 3552 expr [set val $tmpvar($v)] 3553 if {[phaseinfo $expgui(curPhase) $var] != $val} { 3554 phaseinfo $expgui(curPhase) $var set $val 3555 set entryvar($var) $val 3556 incr expgui(changed) 3557 set change 1 3558 } 3559 } 3560 } 3561 if {$change} { 3562 # set the powpref warning (1 = suggested) 3563 if {$expgui(needpowpref) == 0} {set expgui(needpowpref) 1} 3564 append expgui(needpowpref_why) "\tCell parameters were changed\n" 3565 } 3566 } 3567 unset tmpvar 3568 } 3569 3570 # highlight errors in unit cell constants 3571 proc TestCellEdit {var elem mode} { 3572 global tmpvar entrybox 3573 if {[catch {expr $tmpvar($elem)} errmsg]} { 3574 catch {$entrybox($elem) config -fg red} 3575 } else { 3576 catch {$entrybox($elem) config -fg black} 3577 } 3370 3578 } 3371 3579 … … 3823 4031 $expgui(fm).option.menu add checkbutton -label "Iconify during GSAS" \ 3824 4032 -variable expgui(autoiconify) 4033 if {$tcl_platform(platform) == "windows" && \ 4034 $tcl_platform(os) == "Windows 95"} { 4035 $expgui(fm).option.menu add checkbutton -label "Autostart GRWND" \ 4036 -variable expgui(autoGRWND) 4037 } 3825 4038 } 3826 4039 $expgui(fm).option.menu add cascade -menu $expgui(fm).option.menu.asort \
Note: See TracChangeset
for help on using the changeset viewer.