- Timestamp:
- Dec 4, 2009 4:59:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expgui
- Property rcs:date changed from 1999/01/13 05:02:47 to 1999/01/20 19:29:10
- Property rcs:lines changed from +59 -37 to +46 -28
- Property rcs:rev changed from 1.7 to 1.8
r28 r30 4 4 # to do: 5 5 # 6 # new file menu box w/sort by that allows for new .EXP names 6 # need to change heading and button label depending on where getExpFileName 7 # is called from 8 # 9 # fixup documentation and you are done! 7 10 # 8 11 # global background editing & profile work differently: should both … … 28 31 29 32 if {$argv != ""} { 30 set expgui(expfile) [lindex $argv 0]33 set expgui(expfile) $argv 31 34 if {[string toupper [file extension $expgui(expfile)]] != ".EXP"} { 32 35 append expgui(expfile) ".EXP" 33 36 } 34 37 } else { 35 # windows needs this update or focus gets screwed up after tk_getOpenFile 36 update 37 set expgui(expfile) [tk_getOpenFile -defaultextension .EXP \ 38 -filetypes {{"GSAS Experiment" ".EXP"}} -parent .] 39 } 40 if {$expgui(expfile) == ""} exit 38 set expgui(expfile) {} 39 } 41 40 42 41 set expgui(debug) 0 … … 59 58 set liveplot(hst) 1 60 59 set liveplot(legend) 1 60 set expgui(filesort) 1 61 61 62 62 #============================================================================= … … 102 102 set expgui(gsasdir) [file dirname $expgui(scriptdir)] 103 103 set expgui(gsasexe) [file join $expgui(gsasdir) exe] 104 catch {cd [string trim [file dirname $expgui(expfile)]]}105 104 #---------------------------------------------------------------- 106 105 # fetch EXP file processing routines … … 119 118 } 120 119 #--------------------------------------------------------------------------- 120 if {$expgui(expfile) != ""} { 121 if ![file exists $expgui(expfile)] { 122 update 123 set ans [tk_dialog .expFileErrorMsg "File Open Error" \ 124 "File $expgui(expfile) does not exist" error 0 "Create" "Open other"] 125 if $ans {set expgui(expfile) {}} 126 } 127 } 128 if {$expgui(expfile) == ""} { 129 # windows needs this update or focus gets screwed up after tk_getOpenFile 130 update 131 set expgui(expfile) [getExpFileName old] 132 } 133 if {$expgui(expfile) == ""} exit 134 # you've been warned this .EXP does not exist! 121 135 if ![file exists $expgui(expfile)] { 122 set ans [tk_dialog .expFileErrorMsg "File Open Error" \ 123 "File $expgui(expfile) does not exist" error 0 "Exit" "Create"] 124 if $ans { 125 # create an "empty" exp file 126 createexp $expgui(expfile) \ 127 [getstring "title for experiment $expgui(expfile)" 60 0] 128 } else { 129 exit 130 } 131 } 136 puts "creating $expgui(expfile)" 137 # create an "empty" exp file 138 createexp $expgui(expfile) \ 139 [getstring "title for experiment $expgui(expfile)" 60 0] 140 } 141 catch {cd [string trim [file dirname $expgui(expfile)]]} 132 142 133 143 # … … 235 245 proc SaveAsFile {} { 236 246 global expgui 237 set newexpfile [tk_getSaveFile -defaultextension .EXP \ 238 -filetypes {{"GSAS Experiment" ".EXP"}} -parent . \ 239 -initialdir [file dirname $expgui(expfile)] \ 240 -initialfile [file tail $expgui(expfile)] ] 247 set newexpfile [getExpFileName new] 241 248 if {$newexpfile == ""} return 242 249 set expgui(expfile) $newexpfile … … 254 261 # called to read a different .EXP file 255 262 proc readnewexp {} { 256 global expgui 263 global expgui expmap 257 264 if $expgui(changed) { 258 265 set decision [tk_dialog .instrSaveData {Save .EXP changes} \ … … 265 272 } 266 273 } 267 set newexpfile [tk_getOpenFile -defaultextension .EXP \ 268 -filetypes {{"GSAS Experiment" ".EXP"}} -parent . \ 269 -initialdir [file dirname $expgui(expfile)] ] 274 set newexpfile [getExpFileName old] 270 275 if {$newexpfile == ""} return 271 276 set expgui(expfile) $newexpfile 272 277 catch {cd [string trim [file dirname $expgui(expfile)]]} 273 278 loadexp $expgui(expfile) 279 280 # select the 1st phase 281 SelectOnePhase [lindex $expmap(phaselist) 0] 282 # select the first histogram in the list by default (if there are any) 283 if {[llength $expmap(histlistboxcontents)] > 0} {set expgui(curhist) 0} 284 if !$expgui(havetix) { 285 RaisePage lsFrame 286 } else { 287 .n raise lsPane 288 set expgui(pagenow) lsFrame 289 } 274 290 } 275 291 … … 344 360 puts $fp "set expgui(asorttype) $expgui(asorttype)" 345 361 puts $fp "set expgui(hsorttype) $expgui(hsorttype)" 362 puts $fp "set expgui(filesort) $expgui(filesort)" 346 363 if {$tcl_platform(platform) != "windows"} { 347 364 puts $fp "set env(GSASBACKSPACE) $env(GSASBACKSPACE)" … … 1747 1764 set histlist {} 1748 1765 foreach item $expgui(curhist) { 1749 lappend histlist [lindex $expmap(powderlist) $item] 1766 set hist [lindex $expmap(powderlist) $item] 1767 if {$hist != ""} {lappend histlist $hist} 1750 1768 } 1751 1769 set entrycmd(fobsextract) "histinfo [list $histlist] foextract" 1752 if {[llength $histlist] == 0 } {1770 if {[llength $histlist] == 0 || [string trim $histlist] == ""} { 1753 1771 foreach phase {1 2 3 4 5 6 7 8 9} { 1754 1772 $expgui(lsFrame).f1.a.l$phase config -fg grey
Note: See TracChangeset
for help on using the changeset viewer.