Changeset 658 for trunk/lstview


Ignore:
Timestamp:
Dec 4, 2009 5:09:51 PM (11 years ago)
Author:
toby
Message:

# on 2002/10/31 17:26:56, toby did:
trap gsas_config errors
prevent infinite loop in readsum

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lstview

    • Property rcs:date changed from 2002/02/11 17:32:15 to 2002/10/31 17:26:56
    • Property rcs:lines changed from +4 -2 to +28 -17
    • Property rcs:rev changed from 1.10 to 1.11
    r560 r658  
    194194        set npos [$win index "$pos+1line linestart"]
    195195        set fpos [$win index $pos-1line]
    196         set pos [$win search {Summary table} $npos+1line end]
    197196       
    198197        if {!$txtvw(plotvars)} continue
     
    200199        # parse outs the last listed cycle number
    201200        set lstcyc {}
    202         while {$fpos != "0.0" && $lstcyc == ""} {
    203             set line [$win get $fpos "$fpos lineend"]
    204             regexp {cycle *([0-9]+):} $line a lstcyc
    205             set fpos [$win index $fpos-1line]
    206         } 
     201        set fpos [$win search -backwards -nocase -regexp {cycle *[0-9]+ } $pos]
     202        if {$fpos != ""} {
     203            set end [$win index "$fpos lineend"]
     204            set lstcyc [lindex [$win get $fpos $end] 1]
     205        }
    207206        # get the cycle offset
    208207        set ncyc [lindex [$win get $npos "$npos lineend"] end]
     
    239238            if {$npos == $end} break
    240239        }
     240        set pos [$win search {Summary table} $npos+1line end]
    241241    }
    242242}
     
    348348    global txtvw
    349349    set fp [open [file join ~ .gsas_config] a]
    350     puts $fp "set txtvw(followcycle) $txtvw(followcycle)"
     350    puts $fp "set txtvw(followcycle) [list $txtvw(followcycle)]"
    351351    puts $fp "set txtvw(font) [list $txtvw(font)]"
    352352    close $fp
     
    385385}
    386386set expgui(scriptdir) [file dirname $expgui(script) ]
     387set expgui(docdir) [file join $expgui(scriptdir) doc]
     388# location for web pages, if not found locally
     389set expgui(website) www.ncnr.nist.gov/xtal/software/expgui
    387390
    388391source [file join $expgui(scriptdir) gsascmds.tcl]
     
    390393
    391394# override options with locally defined values
    392 if [file exists [file join $expgui(scriptdir) localconfig]] {
    393     source [file join $expgui(scriptdir) localconfig]
    394 }
    395 if [file exists [file join ~ .gsas_config]] {
    396     source [file join ~ .gsas_config]
    397 }
    398 
     395if {[catch {
     396    foreach file [list \
     397                      [file join $expgui(scriptdir) localconfig] \
     398                      [file join ~ .gsas_config]] {
     399        if [file exists $file] {source $file}
     400    }
     401} errmsg]} {
     402    set msg "Error reading file $file (aka [file nativename $file]): $errmsg"
     403    MyMessageBox -parent . -title "Customize warning" \
     404        -message $msg -icon warning -type Ignore -default ignore \
     405        -helplink "expguierr.html Customizewarning"
     406}
    399407
    400408set txtvw(lastchi) {}
     
    700708}
    701709donewaitmsg
    702 # read a file compressed file
    703 if {$zfil != ""} {updatetext $zfil 0; close $zfil}
     710# read a file compressed file, if present
     711if {$zfil != ""} {
     712    updatetext $zfil
     713    close $zfil
     714}
    704715# read the initial file
    705716updatetext $lstfp
Note: See TracChangeset for help on using the changeset viewer.