Dec 4, 2009 5:00:38 PM (14 years ago)

# on 1999/10/11 20:27:13, toby did:
Customization examples

1 edited


  • trunk/doc/expgui_cfg.html

    • Property rcs:date changed from 1999/09/09 21:00:32 to 1999/10/11 20:27:13
    • Property rcs:lines changed from +8 -8 to +107 -3
    • Property rcs:rev changed from 1.6 to 1.7
    r105 r114  
    1414ways quite easily.
    1515This document describes how the GUI works and how to modify the menus without
    16 significant reprogramming.
    17 <P>
     16significant reprogramming. A little bit of programmaning in Tcl/Tk can go a
     17long way in adding new features. See the
     18<a HREF="#Customizing">Customizing</A> examples, below.
    1921The main GUI is created by file expgui, which in turn uses the following files
     372<a name="Customizing"><H2>
     373Customizing Example 1: Adding a new button to the button bar
     375When a LeBail extraction is used to refine lattice constants, profile
     376terms, ... It is always a good idea to run GENLES a few times after running
     377POWPREF. This is because GENLES sets the extracted intensities back to their
     378crystallographic values, during the first GENLES cycle after POWPREF has been
     379run. Refining anything until the extracted intensities return to reasonable
     380values is a really bad idea. Forturnately, running GENLES with the number of
     381cycles set to zero gives the Le Bail extraction a head start.
     383The code below can be used to define a new command, <tt>leBail</tt>. The first
     384command adds a command to the button bar and the second one defines what will
     385be done when it is invoked (the number of cycles is set to zero and
     386GENLES is run three times). It also defines the help entry. Note that commands must start with a lower case letter even though Armel LeBail's last name
     387does not.
     390    lappend expgui(buttonlist) leBail
     391    set expgui_cmdlist(leBail) {
     392        {set entryvar(cycles) 0; runGSASwEXP "genles genles genles"}
     393        {Converges GENLES with LeBail extractions;
     394          Sets the number of cycles to zero and runs GENLES 3 times.}
     395    }
     398To make this customization, put the above in the <TT>localconfig</TT>
     399file or the
     400<TT>~/.gsas_config</TT> or (or <TT>C:\GSAS\EXPGUI\.gsas_config</TT>)
     404Customizing Example 2: Adding a new button to the button bar
     406Barbara Reisner has been asking me to put the output from DISAGL in a separate
     407window. Sounds like a pretty reasonable request. Here is the code to do that.
     410  set expgui(disaglSeparateBox) 1
     411  set expgui_cmdlist(disagl) {rundisagl {Hacked Distance/angle calculations}}
     412  proc rundisagl {} {
     413    global expgui txtvw tcl_version tcl_platform
     414    if {$expgui(disaglSeparateBox)} {
     415        set root [file root $expgui(expfile)]
     416        catch {file rename $root.LST $root.OLS}
     417        runGSASwEXP disagl
     418        catch {file rename $root.LST $root.DIS}
     419        catch {file rename $root.OLS $root.LST}
     421        # open a new window
     422        catch {toplevel .disagl}
     423        catch {eval grid forget [grid slaves .disagl]}
     424        text .disagl.txt -width 100 -wrap none \
     425                -yscrollcommand ".disagl.yscroll set" \
     426                -xscrollcommand ".disagl.xscroll set"
     427        if {$tcl_version >= 8.0} {.disagl.txt config -font $txtvw(font)}
     428        scrollbar .disagl.yscroll -command ".disagl.txt yview"
     429        scrollbar .disagl.xscroll -command ".disagl.txt xview" -orient horizontal
     430        grid .disagl.xscroll -column 0 -row 2 -sticky ew
     431        grid .disagl.txt -column 0 -row 1 -sticky nsew
     432        grid .disagl.yscroll -column 1 -row 1 -sticky ns
     433        grid columnconfigure .disagl 0 -weight 1
     434        grid rowconfigure .disagl 1 -weight 1
     435        wm title .disagl "DISAGL results $expgui(expfile)"
     436        wm iconname .disagl "DISAGL $root"
     437        set in [open $root.DIS r]
     438        .disagl.txt insert end [read $in]
     439        close $in
     440        bind all <Control-KeyPress-c> {destroy .disagl}
     441        bind .disagl <KeyPress-Prior> ".disagl.txt yview scroll -1 page"
     442        bind .disagl <KeyPress-Next> ".disagl.txt yview scroll 1 page"
     443        bind .disagl <KeyPress-Right> ".disagl.txt xview scroll 1 unit"
     444        bind .disagl <KeyPress-Left> ".disagl.txt xview scroll -1 unit"
     445        bind .disagl <KeyPress-Up> ".disagl.txt yview scroll -1 unit"
     446        bind .disagl <KeyPress-Down> ".disagl.txt yview scroll 1 unit"
     447        bind .disagl <KeyPress-Home> ".disagl.txt yview 0"
     448        bind .disagl <KeyPress-End> ".disagl.txt yview end"
     449        # don't disable in Win as this prevents the highlighting of selected text
     450        if {$tcl_platform(platform) != "windows"} {
     451            .disagl.txt config -state disabled
     452        }
     453    } else {
     454        runGSASwEXP disagl
     455    }
     456  }
     459To make this customization, put the above in the <TT>localconfig</TT>
     460file or the
     461<TT>~/.gsas_config</TT> or (or <TT>C:\GSAS\EXPGUI\.gsas_config</TT>)
     464Note that an even better customization might be to add these commands into
     465the expgui file somewhere near the beginning and then near the end,
     468   $expgui(fm).option.menu add checkbutton  -label "DISAGL window" \
     469        -variable expgui(disaglSeparateBox) -underline 0
     471so that there is an option to turn the "separate DISAGL window mode"
     472on and off.
    370474GSAS is written by Allen C. Larson and <A HREF="http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://lansce.lanl.gov/lujan/staff12/vondreele.htm">
    371475Robert B. Von Dreele</A>, MS-H805,
Note: See TracChangeset for help on using the changeset viewer.