Changeset 996 for trunk/expgui
- Timestamp:
- Aug 27, 2010 11:14:50 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expgui
r995 r996 50 50 catch {if $env(EXPGUI_NOSHELL) {set expgui(shell) 0}} 51 51 52 set expgui(expfile) {} 52 53 if {$argv != ""} { 53 54 if {[string match *noshell* [string tolower $argv]]} { 54 55 #puts noshell 55 56 set expgui(shell) 0 56 set expgui(expfile)[lindex $argv 1]57 SetEXPfile [lindex $argv 1] 57 58 } else { 58 set expgui(expfile)[lindex $argv 0]59 SetEXPfile [lindex $argv 0] 59 60 } 60 61 if {[string match -nocase {.o[0-9a-f][0-9a-f]} \ … … 64 65 "At present you must use open (expnam) to open archived files" warning 0 "Continue" 65 66 set expgui(expfile) {} 66 } elseif {[string toupper [file extension $expgui(expfile)]] != ".EXP"} { 67 append expgui(expfile) ".EXP" 68 } 69 } else { 70 set expgui(expfile) {} 67 } 71 68 } 72 69 … … 133 130 set expgui(script) [file join [pwd] $expgui(script)] 134 131 } 135 set expgui(scriptdir) [file dirname $expgui(script) ] 132 # save the package installation location; fix if possible, warn later (after 133 # routines are sourced) 134 set scriptdir [ 135 set expgui(scriptdir) [file dirname $expgui(script) ] 136 ] 137 138 if {[string first " " $expgui(scriptdir)] != -1} { 139 if {$tcl_platform(platform) == "windows"} { 140 # translate to the windows 8.3 version, if supported for this drive 141 set expgui(scriptdir) [file attributes $expgui(scriptdir) -shortname] 142 } 143 } 136 144 set expgui(gsasdir) [file dirname $expgui(scriptdir)] 137 145 set expgui(gsasexe) [file join $expgui(gsasdir) exe] … … 156 164 #--------------------------------------------------------------------------- 157 165 # override options with locally defined values 158 setfilelist [file join $expgui(scriptdir) localconfig]166 lappend filelist [file join $expgui(scriptdir) localconfig] 159 167 if {$tcl_platform(platform) == "windows"} { 160 168 lappend filelist "c:/gsas.config" 161 } else { 162 lappend filelist [file join ~ .gsas_config] 163 } 169 } 170 lappend filelist [file join ~ .gsas_config] 164 171 if {[catch { 165 172 foreach file $filelist { … … 172 179 -helplink "expguierr.html Customizewarning" 173 180 } 181 # warn/stop on spaces in install location 182 if {[string first " " $scriptdir] != -1} { 183 if {$tcl_platform(platform) == "windows"} { 184 # did the translation it work? 185 if {[string first " " $expgui(scriptdir)] != -1} { 186 update 187 MyMessageBox -parent . -title "Spaces in path" \ 188 -message "You are using an install directory with a space in the name ($scriptdir) that on Windows that does not have a corresponding DOS name. Is this on a networked drive? This install location will not work for EXPGUI. Sorry." \ 189 -icon warning -type Quit -default quit 190 exit 191 } 192 } 193 set warn 1 194 catch {set warn $expgui(warnonscriptspace)} 195 if $warn { 196 update 197 MyMessageBox -parent . -title "Good luck..." \ 198 -message "You are using an install directory with a space in the name ($scriptdir) -- You may encounter bugs in EXPGUI that I am trying to fix. If so, please e-mail enough detail to Brian.Toby@ANL.gov so that I can try to reproduce it." \ 199 -icon warning -type Continue -default continue 200 set expgui(warnonscriptspace) 0 201 } 202 } 203 174 204 if [catch {package require BWidget}] { 175 205 set msg "Error loading the BWidget package: This should not happen if you use the version of Tcl/Tk (tcl84+.exe) distributed with EXPGUI" … … 269 299 } 270 300 #--------------------------------------------------------------------------- 271 if {$expgui(expfile) != ""} {272 # is there a space in the EXP name?273 if {[string first " " [file tail $expgui(expfile)]] != -1} {274 update275 MyMessageBox -parent . -title "File Name Error" \276 -message "File name \"$expgui(expfile)\" is invalid -- EXPGUI cannot process experiment files with spaces in the name" \277 -icon warning -type Continue -default continue278 # -helplink "expguierr.html OpenErr"279 set expgui(expfile) {}280 set expgui(resize) 1281 } elseif {[string first " " [file dirname $expgui(expfile)]] != -1} {282 update283 MyMessageBox -parent . -title "Good luck..." \284 -message "You are using a directory with a space in the name ([file dirname $expgui(expfile)]) -- You may encounter bugs in EXPGUI, which are being corrected as reported. Please e-mail them to Brian.Toby@ANL.gov so they can be fixed." \285 -icon warning -type Continue -default continue286 # -helplink "expguierr.html OpenErr"287 set expgui(resize) 1288 } elseif ![file exists $expgui(expfile)] {289 update290 set ans [291 MyMessageBox -parent . -title "File Open Error" \292 -message "File [file tail $expgui(expfile)] does not exist in [file dirname $expgui(expfile)]. OK to create?" \293 -icon question -type {"Select other" "Create"} -default "select other" \294 -helplink "expguierr.html OpenErr"295 ]296 if {[string tolower $ans] != "create"} {set expgui(expfile) {}}297 set expgui(resize) 1298 }299 }300 301 if {$expgui(expfile) == ""} { 301 302 # place the parent window because the getExpFileName window will be centered above it. … … 310 311 # I am not sure it is still needed. 311 312 update 312 # 313 set expgui(expfile) [getExpFileName ""] 313 SetEXPfile [getExpFileName ""] 314 314 set expgui(resize) 1 315 315 } 316 316 if {$expgui(expfile) == ""} exit 317 # you've been warned this .EXP does not exist!318 if ![file exists $expgui(expfile)] {319 # create an "empty" exp file320 createexp $expgui(expfile) \321 [getstring "title for experiment $expgui(expfile)" 60 0]322 }323 catch {cd [string trim [file dirname $expgui(expfile)]]}324 317 325 318 # … … 330 323 proc loadexp {expfile} { 331 324 global expgui expmap entryvar entrycmd tcl_platform 325 set prevexp $expgui(expfile) 332 326 # is this a compressed archive file? 333 327 if {[string match {*.O[0-9A-F][0-9A-F]} $expfile]} { 334 set expgui(expfile) {}335 328 set expnam [file rootname $expfile] 336 329 set ans [MyMessageBox -parent . -title "Load Archived File" \ … … 376 369 set expgui(needpowpref) 2 377 370 set expgui(needpowpref_why) "\tA new .EXP file was created\n" 378 } 379 } 380 set expgui(expfile) $expfile 371 SetEXPfile $newexpfile 372 } else { 373 SetEXPfile $expfile 374 } 375 if {$expgui(expfile) == ""} { 376 set expgui(expfile) $prevexp 377 return 378 } 379 } 381 380 382 381 # change the icon and assign an app to this .EXP file 383 global tcl_platform384 382 if {$tcl_platform(os) == "Darwin" && $expgui(MacAssignApp)} { 385 383 MacSetResourceFork $expfile 386 384 } 387 385 386 SetEXPfile $expfile 387 if {$expgui(expfile) == ""} { 388 set expgui(expfile) $prevexp 389 return 390 } 388 391 # read in the .EXP file 389 392 set fmt [expload $expfile] … … 397 400 set expgui(changed) 1 398 401 } 399 # force exp files to be upper case, force save if name changes400 set filetail [file tail $expfile]401 set filetailcaps [string toupper $filetail]402 if {$tcl_platform(platform) == "unix" && $filetail != $filetailcaps} {403 set expgui(changed) 1404 }405 if {[file dirname $expfile] == "."} {406 set expgui(expfile) $filetailcaps407 } else {408 set expgui(expfile) [file join \409 [file dirname $expfile] $filetailcaps]410 }411 412 402 mapexp 413 403 if {$expgui(MacroRunning)} { … … 518 508 proc SaveAsFile {} { 519 509 global expgui 510 global tcl_platform 511 set prevexp $expgui(expfile) 520 512 set newexpfile [getExpFileName new] 521 513 if {$newexpfile == ""} return 514 SetEXPfile $newexpfile 515 if {$expgui(expfile) == ""} { 516 set expgui(expfile) $prevexp 517 return 518 } 522 519 expwrite $newexpfile 523 set expgui(expfile) $newexpfile524 catch {cd [string trim [file dirname $expgui(expfile)]]}525 520 # change the icon and assign an app to this .EXP file 526 global tcl_platform527 521 if {$tcl_platform(os) == "Darwin" && $expgui(MacAssignApp)} { 528 522 MacSetResourceFork $expgui(expfile) … … 554 548 } 555 549 } 550 set prevexp $expgui(expfile) 556 551 set newexpfile [getExpFileName old] 557 552 if {$newexpfile == ""} return 553 SetEXPfile $newexpfile 554 if {$expgui(expfile) == ""} { 555 set expgui(expfile) $prevexp 556 return 557 } 558 558 559 559 # switch to the 1st page 560 560 RaisePage lsFrame 561 562 if ![file exists $newexpfile] {563 # you've been warned this .EXP does not exist!564 # create an "empty" exp file565 createexp $newexpfile \566 [getstring "title for experiment $newexpfile" 60 0]567 }568 set expgui(expfile) $newexpfile569 catch {cd [string trim [file dirname $expgui(expfile)]]}570 561 set expgui(globalmode) 0 571 562 loadexp $expgui(expfile) … … 4074 4065 4075 4066 4076 4077 4067 foreach num {1 2 3 4 5 6 7 8 9} { 4078 4068 grid [label $expgui(FobsExtractFrame).l$num -text $num] -row 1 -column $num … … 4139 4129 #------------------------------------------------------------------------- 4140 4130 #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv THE MENU BAR vvvvvvvvvvvvvvvvvvvvvv 4141 4142 4131 #---- file menu button 4143 4132 menubutton $expgui(fm).file -text File -menu $expgui(fm).file.menu
Note: See TracChangeset
for help on using the changeset viewer.