Changeset 746 for trunk/expgui


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

# on 2003/11/13 17:16:28, toby did:
Updates for OSX: window resize & catch puts
clean up the way "use new name" works for archived .EXP files
remove obsolete references to tkButtonInvoke

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 2003/08/11 18:14:54 to 2003/11/13 17:16:28
    • Property rcs:lines changed from +18 -3 to +37 -30
    • Property rcs:rev changed from 1.62 to 1.63
    r720 r746  
    193193} else {
    194194    set expgui(exptool) [file join $expgui(gsasexe) exptool]
    195     if [catch {set env(GSASBACKSPACE)}] {set env(GSASBACKSPACE) 1}
     195    if {$tcl_platform(os) != "Darwin"} {
     196        if [catch {set env(GSASBACKSPACE)}] {set env(GSASBACKSPACE) 1}
     197    }
    196198}
    197199# do we have a PGPLOT fonts file?
     
    249251    }
    250252}
     253set expgui(resize) 0
    251254if {$expgui(expfile) == ""} {
    252255    # center the parent window because the getExpFileName window
     
    261264    update
    262265    #
    263     set expgui(expfile) [getExpFileName old]
     266    set expgui(expfile) [getExpFileName ""]
     267    set expgui(resize) 1
    264268}
    265269if {$expgui(expfile) == ""} exit
     
    314318                close $fp
    315319            }
    316         }
    317         file copy -force $expfile $expnam.EXP
    318         set fmt [expload $expfile]
    319         # if the file was not in the correct format, force a rewrite before use
    320         if {$fmt < 0} {
    321             # read error
    322             return
    323         } elseif {$fmt == 1} {
    324             set expgui(changed) 0
    325         } else {
    326             set expgui(changed) 1
    327         }
    328         set expfile $expnam.EXP
     320            file copy -force $expfile $expnam.EXP
     321            set expfile $expnam.EXP
     322        }
    329323        if {$ans == "use new name"} {
    330             SaveAsFile
    331             set expfile $expgui(expfile)
    332         }
     324            set newexpfile [getExpFileName new]
     325            if {$newexpfile == ""} return
     326            file copy -force $expfile $newexpfile
     327            catch {cd [string trim [file dirname $expgui(expfile)]]}
     328            set expfile [file tail $newexpfile]
     329        }
     330    }
     331    set expgui(expfile) $expfile
     332    set fmt [expload $expfile]
     333    # if the file was not in the correct format, force a rewrite before use
     334    if {$fmt < 0} {
     335        # read error
     336        return
     337    } elseif {$fmt == 1} {
     338        set expgui(changed) 0
    333339    } else {
    334         set exploadtime [time {set fmt [expload $expfile]}]
    335         if $expgui(debug) {puts "expload $exploadtime"}
    336         # if the file was not in the correct format, force a rewrite before use
    337         if {$fmt < 0} {
    338             # read error
    339             return
    340         } elseif {$fmt == 1} {
    341             set expgui(changed) 0
    342         } else {
    343             set expgui(changed) 1
    344         }
     340        set expgui(changed) 1
    345341    }
    346342    # force exp files to be upper case, force save if name changes
     
    764760    }
    765761    # Create a binding for <Return> on the dialog
    766     bind $w <Return> "tkButtonInvoke $w.bot.1"
     762    bind $w <Return> "$w.bot.1 invoke"
    767763    wm withdraw $w
    768764    update idletasks
     
    42604256# resize the notebook to fit all the tabs and the largest page
    42614257ResizeNotebook
     4258if {$expgui(resize)} {
     4259    # this appears to be needed by OSX
     4260    update
     4261    wm geom . [winfo reqwidth .]x[winfo reqheight .]
     4262    # center the EXPGUI window
     4263    wm withdraw .
     4264    set x [expr [winfo screenwidth .]/2 - [winfo reqwidth .]/2 ]
     4265    set y [expr [winfo screenheight .]/2 - [winfo reqheight .]/2]
     4266    wm geom . +$x+$y
     4267    wm deiconify .
     4268}
    42624269
    42634270RaisePage lsFrame
Note: See TracChangeset for help on using the changeset viewer.