Changeset 908


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

# on 2008/04/15 17:15:53, toby did:
macro recording
implement "Prompt after GSAS run option", replay macro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 2007/01/17 04:21:56 to 2008/04/15 17:15:53
    • Property rcs:lines changed from +17 -4 to +85 -19
    • Property rcs:rev changed from 1.81 to 1.82
    r884 r908  
    8585# default for autoexec load = off
    8686set expgui(autoexpload) 0
     87# default for execprompt = on
     88set expgui(execprompt) 1
    8789# default for autostart GRWND = off
    8890set expgui(autoGRWND) 0
     
    263265        update
    264266        MyMessageBox -parent . -title "Good luck..." \
    265             -message "You are using a directory with a space in the name ([file dirname $expgui(expfile)]) -- You may encounter bugs in EXPGUI. Please e-mail them to Brian.Toby@NIST.gov so they can be fixed." \
     267            -message "You are using a directory with a space in the name ([file dirname $expgui(expfile)]) -- You may encounter bugs in EXPGUI. Please e-mail them to Brian.Toby@ANL.gov so they can be fixed." \
    266268                -icon warning -type Continue -default continue
    267269#               -helplink "expguierr.html OpenErr"
     
    391393
    392394    mapexp
     395    if {$expgui(MacroRunning)} {
     396        set expgui(MacroStatus) "?"
     397        catch {
     398            set expgui(MacroStatus) \
     399                "[expinfo cyclesrun] cycles; Chi2=$expgui(LastChi2); $expgui(LastnVars) vars"
     400        }
     401    }
     402
    393403    set expgui(expModifiedLast) 0
    394404    catch {
     
    401411    wm iconname . [file tail $expfile]
    402412
     413    # load current information into EXPGUI pages
     414    PaintEXPGUIpages
     415
     416    # start checking for external changes
     417    afterawhile
     418}
     419
     420# [re]load all screens with current state of EXPGUI file
     421proc PaintEXPGUIpages {} {
     422    global expgui expmap entryvar entrycmd
    403423    # reset the phase buttons
    404424    set expgui(curPhase) ""
     
    460480    # update the histogram list & update the page
    461481    sethistlist
    462 
    463     # start checking for external changes
    464     afterawhile
    465482}
    466483
     
    568585            } else {
    569586                catch {$entrybox($elem) config -fg black}
     587                RecordMacroEntry "incr expgui(changed); $entrycmd($elem) set [list $entryvar($elem)]" 1
    570588            }
    571589            if {[string match "*atominfo" [lindex $entrycmd($elem) 0]]} {
     
    602620    puts $fp "# EXPGUI saved options from [clock format [clock seconds]]"
    603621    set itemlist {archive asorttype hsorttype filesort disaglSeparateBox \
    604         font autoexpload autoiconify autotick}
     622        font autoexpload autoiconify autotick execprompt ShowGENLES}
    605623    if {$tcl_platform(os) == "Darwin"} {
    606624        lappend itemlist MacAssignApp
     
    631649"EXPGUI\n\
    632650Brian Toby\n\
    633 NIST Center for Neutron Research\n\n\
     651APS, Argonne National Laboratory\n\n\
    634652Not subject to copyright\n\n\
    635653Revision [lindex $expgui(Revision) 1] (readexp.tcl [lindex $expmap(Revision) 1])\n\n\
     
    873891    update idletasks
    874892
    875     # for windows put the box in the upper left, for
    876     # unix center it over the parent (in unix it appears later)
    877     #if {$tcl_platform(platform) == "windows"} {
    878         #wm geom $w +0+0
    879     #} else {
    880 
    881893    # compute widths with a catch, since this has been showing an error
    882894    # at least for one Mac user
     
    885897    set askhgt 80
    886898    catch {set askhgt [winfo reqheight $w]}
     899    catch {
    887900        # for now, always center the message over the main window
    888901        # center the new window in the middle of the parent
     
    892905                $askhgt/2 - [winfo vrooty .]]
    893906        wm geom $w +$x+$y
    894     #}
     907    }
    895908    wm deiconify $w
    896909
     
    17971810                -message "Background function #[histinfo $hist backtype] is no longer supported -- the function will now be changed to type #1 & the values reset"
    17981811            histinfo $histlist backtype set 1
     1812            RecordMacroEntry "histinfo [list $histlist] backtype set 1" 0
    17991813            incr expgui(changed)
    18001814            for {set num 1 } { $num <= $terms } { incr num } {
    18011815                set var "bterm$num"
    18021816                histinfo $histlist $var set 0
     1817                RecordMacroEntry "histinfo [list $histlist] $var set 0" 0
    18031818                incr expgui(changed)
    18041819            }
     1820            RecordMacroEntry "incr expgui(changed)" 0
    18051821        }
    18061822        set expgui(backtypelbl) "Function type [histinfo $hist backtype]"
     
    21742190    }
    21752191    SetPhaseFlag $hist $plist
     2192    RecordMacroEntry "SetPhaseFlag [list $hist] [list $plist]" 0
    21762193    incr expgui(changed)
     2194    RecordMacroEntry "incr expgui(changed)" 0
    21772195    # set the powpref warning (1 = suggested)
    21782196    set expgui(needpowpref) 2
     
    25612579    }
    25622580    expinfo print set $newval
     2581    RecordMacroEntry "incr expgui(changed); expinfo print set $newval" 1
    25632582    set expgui(printopt) "Print Options ([expinfo print])"
    25642583}
     
    26532672    }
    26542673    hapinfo $histlist $phase extmeth set $expgui(Fextract$phase)
     2674    RecordMacroEntry "incr expgui(changed); hapinfo [list $histlist] $phase extmeth set $expgui(Fextract$phase)" 1
    26552675    incr expgui(changed)
    26562676    if {$expgui(Fextract$phase) != 0} {set entryvar(fobsextract) 1}
     
    27722792    if {$expgui(orig_backtype) != $expgui(backtype)} {
    27732793        histinfo $histlist backtype set $expgui(backtype)
     2794        RecordMacroEntry "histinfo [list $histlist] backtype set $expgui(backtype)" 0
    27742795        incr expgui(changed)
    27752796    }
    27762797    if {$expgui(orig_backterms) != $expgui(backterms)} {
    27772798        histinfo $histlist backterms set $expgui(backterms)
     2799        RecordMacroEntry "histinfo [list $histlist] backterms set $expgui(backterms)" 0
    27782800        incr expgui(changed)
    27792801    }
     
    27822804        if {$expgui(orig_$var) != $expgui($var)} {
    27832805            histinfo $histlist $var set $expgui($var)
     2806            RecordMacroEntry "histinfo [list $histlist] $var set $expgui($var)" 0
    27842807            incr expgui(changed)
    27852808        }
    27862809    }
     2810    RecordMacroEntry "incr expgui(changed)" 0
    27872811
    27882812    if {$expgui(globalmode) == 0} {
     
    29122936            if {$cmd == "histinfo"} {
    29132937                histinfo $h $variable set $expgui(temp)
     2938                RecordMacroEntry "histinfo $h $variable set $expgui(temp)" 1
    29142939                incr expgui(changed)
    29152940                if $expgui(debug) {
     
    29182943            } elseif {$cmd == "hapinfo"} {
    29192944                hapinfo $h $phase $variable set $expgui(temp)
     2945                RecordMacroEntry "hapinfo $h [list $phase] $variable set $expgui(temp)" 1
    29202946                incr expgui(changed)
    29212947                if $expgui(debug) {
    2922                     puts "hapinfo $phase $h $variable set $expgui(temp)"
     2948                    puts "hapinfo $h $phase $variable set $expgui(temp)"
    29232949                }
    29242950            } else {
     
    29262952            }
    29272953        }
     2954        RecordMacroEntry "incr expgui(changed)" 0
    29282955    }
    29292956}
     
    29973024        if {$value != ""} {
    29983025            hapinfo $histlist $phaselist [lindex $item 0] set $value
     3026            RecordMacroEntry "hapinfo [list $histlist] [list $phaselist] [lindex $item 0] set $value" 1
    29993027            incr expgui(changed)
     3028            RecordMacroEntry "incr expgui(changed)" 0
    30003029            if $expgui(debug) {
    30013030                puts "hapinfo [list $phaselist] [list $histlist] [lindex $item 0] set $value"
     
    31823211   
    31833212    histinfo $histlist abstype set $expgui(abstype)
     3213    RecordMacroEntry "histinfo [list $histlist] abstype set $expgui(abstype)" 0
    31843214    histinfo $histlist abscor1 set $expgui(abscor1)
     3215    RecordMacroEntry "histinfo [list $histlist] abscor1 set $expgui(abscor1)" 0
    31853216    if {$expgui(abstype) > 1} {
    31863217        histinfo $histlist abscor2 set $expgui(abscor2)
     3218        RecordMacroEntry "histinfo [list $histlist] abscor2 set $expgui(abscor2)" 0
    31873219    } else {
    31883220        histinfo $histlist abscor2 set 0.
     3221        RecordMacroEntry "histinfo [list $histlist] abscor2 set 0." 0
    31893222    }
    31903223    # turn off refinement, just in case they didn't read
     
    31923225            && ($flag != 1 && $flag != 5)} {
    31933226        histinfo $histlist absref set 0
     3227        RecordMacroEntry "histinfo [list $histlist] absref set 0" 0
    31943228    }
    31953229    incr expgui(changed)
     3230    RecordMacroEntry "incr expgui(changed)" 0
    31963231    destroy $top
    31973232}
     
    36303665                if {[phaseinfo $expgui(curPhase) $var] != $val} {
    36313666                    phaseinfo $expgui(curPhase) $var set $val
     3667                    RecordMacroEntry "phaseinfo $expgui(curPhase) $var set $val" 0
    36323668                    set entryvar($var) $val
    36333669                    incr expgui(changed)                   
     
    36463682                if {[phaseinfo $expgui(curPhase) $var] != $val} {
    36473683                    phaseinfo $expgui(curPhase) $var set $val
     3684                    RecordMacroEntry "phaseinfo $expgui(curPhase) $var set $val" 0
    36483685                    set entryvar($var) $val
    36493686                    incr expgui(changed)                   
     
    36523689            }
    36533690        }
     3691        RecordMacroEntry "incr expgui(changed)" 0
    36543692        if {$change} {
    36553693            # set the powpref warning (1 = suggested)
     
    40384076    if {$x != $expgui(convinit) && $expgui(changed) <= 0} {
    40394077        incr expgui(changed)
    4040     }
    4041     if {$expgui(changed)} {expinfo convg set $x}
     4078        RecordMacroEntry "incr expgui(changed)" 0
     4079    }
     4080    if {$expgui(changed)} {
     4081        expinfo convg set $x
     4082        RecordMacroEntry "expinfo convg set $x" 0
     4083    }
    40424084    set expgui(convlbl) [format %5.2f [expr {pow(10,$x/100.)}]]
    40434085}
     
    40464088    if {$x != $expgui(marqinit) && $expgui(changed) <= 0} {
    40474089        incr expgui(changed)
    4048     }
    4049     if {$expgui(changed)} {expinfo marq set $x}
     4090        RecordMacroEntry "incr expgui(changed)" 0
     4091    }
     4092    if {$expgui(changed)} {
     4093        expinfo marq set $x
     4094        RecordMacroEntry "expinfo marq set $x" 0
     4095    }
    40504096}
    40514097# ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF LS PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
     
    41064152    $expgui(fm).option.menu  add checkbutton -label "Autoload EXP" \
    41074153            -variable expgui(autoexpload)
     4154    $expgui(fm).option.menu  add checkbutton -label "Prompt after GSAS run" \
     4155            -variable expgui(execprompt)
    41084156    $expgui(fm).option.menu  add checkbutton -label "Iconify during GSAS" \
    41094157            -variable expgui(autoiconify)
     
    41904238$expgui(fm).option.menu add command -label "Save Options" \
    41914239        -command "SaveOptions"
    4192 
    41934240pack $expgui(fm).file $expgui(fm).option -side left  -in $expgui(fm)
    41944241
     
    42514298    }
    42524299}
     4300
     4301# Macro menu
     4302$expgui(fm).macro.menu add checkbutton  -label "Record EXPGUI macro" \
     4303    -variable expgui(RecordMacro)
     4304$expgui(fm).macro.menu add command -label "Add comment to macro" \
     4305    -command AddCommentMacroFile
     4306$expgui(fm).macro.menu add command -label "Replay macro line-at-a-time" \
     4307    -command {ReplayMacroFile 1}
     4308$expgui(fm).macro.menu add command -label "Replay macro all at once" \
     4309    -command {ReplayMacroFile 0}
     4310$expgui(fm).macro.menu add checkbutton  -label "Show GSAS output in window" \
     4311    -variable expgui(ShowGENLES)
     4312bind . <Control-m> {set expgui(RecordMacro) [expr ! $expgui(RecordMacro)]}
     4313set expgui(RecordMacro) 0
     4314set expgui(MacroRunning) 0
     4315set expgui(MacroStatus) "?"
     4316set expgui(ShowGENLES) 1
     4317trace variable expgui(RecordMacro) w SetRecordMacroOnOff
     4318
    42534319# setup command help
    42544320foreach cmd [array names expgui_cmdlist] {
Note: See TracChangeset for help on using the changeset viewer.