Changeset 390 for trunk/expgui


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

# on 2001/05/11 16:18:58, toby did:
change in location of PGPLOT font file in Windows (now same for all)
support gzip compressed archive files as input in Unix
fix bug on disable "add histogram" button (button is missing if no EXPTOOL)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 2001/04/17 22:51:20 to 2001/05/11 16:18:58
    • Property rcs:lines changed from +5 -7 to +75 -28
    • Property rcs:rev changed from 1.41 to 1.42
    r385 r390  
    167167    #
    168168    set expgui(exptool) [file join $expgui(gsasexe) exptool.exe]
    169     if ![file exists [file join $expgui(gsasdir) fonts grfont.dat]] {
    170         MyMessageBox -parent . -title "PGPLOT Error" \
    171                 -message "Warning -- Unable to find file GRFONT.DAT. GSAS graphics will not work. Is GSAS correctly installed?" \
    172                 -icon warning -type {"Limp Ahead"} -default "Limp Ahead" \
    173                 -helplink "expguierr.html NoPGPLOT"
    174     }
    175169} else {
    176170    set expgui(exptool) [file join $expgui(gsasexe) exptool]
    177     if ![file exists [file join $expgui(gsasdir) pgl grfont.dat]] {
    178         MyMessageBox -parent . -title "PGPLOT Error" \
    179                 -message "Warning -- Unable to find file grfont.dat. GSAS graphics will not work. Is GSAS correctly installed?" \
    180                 -icon warning -type {"Limp Ahead"} -default "Limp Ahead" \
    181                 -helplink "expguierr.html NoPGPLOT"
    182     }
    183171    if [catch {set env(GSASBACKSPACE)}] {set env(GSASBACKSPACE) 1}
     172}
     173# do we have a PGPLOT fonts file?
     174if ![file exists [file join $expgui(gsasdir) pgl grfont.dat]] {
     175    MyMessageBox -parent . -title "PGPLOT Error" \
     176            -message "Warning -- Unable to find file GRFONT.DAT. GSAS graphics will not work. Is GSAS correctly installed?" \
     177            -icon warning -type {"Limp Ahead"} -default "Limp Ahead" \
     178            -helplink "expguierr.html NoPGPLOT"
    184179}
    185180#---------------------------------------------------------------------------
     
    226221proc loadexp {expfile} {
    227222    global expgui expmap entryvar entrycmd tcl_platform
    228     set exploadtime [time {set fmt [expload $expfile]}]
    229     if $expgui(debug) {puts "expload $exploadtime"}
    230     # if the file was not in the correct format, force a rewrite before use
    231     if {$fmt < 0} {
    232         # read error
    233         return
    234     } elseif {$fmt == 1} {
    235         set expgui(changed) 0
     223    # is this a compressed archive file?
     224    if {[string match {*.EXP.[0-9][0-9][0-9].gz} $expfile] && \
     225            $tcl_platform(platform) == "unix"} {
     226        regexp {.*.EXP} $expfile rootname
     227        if {[auto_execok gunzip] == ""} {
     228            # tno gunzip -- bail out
     229            MyMessageBox -parent . -title "Cannot Load Archived File" \
     230                -message "Unable to find the gunzip program in your path. Loading this archived version of [file tail $rootname] requires the gzip program. Load gunzip or fix your path and then restart EXPGUI" \
     231                -icon error
     232            return
     233        }
     234        set ans [MyMessageBox -parent . -title "Load Archived File" \
     235                -message "Loading archived version of [file tail $rootname]. Do you want to overwrite $rootname or save the archived version under a new name?" \
     236                -icon question -type "{Use New Name} Overwrite"\
     237                -default {Use New Name} \
     238                -helplink "expguierr.html LoadArchived"
     239        ]
     240        set fmt [expload $expfile]
     241        if {$fmt < 0} {
     242            # read error
     243            return
     244        }
     245        set expgui(changed) 1
     246        set expfile $rootname
     247        if {$ans == "use new name"} {
     248            SaveAsFile
     249            set expfile $expgui(expfile)
     250        }
     251    # is this an uncompressed archive file?
     252    } elseif {[string match {*.EXP.[0-9][0-9][0-9]} $expfile] && \
     253            $tcl_platform(platform) == "unix"} {
     254        regexp {.*.EXP} $expfile rootname
     255        set ans [MyMessageBox -parent . -title "Load Archived File" \
     256                -message "Loading archived version of [file tail $rootname]. Do you want to overwrite $rootname or save the archived version under a new name?" \
     257                -icon question -type "{Use New Name} Overwrite"\
     258                -default {Use New Name} \
     259                -helplink "expguierr.html LoadArchived"
     260        ]
     261        set fmt [expload $expfile]
     262        if {$fmt < 0} {
     263            # read error
     264            return
     265        }
     266        set expgui(changed) 1
     267        set expfile $rootname
     268        if {$ans == "use new name"} {
     269            SaveAsFile
     270            set expfile $expgui(expfile)
     271        }
    236272    } else {
    237         set expgui(changed) 1
    238     }
    239 
     273        set exploadtime [time {set fmt [expload $expfile]}]
     274        if $expgui(debug) {puts "expload $exploadtime"}
     275        # if the file was not in the correct format, force a rewrite before use
     276        if {$fmt < 0} {
     277            # read error
     278            return
     279        } elseif {$fmt == 1} {
     280            set expgui(changed) 0
     281        } else {
     282            set expgui(changed) 1
     283        }
     284    }
    240285    # force exp files to be upper case, force save if name changes
    241286    set filetail [file tail $expfile]
     
    13281373
    13291374    # disable the add histogram button if no phases are present
    1330     if {[llength $expmap(phaselist)] == 0} {
    1331         $expgui(histFrame).newh configure -state disabled
    1332     } else {
    1333         $expgui(histFrame).newh configure -state normal
     1375    catch {
     1376        if {[llength $expmap(phaselist)] == 0} {
     1377            $expgui(histFrame).newh configure -state disabled
     1378        } else {
     1379            $expgui(histFrame).newh configure -state normal
     1380        }
    13341381    }
    13351382
Note: See TracChangeset for help on using the changeset viewer.