Changeset 996 for trunk


Ignore:
Timestamp:
Aug 27, 2010 11:14:50 PM (10 years ago)
Author:
toby
Message:

Many revisions for handling file names with spaces using new SetEXPfile proc.
Use of directories with spaces for data files is probably not a problem, since we cd there, but EXP file names and install locations can be messy. Convert names on windows, where possible, and warn for now.

fix DISAGL window buttons for files with spaces.

cleanup MakeScrollTable?

allow ~/.gsas_config on Windows.

for use update.bat instead of building file as needed;

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    r995 r996  
    5050catch {if $env(EXPGUI_NOSHELL) {set expgui(shell) 0}}
    5151
     52set expgui(expfile) {}
    5253if {$argv != ""} {
    5354    if {[string match *noshell* [string tolower $argv]]} {
    5455        #puts noshell
    5556        set expgui(shell) 0
    56         set expgui(expfile) [lindex $argv 1]
     57        SetEXPfile [lindex $argv 1]
    5758    } else {
    58         set expgui(expfile) [lindex $argv 0]
     59        SetEXPfile [lindex $argv 0]
    5960    }
    6061    if {[string match -nocase {.o[0-9a-f][0-9a-f]} \
     
    6465            "At present you must use open (expnam) to open archived files" warning 0 "Continue"
    6566        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    }
    7168}
    7269
     
    133130    set expgui(script) [file join [pwd] $expgui(script)]
    134131}
    135 set expgui(scriptdir) [file dirname $expgui(script) ]
     132# save the package installation location; fix if possible, warn later (after
     133# routines are sourced)
     134set scriptdir [
     135               set expgui(scriptdir) [file dirname $expgui(script) ]
     136               ]
     137
     138if {[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}
    136144set expgui(gsasdir) [file dirname $expgui(scriptdir)]
    137145set expgui(gsasexe) [file join $expgui(gsasdir) exe]
     
    156164#---------------------------------------------------------------------------
    157165# override options with locally defined values
    158 set filelist [file join $expgui(scriptdir) localconfig]
     166lappend filelist [file join $expgui(scriptdir) localconfig]
    159167if {$tcl_platform(platform) == "windows"} {
    160168    lappend filelist "c:/gsas.config"
    161 } else {
    162     lappend filelist [file join ~ .gsas_config]
    163 }
     169}
     170lappend filelist [file join ~ .gsas_config]
    164171if {[catch {
    165172    foreach file $filelist {
     
    172179        -helplink "expguierr.html Customizewarning"
    173180}
     181# warn/stop on spaces in install location
     182if {[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
    174204if [catch {package require BWidget}] {
    175205    set msg "Error loading the BWidget package: This should not happen if you use the version of Tcl/Tk (tcl84+.exe) distributed with EXPGUI"
     
    269299}
    270300#---------------------------------------------------------------------------
    271 if {$expgui(expfile) != ""} {
    272    # is there a space in the EXP name?
    273     if {[string first " " [file tail $expgui(expfile)]] != -1} {
    274         update
    275         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 continue
    278 #               -helplink "expguierr.html OpenErr"
    279         set expgui(expfile) {}
    280         set expgui(resize) 1
    281     } elseif {[string first " " [file dirname $expgui(expfile)]] != -1} {
    282         update
    283         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 continue
    286 #               -helplink "expguierr.html OpenErr"
    287         set expgui(resize) 1
    288     } elseif ![file exists $expgui(expfile)] {
    289         update
    290         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) 1
    298     }
    299 }
    300301if {$expgui(expfile) == ""} {
    301302    # place the parent window because the getExpFileName window will be centered above it.
     
    310311    # I am not sure it is still needed.
    311312    update
    312     #
    313     set expgui(expfile) [getExpFileName ""]
     313    SetEXPfile [getExpFileName ""]
    314314    set expgui(resize) 1
    315315}
    316316if {$expgui(expfile) == ""} exit
    317 # you've been warned this .EXP does not exist!
    318 if ![file exists $expgui(expfile)] {
    319     # create an "empty" exp file
    320     createexp $expgui(expfile) \
    321             [getstring "title for experiment $expgui(expfile)" 60 0]
    322 }
    323 catch {cd [string trim [file dirname $expgui(expfile)]]}
    324317
    325318#
     
    330323proc loadexp {expfile} {
    331324    global expgui expmap entryvar entrycmd tcl_platform
     325    set prevexp $expgui(expfile)
    332326    # is this a compressed archive file?
    333327    if {[string match {*.O[0-9A-F][0-9A-F]} $expfile]} {
    334         set expgui(expfile) {}
    335328        set expnam [file rootname $expfile]
    336329        set ans [MyMessageBox -parent . -title "Load Archived File" \
     
    376369            set expgui(needpowpref) 2
    377370            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    }
    381380
    382381    # change the icon and assign an app to this .EXP file
    383     global tcl_platform
    384382    if {$tcl_platform(os) == "Darwin" && $expgui(MacAssignApp)} {
    385383        MacSetResourceFork $expfile
    386384    }
    387385
     386    SetEXPfile $expfile
     387    if {$expgui(expfile) == ""} {
     388        set expgui(expfile) $prevexp
     389        return
     390    }
    388391    # read in the .EXP file
    389392    set fmt [expload $expfile]
     
    397400        set expgui(changed) 1
    398401    }
    399     # force exp files to be upper case, force save if name changes
    400     set filetail [file tail $expfile]
    401     set filetailcaps [string toupper $filetail]
    402     if {$tcl_platform(platform) == "unix" && $filetail != $filetailcaps} {
    403         set expgui(changed) 1
    404     }
    405     if {[file dirname $expfile] == "."} {
    406         set expgui(expfile) $filetailcaps
    407     } else {
    408         set expgui(expfile) [file join \
    409                 [file dirname $expfile] $filetailcaps]
    410     }
    411 
    412402    mapexp
    413403    if {$expgui(MacroRunning)} {
     
    518508proc SaveAsFile {} {
    519509    global expgui
     510    global tcl_platform
     511    set prevexp $expgui(expfile)
    520512    set newexpfile [getExpFileName new]
    521513    if {$newexpfile == ""} return
     514    SetEXPfile $newexpfile
     515    if {$expgui(expfile) == ""} {
     516        set expgui(expfile) $prevexp
     517        return
     518    }
    522519    expwrite $newexpfile
    523     set expgui(expfile) $newexpfile
    524     catch {cd [string trim [file dirname $expgui(expfile)]]}
    525520    # change the icon and assign an app to this .EXP file
    526     global tcl_platform
    527521    if {$tcl_platform(os) == "Darwin" && $expgui(MacAssignApp)} {
    528522        MacSetResourceFork $expgui(expfile)
     
    554548        }
    555549    }
     550    set prevexp $expgui(expfile)
    556551    set newexpfile [getExpFileName old]
    557552    if {$newexpfile == ""} return
     553    SetEXPfile $newexpfile
     554    if {$expgui(expfile) == ""} {
     555        set expgui(expfile) $prevexp
     556        return
     557    }
    558558
    559559    # switch to the 1st page
    560560    RaisePage lsFrame
    561 
    562     if ![file exists $newexpfile] {
    563         # you've been warned this .EXP does not exist!
    564         # create an "empty" exp file
    565         createexp $newexpfile \
    566                 [getstring "title for experiment $newexpfile" 60 0]
    567     }
    568     set expgui(expfile) $newexpfile
    569     catch {cd [string trim [file dirname $expgui(expfile)]]}
    570561    set expgui(globalmode) 0
    571562    loadexp $expgui(expfile)
     
    40744065
    40754066
    4076 
    40774067foreach num {1 2 3 4 5 6 7 8 9} {
    40784068    grid [label $expgui(FobsExtractFrame).l$num -text $num] -row 1 -column $num
     
    41394129#-------------------------------------------------------------------------
    41404130#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv THE MENU BAR vvvvvvvvvvvvvvvvvvvvvv
    4141 
    41424131#---- file menu button
    41434132menubutton $expgui(fm).file -text File -menu $expgui(fm).file.menu
  • trunk/gsascmds.tcl

    r995 r996  
    15741574        grid columnconfig .disagl.f 2 -weight 1
    15751575        grid [button .disagl.f.close -text "Close & Delete" \
    1576                 -command "destroy .disagl; file delete $root.tmp"] \
     1576                  -command "destroy .disagl; file delete \[list $root.tmp\]"] \
    15771577                -column 3 -row 0 -sticky e
    15781578        grid [button .disagl.f.rename \
    1579                 -command "RenameAsFile $root.tmp $root.DIS .disagl" \
     1579                  -command "RenameAsFile \[list $root.tmp\] \[list $root.DIS\] .disagl" \
    15801580                -text "Close & Save as..."] \
    15811581                -column 4 -row 0 -sticky e
     
    19491949
    19501950#------------------------------------------------------------------------------
    1951 # get an experiment file name
     1951# get/validate an experiment file name
    19521952#------------------------------------------------------------------------------
     1953# validate and store the EXP file name. Create a new .EXP file if it does not
     1954# exist and set the wd to the location of the .EXP file.
     1955proc SetEXPfile {expfile} {
     1956    global expgui tcl_platform
     1957    set expgui(expfile) {}
     1958    if {[string trim $expfile] == ""} return
     1959
     1960    # break up the file name and directory
     1961    set dirname [file dirname $expfile]
     1962    set expname [string toupper [file tail $expfile]]
     1963
     1964    # check the directory exists
     1965    if {(! [file exists $dirname]) || (! [file isdir $dirname])} {
     1966        update
     1967        MyMessageBox -parent . -title "Directory not found" \
     1968            -message "Experiment file location \"$dirname\" is invalid -- no such directory exists" \
     1969            -icon warning -type Continue -default continue
     1970        set expgui(resize) 1
     1971        return
     1972    }
     1973
     1974    # is there a space in the directory name? On windows, try to fix it
     1975    set origdir $dirname
     1976    if {[string first " " $dirname] != -1} {
     1977        set warn 1
     1978        catch {set warn $expgui(warnonspaceonce)}
     1979        if {$tcl_platform(platform) == "windows"} {
     1980            set dirname [file attributes $dirname -shortname]
     1981            # was the fix successful?
     1982            if {[string first " " $dirname] == -1} {
     1983                if {$warn} {
     1984                    update
     1985                    MyMessageBox -parent . -title "Still debugging..." \
     1986                        -message "You are using a directory with a space in the name ($origdir) that will be translated for Windows (to $dirname) -- This should obliviate bugs in EXPGUI, but if still you encounter any please e-mail bug details to Brian.Toby@ANL.gov so they can be fixed." \
     1987                    -icon warning -type Continue -default continue
     1988                    set expgui(resize) 1
     1989                }
     1990            } else {
     1991                if {$warn} {
     1992                    update
     1993                    MyMessageBox -parent . -title "Can't fix dir" \
     1994                        -message "You are using a directory with a space in the name ($origdir) in Windows that cannot be translated to a name without spaces (is this a network drive?) -- this could cause problems in EXPGUI. Please e-mail bug details to Brian.Toby@ANL.gov so they can be fixed." \
     1995                        -icon warning -type Continue -default continue
     1996                    set expgui(resize) 1
     1997                }
     1998            }
     1999        } elseif {$warn} {
     2000            if {$warn} {
     2001                update
     2002                MyMessageBox -parent . -title "Still debugging..." \
     2003                    -message "You are using a directory with a space in the name ($origdir). This is not perhaps a wise idea, but I am trying to catch any bugs this causes in EXPGUI. If you encounter any, please e-mail bug details to Brian.Toby@ANL.gov so they can be fixed." \
     2004                    -icon warning -type Continue -default continue
     2005                set expgui(resize) 1
     2006            }
     2007        }
     2008        set expgui(warnonspaceonce) 0
     2009    }
     2010
     2011    # force exp files to be upper case, set to force save if name changes
     2012    set origexp $expname
     2013    if {$expname != [string toupper $expfile]} {
     2014        set expname [string toupper [file tail $expfile]]
     2015        if {$tcl_platform(platform) != "windows"} {set expgui(changed) 1}
     2016    }
     2017    if {[file extension $expname] != ".EXP"} {
     2018        append expname ".EXP"
     2019    }
     2020    if {$dirname == "."} {
     2021        set newexpfile $expname
     2022    } else {
     2023        set newexpfile [file join $dirname $expname]
     2024    }
     2025    # is there a space in the EXP name?
     2026    if {[string first " " $expname] != -1} {
     2027        # If the file exists in windows, see if there is an equivalent name available.
     2028        # if not, we could try to create it and then see, but that is too much
     2029        # work.
     2030        if {$tcl_platform(platform) == "windows"} {
     2031            if {[file exists $newexpfile]} {
     2032                # try to translate it, if possible
     2033                set expname [file tail [file attributes $newexpfile -shortname]]
     2034                set newexpfile [file join $dirname $expname]
     2035                # fixed?
     2036                if {[string first " " $expname] == -1} {
     2037                    set warn 1
     2038                    catch {set warn $expgui(warnonexpspaceonce)}
     2039                    if {$warn} {
     2040                        update
     2041                        MyMessageBox -parent . -title "Still debugging..." \
     2042                            -message "You are using an EXP file name with a space in the name ($origexp) that will be translated for Windows (to $expname) -- This should obliviate bugs in EXPGUI, but if you still do encounter any please e-mail bug details to Brian.Toby@ANL.gov so they can be fixed." \
     2043                            -icon warning -type Continue -default continue
     2044                    set expgui(resize) 1
     2045                    }
     2046                    set expgui(warnonexpspaceonce) 0
     2047                }
     2048            }
     2049            if {[string first " " $expname] != -1} {
     2050                # not fixed (file does not exist or shortname not supported)
     2051                update
     2052                MyMessageBox -parent . -title "Can't fix name" \
     2053                    -message "You are using an EXP file name with a space in the name ($origexp) in Windows that cannot be translated without spaces (is this a network drive?) -- this will cause problems in EXPGUI. Sorry." \
     2054                    -icon warning -type Continue -default continue
     2055                set expgui(resize) 1
     2056                return
     2057            }
     2058        } else {
     2059            update
     2060            MyMessageBox -parent . -title "Space in name" \
     2061                -message "You are using an EXP file name with a space in the name ($origexp). This is likely to cause problems. Please rename the file or create one with another name. Sorry." \
     2062                -icon warning -type Continue -default continue
     2063            set expgui(resize) 1
     2064            return
     2065        }
     2066    }
     2067
     2068    if {! [file exists $newexpfile]} {
     2069        update
     2070        set ans [
     2071                 MyMessageBox -parent . -title "File Open Error" \
     2072                     -message "File $expname does not exist in ${dirname}. OK to create?" \
     2073                     -icon question -type {"Select other" "Create"} -default "select other" \
     2074                     -helplink "expguierr.html OpenErr"
     2075                ]
     2076        set expgui(resize) 1
     2077        if {[string tolower $ans] == "create"} {
     2078            # you've been warned this .EXP does not exist!
     2079            # create an "empty" exp file
     2080            createexp $newexpfile \
     2081                [getstring "title for experiment $expname" 60 0]
     2082            if {! [file exists [file join $dirname $expname]]} {
     2083                update
     2084                MyMessageBox -parent . -title "File Creation Error" \
     2085                    -message "Experiment file name \"$expname\" was not created -- This is unexpected, please try a different name" \
     2086                    -icon warning -type Continue -default continue
     2087                set expgui(resize) 1
     2088                return
     2089            }
     2090        } else {
     2091            return
     2092        }
     2093    }
     2094    set expgui(expfile) $newexpfile
     2095    catch {cd [string trim [file dirname $expgui(expfile)]]}
     2096}
     2097
    19532098proc getExpFileName {mode} {
    19542099    global expgui tcl_platform
     
    20102155    if {$expgui(FileMenuEXPNAM) == ""} return
    20112156    # is there a space in the EXP name?
    2012     if {[string first " " [file tail $expgui(FileMenuEXPNAM)]] != -1} {
    2013         update
    2014         MyMessageBox -parent . -title "File Name Error" \
    2015             -message "File name \"$expgui(FileMenuEXPNAM)\" is invalid -- EXPGUI cannot process experiment files with spaces in the name" \
    2016             -icon warning -type Continue -default continue
     2157#    if {[string first " " [file tail $expgui(FileMenuEXPNAM)]] != -1} {
     2158#       update
     2159#       MyMessageBox -parent . -title "File Name Error" \
     2160#           -message "File name \"$expgui(FileMenuEXPNAM)\" is invalid -- EXPGUI can#not process experiment files with spaces in the name" \
     2161#           -icon warning -type Continue -default continue
    20172162#               -helplink "expguierr.html OpenErr"
    2018         return
    2019     }
    2020     if {[string first " " $expgui(FileMenuDir)] != -1} {
    2021         update
    2022         MyMessageBox -parent . -title "Good luck..." \
    2023             -message "You are using a directory with a space in the name ([file dirname $expgui(FileMenuDir)]) -- You may encounter bugs in EXPGUI. Please e-mail them to Brian.Toby@ANL.gov so they can be fixed." \
    2024             -icon warning -type Continue -default continue
    2025 #               -helplink "expguierr.html OpenErr"
    2026     }
     2163#       return
     2164#    }
     2165#    if {[string first " " $expgui(FileMenuDir)] != -1} {
     2166#       set warn 1
     2167#       catch {set warn $expgui(warnonexpdirspace)}
     2168#       if $warn {
     2169#           update
     2170#           MyMessageBox -parent . -title "Good luck..." \
     2171#               -message "You are using a directory with a space in the name ($expgui(FileMenuDir)) -- You may encounter bugs in EXPGUI. Please e-mail them to Brian.Toby@ANL.gov so they can be fixed." \
     2172#               -icon warning -type Continue -default continue
     2173#           #           -helplink "expguierr.html OpenErr"
     2174#           set expgui(warnonexpdirspace) 0
     2175#       }
     2176#    }
    20272177    return [file join $expgui(FileMenuDir) $expgui(FileMenuEXPNAM)]
    20282178}
     
    20592209    }
    20602210    # is there a space in the name?
    2061     if {[string first " " $expgui(FileMenuEXPNAM)] != -1} {
    2062         MyMessageBox -parent . -title "File Name Error" \
    2063                 -message "File name $expgui(FileMenuEXPNAM) is invalid -- EXPGUI cannot process experiment files with spaces in the name" \
    2064                 -icon warning -type Continue -default continue
     2211#    if {[string first " " $expgui(FileMenuEXPNAM)] != -1} {
     2212#       MyMessageBox -parent . -title "File Name Error" \
     2213#               -message "File name $expgui(FileMenuEXPNAM) is invalid -- EXPGUI cannot process experiment files with spaces in the name" \
     2214#               -icon warning -type Continue -default continue
    20652215#               -helplink "expguierr.html OpenErr"
    2066         return
    2067     }
     2216#       return
     2217#    }
    20682218    # check for archive files
    20692219    if {[string match {*.O[0-9A-F][0-9A-F]} $expgui(FileMenuEXPNAM)] && \
     
    21542304    pack [entry $bx.c -textvariable expgui(FileMenuEXPNAM)] -side top
    21552305}
    2156 proc sync2boxesX {master slave scroll args} {
    2157     $slave xview moveto [lindex [$master xview] 0]
    2158     eval $scroll set $args
    2159 }
    2160 proc move2boxesX {boxlist args} {
    2161     foreach listbox $boxlist {
    2162         eval $listbox xview $args
    2163     }
    2164 }
    21652306proc sync2boxesY {master slave scroll args} {
    21662307    $slave yview moveto [lindex [$master yview] 0]
     
    21742315
    21752316# creates a table that is scrollable in both x and y, use ResizeScrollTable
    2176 # to set sizes after gridding the boxes
     2317# to set sizes after gridding the widgets
    21772318proc MakeScrollTable {box} {
     2319    proc sync2boxes {cmd master slave scroll args} {
     2320        $slave $cmd moveto [lindex [$master $cmd] 0]
     2321        eval $scroll set $args
     2322    }
     2323    proc move2boxes {cmd box1 box2 args} {
     2324        eval $box1 $cmd $args
     2325        eval $box2 $cmd $args
     2326    }
    21782327    grid [label $box.0] -column 0 -row 0
    2179     grid [set tbox [canvas $box.top \
    2180             -scrollregion {0 0 10 10} \
    2181             -xscrollcommand "sync2boxesX $box.top $box.can $box.scroll" \
    2182             -width 10 -height 10]] \
    2183             -sticky sew -row 0 -column 1
    2184     grid [set sbox [canvas $box.side \
    2185             -scrollregion {0 0 10 10} \
    2186             -yscrollcommand "sync2boxesY $box.side $box.can $box.yscroll" \
    2187             -width 10 -height 10]] \
    2188             -sticky nes -row 1 -column 0
    2189     grid [set bbox [canvas $box.can \
    2190             -scrollregion {0 0 10 10} \
    2191             -yscrollcommand "sync2boxesY $box.can $box.side $box.yscroll" \
    2192             -xscrollcommand "sync2boxesX $box.can $box.top $box.scroll" \
    2193             -width 200 -height 200 -bg lightgrey]] \
    2194             -sticky news -row 1 -column 1
     2328    grid [canvas $box.top -scrollregion {0 0 10 10} \
     2329            -xscrollcommand "sync2boxes xview $box.top $box.can $box.scroll" \
     2330            -width 10 -height 10] -sticky sew -row 0 -column 1
     2331    grid [canvas $box.side -scrollregion {0 0 10 10} \
     2332            -yscrollcommand "sync2boxes yview $box.side $box.can $box.yscroll" \
     2333            -width 10 -height 10] -sticky nes -row 1 -column 0
     2334    grid [canvas $box.can -scrollregion {0 0 10 10} \
     2335            -yscrollcommand "sync2boxes yview $box.can $box.side $box.yscroll" \
     2336            -xscrollcommand "sync2boxes xview $box.can $box.top $box.scroll" \
     2337            -width 200 -height 200 -bg lightgrey] -sticky news -row 1 -column 1
    21952338    grid [set sxbox [scrollbar $box.scroll -orient horizontal \
    2196             -command "move2boxesX \" $box.can $box.top \" "]] \
     2339                         -command "move2boxes xview $box.can $box.top"]] \
    21972340            -sticky ew -row 2 -column 1
    21982341    grid [set sybox [scrollbar $box.yscroll \
    2199             -command "move2boxesY \" $box.can $box.side \" "]] \
     2342                         -command "move2boxes yview $box.can $box.side"]] \
    22002343            -sticky ns -row 1 -column 2
    2201     frame $tbox.f -bd 0
    2202     $tbox create window 0 0 -anchor nw  -window $tbox.f
    2203     frame $bbox.f -bd 2
    2204     $bbox create window 0 0 -anchor nw  -window $bbox.f
    2205     frame $sbox.f -bd 2 -relief raised
    2206     $sbox create window 0 0 -anchor nw  -window $sbox.f
     2344
     2345    $box.top create window 0 0 -anchor nw  -window [frame $box.top.f -bd 0]
     2346    $box.can create window 0 0 -anchor nw  -window [frame $box.can.f -bd 2]
     2347    $box.side create window 0 0 -anchor nw  -window [frame $box.side.f -bd 2]
     2348
    22072349    grid columnconfig $box 1 -weight 1
    22082350    grid rowconfig $box 1 -weight 1
    2209     return [list  $tbox.f  $bbox.f $sbox.f $box.0]
     2351    return [list  $box.top.f  $box.can.f $box.side.f $box.0]
    22102352}
    22112353
     
    22312373    $box.side config -scrollregion $sizes
    22322374    $box.top config -scrollregion $sizes
     2375    $box.side config -width [lindex [grid bbox $box.side.f] 2]
    22332376    $box.top config -height [lindex [grid bbox $box.top.f] 3]
    2234     $box.side config -width [lindex [grid bbox $box.side.f] 2]
    2235 }
     2377    # remove the scroll when not needed
     2378    if {[lindex $sizes 3] > [winfo height $box.can]} {
     2379        grid $box.yscroll -sticky ns -column 2 -row 1
     2380    } else {
     2381        grid forget $box.yscroll
     2382    }
     2383    if {[lindex $sizes 2] > [winfo width $box.can]} {
     2384        grid $box.scroll -sticky ew -column 1 -row 2
     2385    } else {
     2386        grid forget $box.scroll
     2387    }
     2388}
     2389
     2390# this is used in cifselect -- not sure why anymore
    22362391proc ExpandScrollTable {box} {
    22372392    # set height & width of central box
     
    34023557    if {[confirmBeforeSave] == "Cancel"} return
    34033558
    3404      # special upgrade for windows, where the wish exec blocks upgrade of the exe directory
     3559    # special upgrade for windows, where the wish exec blocks upgrade of the exe directory
    34053560    if {$::tcl_platform(platform) == "windows" && $::tcl_platform(os) != "Windows 95"} {
    3406         # create a batch file
    3407         set out [file normalize ~/expgui_update.bat]
    3408         set fp [open [file normalize ~/expgui_update.bat] w]
    3409         puts $fp "@echo *"
    3410         puts $fp "@echo ******************************************************************"
    3411         puts $fp "@echo Preparing to start upgrade of EXPGUI."
    3412         puts $fp "@pause"
    3413         puts $fp "$SVN cleanup $::expgui(gsasdir)"
    3414         puts $fp "$SVN up $::expgui(gsasdir)"
    3415         puts $fp "@echo *"
    3416         puts $fp "@echo ******************************************************************"
    3417         puts $fp "@echo Upgrade is complete. This window will close and EXPGUI will restart."
    3418         puts $fp "@pause"
    3419         puts $fp "$::env(COMSPEC) /c \"start [info nameofexecutable] \
    3420 [file attributes [file normalize $::expgui(script)] -shortname] \
    3421 [file attributes [file normalize $::expgui(expfile)] -shortname] \""
    3422         puts $fp "exit"
    3423         close $fp
     3561        # split the directory and EXP file and get rid os spaces in the directory name
     3562        set exp [file normalize $::expgui(expfile)]
     3563        set dir [file attributes [file dirname $exp] -shortname]
     3564        cd $::expgui(gsasdir)
    34243565        #run the batch file
    3425         exec $::env(COMSPEC) /c "start [file nativename [file attributes $out -shortname]]" &
     3566        exec $::env(COMSPEC) /c {start .\update.bat [file join $dir [file tail $exp]]} &
    34263567        exit
    34273568    }
Note: See TracChangeset for help on using the changeset viewer.