Changeset 14 for trunk/expgui
- Timestamp:
- Dec 4, 2009 4:58:55 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expgui
- Property rcs:date changed from 1998/12/28 02:33:30 to 1998/12/31 13:10:07
- Property rcs:lines changed from +16 -9 to +122 -67
- Property rcs:rev changed from 1.2 to 1.3
r12 r14 7 7 # start out blank with a "load from option"? 8 8 # 9 # menu for least squares options 9 # access to GENLES & EXPEDT (merge in tkGSAS) 10 # 11 # look for external changes to the EXP file and warn/reload 12 # add a mtime to loadexp and chain a routine to check the mtime for a new value 13 # reset the mtime in SaveAsFile 14 # 10 15 # idea: 11 16 # a scroll list for all histogram refinement flags ; click on takes you to the … … 179 184 {} 0 "Save and reread" "Reread without Save" "Cancel reread command"] 180 185 switch $decision { 181 0 { archiveexp $expfile }182 1 { }183 2 { return }186 0 { savearchiveexp $expfile } 187 1 { } 188 2 { return } 184 189 } 185 190 } … … 210 215 {} 0 "Save and read" "Read without Save" "Cancel read command"] 211 216 switch $decision { 212 0 { archiveexp $expfile }213 1 { }214 2 { return }217 0 { savearchiveexp $expfile } 218 1 { } 219 2 { return } 215 220 } 216 221 } … … 309 314 {} 0 "Save and Exit" "Exit without Save" "Cancel exit command"] 310 315 switch $decision { 311 0 { archiveexp $expfile; return "Continue" } 312 1 { return "Continue" } 313 2 { return "Cancel" } 314 } 315 } 316 317 proc archiveexp {expfile} { 316 0 { savearchiveexp $expfile; return "Continue" } 317 1 { return "Continue" } 318 2 { return "Cancel" } 319 } 320 } 321 322 # save and optionally archive the expfile 323 proc savearchiveexp {expfile} { 318 324 global expgui tcl_platform 319 325 if !$expgui(changed) return … … 392 398 # now save the file 393 399 expwrite $expfile 400 set expgui(changed) 0 394 401 } 395 402 … … 896 903 set expgui(backtermlbl) "" 897 904 set expgui(backtypelbl) "" 898 foreach var { scale sref sdampbref bdamp} {905 foreach var {bref bdamp} { 899 906 set entrycmd($var) "histinfo [list $histlist] $var" 900 907 set entryvar($var) [histinfo [lindex $histlist 0] $var] … … 905 912 set expgui(backtermlbl) "($terms terms)" 906 913 set expgui(backtypelbl) "Function type [histinfo $hist backtype]" 907 foreach var { scale sref sdampbref bdamp} {914 foreach var {bref bdamp} { 908 915 set entrycmd($var) "histinfo $hist $var" 909 916 set entryvar($var) [eval $entrycmd($var)] 910 917 } 911 918 } 912 # Scale factor box &Top box919 # Top box 913 920 if {$expgui(globalmode) != 0} { 914 921 $expgui(histFrame).top.txt config \ 915 922 -text "Selected Histograms: [CompressList $histlist]" 916 923 grid $expgui(histFrame).top -column 1 -row 0 -sticky nsew 917 set parm [grid info $expgui(scaleBox).ent1]918 if {$parm != ""} {919 grid forget $expgui(scaleBox).ent1920 eval grid $expgui(scaleBox).but1 $parm921 }922 924 set expgui(bkglbl) "Globally Edit Background" 923 925 } else { 924 926 grid forget $expgui(histFrame).top 925 set parm [grid info $expgui(scaleBox).but1]926 if {$parm != ""} {927 grid forget $expgui(scaleBox).but1928 eval grid $expgui(scaleBox).ent1 $parm929 }930 927 set expgui(bkglbl) "Edit Background" 931 928 } … … 1237 1234 1238 1235 #----------------------------------------------------------------------- 1239 # populate the Phase Fractionpage1236 # populate the Scaling page 1240 1237 #----------------------------------------------------------------------- 1241 1238 proc DisplayFrac {} { … … 1257 1254 } 1258 1255 1259 set phaseFractf1 $expgui(fracFrame).f1 1256 #-------------- 1257 # Scale factor 1258 #-------------- 1259 if {$expgui(globalmode) != 0} { 1260 foreach var {scale sref sdamp} { 1261 set entrycmd($var) "histinfo [list $histlist] $var" 1262 set entryvar($var) [histinfo [lindex $histlist 0] $var] 1263 } 1264 set parm [grid info $expgui(scaleBox).ent1] 1265 if {$parm != ""} { 1266 grid forget $expgui(scaleBox).ent1 1267 eval grid $expgui(scaleBox).but1 $parm 1268 } 1269 } else { 1270 set hist $histlist 1271 foreach var {scale sref sdamp} { 1272 set entrycmd($var) "histinfo $hist $var" 1273 set entryvar($var) [eval $entrycmd($var)] 1274 } 1275 set parm [grid info $expgui(scaleBox).but1] 1276 if {$parm != ""} { 1277 grid forget $expgui(scaleBox).but1 1278 eval grid $expgui(scaleBox).ent1 $parm 1279 } 1280 } 1281 1282 #---------------- 1283 # Phase Fractions 1284 #---------------- 1285 set phaseFractf1 $expgui(FracBox).f 1260 1286 # destroy the contents of the frame 1261 eval destroy [ packslaves $phaseFractf1]1287 eval destroy [grid slaves $phaseFractf1] 1262 1288 if {$expgui(globalmode) != 0} { 1263 pack [frame $expgui(fracFrame).f1.top] \ 1264 -side top -anchor center 1265 pack [label $expgui(fracFrame).f1.top.txt \ 1266 -text "Selected Histograms: [CompressList $histlist]"] -side left 1289 grid [label $phaseFractf1.txt -anchor center \ 1290 -text "Phase Fractions for Histograms: [CompressList $histlist]"] \ 1291 -column 0 -row 0 -sticky news 1292 } else { 1293 grid [label $phaseFractf1.txt -anchor center \ 1294 -text "Phase Fractions"] -column 0 -row 0 -sticky news 1267 1295 } 1268 1296 # Create the frame inside the canvas, One frame for each Phase. … … 1276 1304 if {[llength $phasehistlist($i)] == 0} continue 1277 1305 set framePF [frame $phaseFractf1.pF$i -relief groove -bd 4] 1278 pack $framePF -pady 1 -side top -anchor w 1279 1306 grid $framePF -column 0 -row $i -sticky ew 1280 1307 # Label Heading for each phase. 1281 1308 if {$expgui(globalmode) != 0} { 1282 1309 grid [label $framePF.l1 \ 1283 -text "Phase $i Hist: [CompressList $phasehistlist($i)] PhaseFraction"] \1310 -text "Phase $i Hist: [CompressList $phasehistlist($i)] Fraction"] \ 1284 1311 -column 0 -row 0 -sticky nws 1285 1312 grid [button $framePF.but1 -text "Set Globally" \ … … 1288 1315 ] -column 1 -row 0 1289 1316 } else { 1290 grid [label $framePF.l1 -text "Phase $i Phasefraction"] \1317 grid [label $framePF.l1 -text "Phase $i fraction"] \ 1291 1318 -column 0 -row 0 -sticky nws 1292 1319 grid [entry $framePF.ent -textvariable entryvar(frac$i) -width 15]\ … … 1309 1336 grid $framePF.tkOptDamp -row 0 -sticky nsw -column 5 1310 1337 } 1338 # resize the scroll window to match the actual 1339 update idletasks 1340 $expgui(FracBox) config -scrollregion [grid bbox $expgui(FracBox).f] 1341 $expgui(FracBox) config -width [lindex [grid bbox $expgui(FracBox).f] 2] 1311 1342 update idletasks 1312 1343 # enable traces on entryvar now … … 1946 1977 pack $expgui(fm) -fill x -side top -anchor n 1947 1978 1948 # Creating the notebook with 5 panes: Phase, Histogram, Phase Fraction, Profile1979 # Creating the notebook with 5 panes: Phase, Histogram, Scaling, Profile 1949 1980 # & LS controls 1950 1981 if $expgui(havetix) { … … 1958 1989 lappend expgui(frameactionlist) "histFrame DisplayHistogram" 1959 1990 lappend expgui(GlobalModeAllDisable) "histFrame {.n pageconfigure histPane}" 1960 .n add fracPane -label " Phase Fraction" -underline 61991 .n add fracPane -label "Scaling" -underline 6 1961 1992 .n pageconfigure fracPane -raisecmd \ 1962 1993 "set expgui(pagenow) fracFrame; DisplayFrac" … … 1981 2012 pack [frame .n] -anchor w -fill both -expand yes 1982 2013 foreach item {phaseFrame histFrame fracFrame profFrame lsFrame} \ 1983 page {Phase Histogram "Phase Fraction"Profile "LS Controls"} {2014 page {Phase Histogram Scaling Profile "LS Controls"} { 1984 2015 pack [button .bar.$item -text $page -bd 2 \ 1985 2016 -command "RaisePage $item"] -side left … … 2227 2258 grid [label $expgui(histFrame).top.txt] -row 0 -column 0 2228 2259 if $expgui(havetix) { 2229 foreach item { scaleBox backBox diffBox} num {12 3} \2230 title { "Scale Factor"Background "Diffractometer Constants"} {2260 foreach item {backBox diffBox} num {2 3} \ 2261 title {Background "Diffractometer Constants"} { 2231 2262 tixLabelFrame $expgui(histFrame).$item \ 2232 2263 -borderwidth 4 -width 600 -height 100 -label $title … … 2235 2266 } 2236 2267 } else { 2237 foreach item { scaleBox backBox diffBox} num {01 2} \2238 title { ""Background "Diffractometer Constants"} {2268 foreach item {backBox diffBox} num {1 2} \ 2269 title {Background "Diffractometer Constants"} { 2239 2270 frame $expgui(histFrame).$item -borderwidth 4 -relief groove 2240 2271 grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew 2241 2272 set expgui($item) $expgui(histFrame).$item 2242 if {$title != ""} { 2243 grid [label $expgui(histFrame).$item.title -text $title] \ 2244 -row 0 -column 0 -columnspan 10 -sticky nw 2245 } 2246 } 2247 } 2248 grid [label $expgui(scaleBox).histSFLabel -text "Scale Factor"] \ 2249 -row 1 -column 6 -sticky nws -padx 2 -pady 3 2250 grid [entry $expgui(scaleBox).ent1 -textvariable entryvar(scale) -width 15] \ 2251 -row 1 -column 7 -sticky ew -padx 4 -pady 3 2252 button $expgui(scaleBox).but1 -text "Set Globally" \ 2253 -command "editglobalparm histinfo scale {Scale Factor}" 2254 2255 grid [label $expgui(scaleBox).histSFRLabel -text " Refine scale"] \ 2256 -row 1 -column 2 -sticky nws -padx 2 -pady 3 2257 grid [checkbutton $expgui(scaleBox).rf -variable entryvar(sref)] \ 2258 -row 1 -column 3 -sticky news -padx 4 -pady 3 2259 grid [label $expgui(scaleBox).lD1 -text "Damping"] \ 2260 -row 1 -column 4 -sticky w -padx 2 -pady 3 2261 tk_optionMenu $expgui(scaleBox).om entryvar(sdamp) 0 1 2 3 4 5 6 7 8 9 2262 grid $expgui(scaleBox).om \ 2263 -row 1 -column 5 -sticky news -padx 4 -pady 3 2264 grid columnconfigure $expgui(scaleBox) 6 -weight 1 2273 grid [label $expgui(histFrame).$item.title -text $title] \ 2274 -row 0 -column 0 -columnspan 10 -sticky nw 2275 } 2276 } 2265 2277 2266 2278 # BACKGROUND information. … … 2290 2302 #^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^END OF HISTOGRAM PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 2291 2303 ############################################################################### 2292 #v v v v v v v v v v BEGINNING OF PHASE FRACTIONPANE CODE v v v v v v v v v v2304 #v v v v v v v v v v BEGINNING OF SCALING PANE CODE v v v v v v v v v v 2293 2305 2294 2306 pack [frame $expgui(fracFrame).hs] -side left -expand y -fill both … … 2321 2333 } 2322 2334 pack [frame $expgui(fracFrame).f1] -fill both -expand true 2335 # Create a large canvas area containing a frame for each phase in the data set. 2336 # The canvas and vertical scrollbar are inside a frame called f1 2337 if $expgui(havetix) { 2338 tixLabelFrame $expgui(fracFrame).f1.scaleBox \ 2339 -borderwidth 4 -width 600 -height 100 -label "Scale Factor" 2340 grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2 2341 set expgui(scaleBox) [$expgui(fracFrame).f1.scaleBox subwidget frame] 2342 } else { 2343 frame $expgui(fracFrame).f1.scaleBox -borderwidth 4 -relief groove 2344 grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2 2345 set expgui(scaleBox) $expgui(fracFrame).f1.scaleBox 2346 } 2347 grid [label $expgui(scaleBox).histSFLabel -text "Scale Factor"] \ 2348 -row 1 -column 0 -sticky nws -padx 2 -pady 3 2349 grid [entry $expgui(scaleBox).ent1 -textvariable entryvar(scale) -width 15] \ 2350 -row 1 -column 1 -sticky ew -padx 4 -pady 3 2351 button $expgui(scaleBox).but1 -text "Set Globally" \ 2352 -command "editglobalparm histinfo scale {Scale Factor}" 2353 2354 grid [label $expgui(scaleBox).histSFRLabel -text " Refine"] \ 2355 -row 1 -column 2 -sticky nws -padx 2 -pady 3 2356 grid [checkbutton $expgui(scaleBox).rf -variable entryvar(sref)] \ 2357 -row 1 -column 3 -sticky news -padx 4 -pady 3 2358 grid [label $expgui(scaleBox).lD1 -text "Damping"] \ 2359 -row 1 -column 4 -sticky w -padx 2 -pady 3 2360 tk_optionMenu $expgui(scaleBox).om entryvar(sdamp) 0 1 2 3 4 5 6 7 8 9 2361 grid $expgui(scaleBox).om \ 2362 -row 1 -column 5 -sticky news -padx 4 -pady 3 2363 grid columnconfigure $expgui(scaleBox) 6 -weight 1 2364 2365 grid [set expgui(FracBox) [canvas $expgui(fracFrame).f1.fracBox \ 2366 -scrollregion {0 0 5000 500} -width 500 -height 350 -bg lightgrey]] \ 2367 -sticky news -row 1 -column 0 2368 grid [scrollbar $expgui(fracFrame).f1.yscroll -orient vertical] \ 2369 -sticky ns -row 1 -column 1 2370 2371 $expgui(FracBox) config -yscrollcommand "$expgui(fracFrame).f1.yscroll set" 2372 $expgui(fracFrame).f1.yscroll config -command { $expgui(FracBox) yview } 2373 2374 grid columnconfigure $expgui(fracFrame).f1 0 -weight 1 2375 grid rowconfigure $expgui(fracFrame).f1 0 -weight 1 2376 frame $expgui(FracBox).f -bd 0 2377 $expgui(FracBox) create window 0 0 -anchor nw -window $expgui(FracBox).f 2323 2378 2324 2379 # the rest of the page is created in DisplayFrac 2325 # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF PHASE FRACTIONPANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^2380 # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF SCALING PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 2326 2381 ############################################################################### 2327 2382 # v v v v v v v v v v BEGINNING OF PROFILE PANE CODE v v v v v v v v v v v v v … … 2547 2602 $expgui(fm).file.menu add checkbutton -label "Archive EXP" -variable expgui(archive) -underline 0 2548 2603 $expgui(fm).file.menu add command -label "Save" -underline 0 \ 2549 -command " archiveexp $expfile; set expgui(changed) 0"2604 -command {savearchiveexp $expfile} 2550 2605 $expgui(fm).file.menu add command -label "Save As" -underline 1 \ 2551 2606 -command "SaveAsFile"
Note: See TracChangeset
for help on using the changeset viewer.