Changeset 1121 for branches/sandbox
- Timestamp:
- Mar 23, 2011 5:00:54 PM (13 years ago)
- Location:
- branches/sandbox
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/sandbox/addcmds.tcl
r1109 r1121 379 379 } 380 380 } 381 set newhist(LimitMode) 1 381 382 trace variable newhist(setnum) w LabelInstParm 382 383 trace variable newhist(LimitMode) w ClearHistLimit … … 415 416 -column 0 -row 0 -sticky ew -columnspan 7 416 417 grid [checkbutton $np.d0 -text "Dummy Histogram" -variable newhist(dummy) \ 417 -command "Post DummyOpts $np" \418 -command "PostInstBankopts $np" \ 418 419 ] -column 2 -row 0 -columnspan 99 -sticky e 419 420 grid [label $np.l1 -text "Data file:"] -column 0 -row 2 … … 510 511 } 511 512 512 Post DummyOpts $np513 PostInstBankopts $np 513 514 # set grab, etc. 514 515 putontop $np … … 676 677 incr row 677 678 } 678 grid [radiobutton $np.bank.$i -text $i -command Set Tmax\679 grid [radiobutton $np.bank.$i -text $i -command SetDefaultBank \ 679 680 -variable newhist(banknum) -value $i] \ 680 681 -column [incr col] -row $row -sticky w 681 # only 1 choice, so set it 682 if {[llength $newhist(banklist)] == 1} { 683 set newhist(banknum) $i 684 SetTmax685 } else {686 set flag 1 687 }682 } 683 # if only 1 choice, set it 684 if {[llength $newhist(banklist)] == 1} { 685 set newhist(banknum) $i 686 SetDefaultBank 687 } else { 688 set flag 1 688 689 } 689 690 if {$flag} { 690 691 set newhist(2tLimit) {} 691 set newhist(LimitMode) {}692 692 } 693 693 SetMultipleAdd $np 694 694 } 695 695 696 proc SetDefaultBank {} { 697 # set the default instrument parameter set to follow the bank # when the 698 # numbers of banks in each place agree. Do this when the data bank # is set 699 global newhist 700 if {[llength $newhist(banklist)] == $newhist(instbanks)} { 701 set newhist(setnum) $newhist(banknum) 702 } 703 SetTmax 704 } 705 696 706 proc SetTmax {} { 707 # set the default data range when the data or instrument parameter set is changed 697 708 global newhist 709 # mode must be t-max or 2theta, at least for now 710 if {$newhist(LimitMode) != 1} return 711 # is a instrument parameter file loaded? If not, try again later 712 if {[string trim $newhist(instfile)] == ""} return 713 # get data bank number, test if valid 698 714 set num $newhist(banknum) 715 if {[catch {expr $num}]} {return} 699 716 if {$newhist(insttype) == "TOF"} { 700 717 set newhist(2tLimit) [expr {$newhist(tmin$num) / 10.}] 701 if {[llength $newhist(banklist)] == $newhist(instbanks)} { 702 set newhist(setnum) $newhist(banknum) 703 # at Ashfia's request, override the bank header # with the 704 # value from the instrument parameter file. 705 catch { 706 set s $newhist(setnum) 707 foreach {x tmin tmax x} $newhist(inst${s}ITYP) {} 708 if {$tmin > 0} {set newhist(2tLimit) $tmin} 709 } 718 # at Ashfia's request, override the bank header # with the 719 # value from the instrument parameter file. 720 catch { 721 set s $newhist(setnum) 722 foreach {x tmin tmax x} $newhist(inst${s}ITYP) {} 723 if {$tmin > 0} {set newhist(2tLimit) $tmin} 710 724 } 711 725 } else { 712 726 set newhist(2tLimit) $newhist(tmax$num) 713 727 } 714 set newhist(LimitMode) 1715 716 728 } 717 729 … … 819 831 } 820 832 grid [radiobutton $np.set.$i -text $i \ 821 -command "Post DummyOpts $np; ValidateDummyHist $np" \833 -command "PostInstBankopts $np; ValidateDummyHist $np" \ 822 834 -variable newhist(setnum) -value $i] \ 823 835 -column [incr col] -row $row -sticky w 824 836 if {$newhist(instbanks) == 1} {set newhist(setnum) $i} 825 837 } 826 if {$newhist(dummy)} {Post DummyOpts $np; ValidateDummyHist $np}838 if {$newhist(dummy)} {PostInstBankopts $np; ValidateDummyHist $np} 827 839 LabelInstParm 828 840 SetMultipleAdd $np … … 1023 1035 update 1024 1036 } 1025 #--- Dummy histogram stuff1026 proc Post DummyOpts {np} {1037 #--- Respond to the setting of the bank # for the Instrument parameter file. 1038 proc PostInstBankopts {np} { 1027 1039 global newhist 1028 1040 if {$newhist(dummy)} { … … 1084 1096 grid $np.cb4 -column 2 -row 20 -sticky w 1085 1097 grid $np.cb5 -column 2 -row 19 -sticky w 1086 } 1098 SetTmax 1099 } 1087 1100 } 1088 1101 … … 1337 1350 grid [radiobutton $top.vartyp.cb5 -text "Q-max\n(A-1)" -variable newhist(LimitMode) \ 1338 1351 -value 2] -column 2 -row 1 -sticky w 1339 set newhist(LimitMode) 11340 1352 1341 1353 grid [button $top.add -text Add -command "destroy $np"] -column 0 -row 3 … … 1936 1948 ] -row 2 -column 0 -columnspan 10 1937 1949 } 1950 1951 # allow fixing of atom coordinates 1952 if {[lindex $expmap(phasetype) [expr {$p - 1}]] != 4} { 1953 grid [TitleFrame $w.10 -bd 6 -relief groove \ 1954 -text "Fix Atom$suffix Coordinates"] \ 1955 -row 9 -column 0 -columnspan 10 -sticky news 1956 set fix [$w.10 getframe] 1957 Fix_Initialize $numberList 1958 1959 label $fix.xlab -text " x " -width 8 1960 label $fix.ylab -text " y " -width 8 1961 label $fix.zlab -text " z " -width 8 1962 grid $fix.xlab -row 2 -column 0 1963 grid $fix.ylab -row 2 -column 1 1964 grid $fix.zlab -row 2 -column 2 1965 1966 1967 button $fix.x -text "$::fix_state_X" -width 8 \ 1968 -command "Fix_Atoms $phase [list $numberList] X $fix.x; 1969 Fix_Write 1970 DisplayAllAtoms $phase" 1971 1972 button $fix.y -text "$::fix_state_Y" -width 8 \ 1973 -command "Fix_Atoms $phase [list $numberList] Y $fix.y 1974 Fix_Write 1975 DisplayAllAtoms $phase" 1976 button $fix.z -text "$::fix_state_Z" -width 8 \ 1977 -command "Fix_Atoms $phase [list $numberList] Z $fix.z 1978 Fix_Write 1979 DisplayAllAtoms $phase" 1980 grid $fix.x -row 3 -column 0 1981 grid $fix.y -row 3 -column 1 1982 grid $fix.z -row 3 -column 2 1983 } 1984 #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1985 1986 grid rowconfigure $w 11 -minsize 5 1987 grid [frame $w.b] -row 12 -column 0 -columnspan 10 -sticky ew 1988 pack [button $w.b.3 -text Close -command "destroy $w"] -side left \ 1989 -padx 5 -pady 5 1990 pack [button $w.b.help -text Help -bg yellow \ 1991 -command "MakeWWWHelp expgui2.html xform"] -side right \ 1992 -padx 5 -pady 5 1993 bind $w <Return> "destroy $w" 1994 1995 # force the window to stay on top 1996 putontop $w 1997 focus $w.b.3 1998 tkwait window $w 1999 afterputontop 2000 # if there are selected atoms, reset their display 2001 if {[llength $expgui(selectedatomlist)] != 0} editRecord 2002 } 2003 1938 2004 #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x 1939 2005 … … 1956 2022 } 1957 2023 } 1958 1959 set ::fix_state_X [Fix_State 1 $numberList X] 1960 set ::fix_state_Y [Fix_State 1 $numberList Y] 1961 set ::fix_state_Z [Fix_State 1 $numberList Z] 1962 2024 set ::fix_state_X [Fix_State 1 $numberList X] 2025 set ::fix_state_Y [Fix_State 1 $numberList Y] 2026 set ::fix_state_Z [Fix_State 1 $numberList Z] 1963 2027 } 1964 2028 … … 1966 2030 set status_fixed "-1" 1967 2031 set status_unfixed "-1" 1968 puts "$coord before: $status_fixed $status_unfixed"2032 #puts "$coord before: $status_fixed $status_unfixed" 1969 2033 foreach i $numberList { 1970 2034 set temp [info exists ::fix_param($phase,$i,$coord)] … … 1973 2037 if {$temp == 0} {set status_unfixed 1} 1974 2038 } 1975 puts "$coord after $status_fixed $status_unfixed"2039 #puts "$coord after $status_fixed $status_unfixed" 1976 2040 if {$status_fixed == 1 && $status_unfixed != 1} {return "fixed"} 1977 2041 if {$status_fixed == 1 && $status_unfixed == 1} {return "mixed"} … … 1981 2045 proc Fix_Write {} { 1982 2046 incr ::expgui(changed) 1983 puts "Prepare to write [array names ::fix_Param]"2047 #puts "Prepare to write [array names ::fix_Param]" 1984 2048 foreach j [array names ::fix_param] { 1985 2049 regexp {[0-9]+} $j temp_phase … … 1994 2058 foreach i $phaselist { 1995 2059 catch {atom_constraint_write $i $fix_list($i)} 1996 puts $fix_list($i)2060 #puts $fix_list($i) 1997 2061 } 1998 2062 } … … 2000 2064 proc Fix_Atoms {phase numberList coord but} { 2001 2065 # puts "before ::fix_state_$coord [set ::fix_state_$coord]" 2002 puts " before operationi: $::fix_list($coord,$phase)"2066 #puts " before operationi: $::fix_list($coord,$phase)" 2003 2067 switch [set ::fix_state_$coord] { 2004 2068 "unfixed" {$but config -text "fixed" … … 2013 2077 } 2014 2078 if {[set ::fix_state_$coord] == "fixed"} { 2015 puts "fixing atom number $numberList"2079 #puts "fixing atom number $numberList" 2016 2080 foreach i $numberList { 2017 2081 lappend ::fix_list($coord,$phase) $i … … 2021 2085 } 2022 2086 if {[set ::fix_state_$coord] == "unfixed"} { 2023 puts "unfixing atoms $numberList"2087 #puts "unfixing atoms $numberList" 2024 2088 foreach i $numberList { 2025 2089 set temp [lsearch $::fix_list($coord,$phase) $i] … … 2030 2094 } 2031 2095 } 2032 puts "after operation: $::fix_list($coord,$phase)" 2033 2034 2035 } 2036 2037 #******Main Fixing Program 2038 if {[lindex $expmap(phasetype) [expr {$p - 1}]] != 4} { 2039 grid [TitleFrame $w.10 -bd 6 -relief groove \ 2040 -text "Fix Atom$suffix Coordinates"] \ 2041 -row 9 -column 0 -columnspan 10 -sticky news 2042 set fix [$w.10 getframe] 2043 Fix_Initialize $numberList 2044 2045 label $fix.xlab -text " x " -width 8 2046 label $fix.ylab -text " y " -width 8 2047 label $fix.zlab -text " z " -width 8 2048 grid $fix.xlab -row 2 -column 0 2049 grid $fix.ylab -row 2 -column 1 2050 grid $fix.zlab -row 2 -column 2 2051 2052 2053 button $fix.x -text "$::fix_state_X" -width 8 \ 2054 -command "Fix_Atoms $phase [list $numberList] X $fix.x; 2055 Fix_Write 2056 DisplayAllAtoms $phase" 2057 2058 button $fix.y -text "$::fix_state_Y" -width 8 \ 2059 -command "Fix_Atoms $phase [list $numberList] Y $fix.y 2060 Fix_Write 2061 DisplayAllAtoms $phase" 2062 button $fix.z -text "$::fix_state_Z" -width 8 \ 2063 -command "Fix_Atoms $phase [list $numberList] Z $fix.z 2064 Fix_Write 2065 DisplayAllAtoms $phase" 2066 grid $fix.x -row 3 -column 0 2067 grid $fix.y -row 3 -column 1 2068 grid $fix.z -row 3 -column 2 2069 } 2070 2071 2072 2073 2074 #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2075 2076 grid rowconfigure $w 11 -minsize 5 2077 grid [frame $w.b] -row 12 -column 0 -columnspan 10 -sticky ew 2078 pack [button $w.b.3 -text Close -command "destroy $w"] -side left \ 2079 -padx 5 -pady 5 2080 pack [button $w.b.help -text Help -bg yellow \ 2081 -command "MakeWWWHelp expgui2.html xform"] -side right \ 2082 -padx 5 -pady 5 2083 bind $w <Return> "destroy $w" 2084 2085 # force the window to stay on top 2086 putontop $w 2087 focus $w.b.3 2088 tkwait window $w 2089 afterputontop 2090 # if there are selected atoms, reset their display 2091 if {[llength $expgui(selectedatomlist)] != 0} editRecord 2092 } 2093 2096 #puts "after operation: $::fix_list($coord,$phase)" 2097 } 2094 2098 2095 2099 … … 2869 2873 set newhist(dummy) 0 2870 2874 set newhist(instfiletext) {} 2875 set newhist(instbanks) {}
Note: See TracChangeset
for help on using the changeset viewer.