source: trunk/doc/expgui_cfg.html @ 886

Last change on this file since 886 was 886, checked in by toby, 12 years ago

# on 2007/01/17 04:38:58, toby did:
remove NIST web exit hijacks & Von Dreele's web page link at LANL

  • Property rcs:author set to toby
  • Property rcs:date set to 2007/01/17 04:38:58
  • Property rcs:lines set to +4 -4
  • Property rcs:rev set to 1.30
  • Property rcs:state set to Exp
  • Property svn:keywords set to Author Date Revision Id
File size: 29.3 KB
[143]2   <TITLE>Customizing EXPGUI and Associated Programs</TITLE>
4   <meta name="keywords" content="crystallography, Rietveld, diffraction,
8A:link {text-decoration:none}
9A:vlink {text-decoration:none}
13      topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" 
14      text="#000000" link="#0033ff" vlink="#0033ff" alink="#0033ff">
17   include("/var/www/include/");
18   include("/var/www/include/");
20<blockquote><font face="arial, helvetica, sans-serif">
23<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
27<HR noshade width="75%" size="2" align="center">
28Customizing EXPGUI and Associated Programs
29<HR noshade width="75%" size="2" align="center">
32The EXPGUI GSAS graphical user interface can be modified in many
33ways quite easily.
34This document describes how the GUI works and how to modify the menus without
[814]35significant reprogramming. A little bit of programming skills in Tcl/Tk
36can go a long way in adding new features. See the
[114]37<a HREF="#Customizing">Customizing</A> examples, below.
[36]40The main GUI is created by file expgui, which in turn uses the following files
[550]43<LI><FONT FACE="COURIER">readexp.tcl</FONT>
44<LI><FONT FACE="COURIER">gsascmds.tcl</FONT>
45<LI><FONT FACE="COURIER">gsasmenu.tcl</FONT>
47Two additional files are read if they are found:
[550]49<LI><FONT FACE="COURIER">localconfig</FONT>
[706]50<LI>UNIX: <FONT FACE="COURIER">.gsas_config</FONT>
51or Windows: <FONT FACE="COURIER">c:\gsas.config</FONT></UL>
[36]52<P>The first three files,
[550]53(<FONT FACE="COURIER">readexp.tcl</FONT>, <FONT FACE="COURIER">gsascmds.tcl</FONT>, <FONT FACE="COURIER">gsasmenu.tcl</FONT>)
54must be located in the same directory where the <FONT FACE="COURIER">expgui</FONT> file is found.
55The <FONT FACE="COURIER">localconfig</FONT> file also is read from this directory, if it exists.
[706]56The final file, <FONT FACE="COURIER">.gsas_config</FONT>
57(or <FONT FACE="COURIER">c:\gsas.config</FONT>),
58is read from the user's login directory (UNIX) or
59<FONT FACE="COURIER">C:\</FONT> (Windows).
60The <FONT FACE="COURIER">localconfig</FONT> and
61<FONT FACE="COURIER">.gsas_config</FONT> 
62(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
63files are intended to
[41]64contain system-wide and user-level default values for parameters
65that are described in this document. Most routines have
66a "Save Options" command that writes some of the current parameters to
[706]67file  <FONT FACE="COURIER">.gsas_config</FONT>
68(or <FONT FACE="COURIER">c:\gsas.config</FONT>).
69Note that information in <FONT FACE="COURIER">.gsas_config</FONT>
70(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[550]71overrides that in <FONT FACE="COURIER">localconfig</FONT>.
[41]72No error occurs if either of these files are not found.
[550]75The <FONT FACE="COURIER">readexp.tcl</FONT> and <FONT FACE="COURIER">gsascmds.tcl</FONT> files contain
[36]76tcl procedures that are
77used for more than one application, so it is convenient to place them
78in separate files. They are only of interest to someone trying to debug
79or add new functionality to expgui.
[550]81The <FONT FACE="COURIER">gsasmenu.tcl</FONT> file defines the contents of the
[36]82menu bar, the contents of the
83button bar and definitions for each command. The contents of this file
84are designed to be modified and extended by users, either by editing the file,
[550]85or by overriding definitions in the <FONT FACE="COURIER">localconfig</FONT> or
[706]86<FONT FACE="COURIER">.gsas_config</FONT> 
87(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[550]90The important variables defined in the <FONT FACE="COURIER">gsasmenu.tcl</FONT> file are:
[550]92<DT><FONT FACE="COURIER">expgui(menunames)</FONT><DD>
[36]93This list defines the menu bar headings other than File, Options & Help
[550]94<DT><FONT FACE="COURIER">expgui_menulist</FONT><DD>
[36]95Each array element, e.g. expgui_menulist(file) and expgui_menulist(powder),
96defines commands to be added to a menu heading. Each command will appear
97as an array element in expgui_cmdlist.
[550]98<DT><FONT FACE="COURIER">expgui_cmdlist</FONT><DD>
[36]99Each array element, e.g. expgui_cmdlist(Save) or expgui_cmdlist(expnam)
100contains two items. The first defines a tcl procedure to be executed
101when the command is invoked, or "-" if no command will be invoked and
102the second contains help information describing what the command does.
103Note that when menu item is selected the variable cmd is set to the
104name of the command, so
[36]106    expgui_cmdlist(powpref) {{runGSASwEXP $cmd} {Powder data preparation}}
[36]108means that "runGSASwEXP powpref" will be invoked when powpref is invoked.
[524]109For example, when powpref is selected, the tcl command
[36]110"runGSASwEXP $cmd" is invoked, where variable cmd is set to "powpref".
[550]111<DT><FONT FACE="COURIER">expgui(buttonlist)</FONT><DD>
[36]112This list defines the commands that will appear on the button bar where
113each item that appears on the button bar must have a matching pair of entries
114in expgui_cmdlist.
115Thus if the command
[36]117   set expgui(buttonlist) {expnam expedt genles ortep fourier forsrh forplot lstview}
[706]119is placed in the <FONT FACE="COURIER">localconfig</FONT> or
120<FONT FACE="COURIER">.gsas_config</FONT> 
121(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
122files this will
[36]123redefine the contents of the button bar.
126In addition to the variables defined in the previous file, expgui, uses
[143]127a small number of array elements for other configuration options. They are:
[550]130<DT><FONT FACE="COURIER">expgui(scriptdir)</FONT><DD>
131This determines where files such as <FONT FACE="COURIER">readexp.tcl</FONT>, etc.
132are located. This defaults to the location where <FONT FACE="COURIER">expgui</FONT> is located so
[41]133it rarely needs to be changed.
[550]135<DT><FONT FACE="COURIER">expgui(gsasdir)</FONT><DD>
[41]136This contains the location of the GSAS directory, if it is not the
137parent director where expgui is found.
138This determines where a number of GSAS data files will be located. If expedt
139crashes when you try to add new atoms, this is probably wrong.
[550]141<DT><FONT FACE="COURIER">expgui(gsasexe)</FONT><DD>
[36]142This determines where the GSAS executable files are located.
143You might want to change this is you keep multiple versions of GSAS
144around or if you keep the GSAS files in a different location than
145the default or want to keep the tcl files somewhere other than
146in a subdirectory of the GSAS files.
[550]148<DT><FONT FACE="COURIER">expgui(bkgcolor1)</FONT><DD>
[862]149Sets the background color for the bottom box on the phase panel.
[307]150The default value, #fdf, is a light violet that
151will probably drive some folks nuts, but is a good contrast to the yellow
152of the refinement flags.
[550]154<DT><FONT FACE="COURIER">liveplot(hst)</FONT><DD>
[41]155Sets the default histogram used for liveplot
[550]157<DT><FONT FACE="COURIER">liveplot(legend)</FONT><DD>
[41]158Sets the default value for display of the legend in liveplot
[550]160<DT><FONT FACE="COURIER">expgui(initstring)</FONT><DD>
[143]161Defines commands to be executed by EXPGUI after all other commands
162have been run. This is used to define initialization commands in
[706]163the <FONT FACE="COURIER">localconfig</FONT> or
164<FONT FACE="COURIER">.gsas_config</FONT> 
165(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
166files that cannot be
[143]167run at the time when the files are sourced. <I>(added in EXPGUI v1.21)</I>
[706]170The following variables are written to
171<font face="courier">.gsas_config</font> 
172(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[41]174"Save Options" is used. These variables are all set from the GUI and therefore
175do not need to be edited manually.
[550]178<DT><FONT FACE="COURIER">expgui(archive)</FONT><DD>
[41]179This defines the default state for the archive flag,
180where 0 is off and 1 is on. When archive is on, a copy of the .EXP file
[461]181is saved before a new version of the file is saved in EXPGUI.
[550]183<DT><FONT FACE="COURIER">expgui(font)</FONT><DD>
[423]184This determines the base font used in the programs. You conceivably
185could want to use an integer value not present in the
186"Options/Screen Font" menu command.
[550]188<DT><FONT FACE="COURIER">expgui(asorttype)</FONT><DD>
[41]189This determines the atom sort mode.
[550]191<DT><FONT FACE="COURIER">expgui(hsorttype)</FONT><DD>
[41]192This determines the histogram sort mode.
[550]194<DT><FONT FACE="COURIER">expgui(filesort)</FONT><DD>
[81]195This determines the default file sorting mode for the expnam command.
[550]197<DT><FONT FACE="COURIER">expgui(autoexpload)</FONT><DD>
[314]198If set to 1, the experiment file is automatically reread after
199GSAS programs modify it.
200(UNIX only)
[550]202<DT><FONT FACE="COURIER">expgui(showexptool)</FONT><DD>
[314]203If set to 1, output from EXPTOOL is shown after the program is run.
204This is probably needed only for debugging purposes.
[41]207Used only for UNIX: This determines if the default definition
[36]208for the backspace key is overridden; some UNIX systems need this so that
209expedt and other terminal-oriented programs work correctly and
[143]210other systems do not. You can toggle this option using the
211"Override Backspace" option on the file menu to see what works for you.
216<HR><H3><A NAME="import">Coordinate import routines for EXPGUI</A>
[299]217<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
[524]219See the <A HREF="expgui.html#import">coordinate import discussion</A> 
220for description of available formats.
[270]221It is possible to define new formats for EXPGUI to use for importing
[524]222phase/coordinate information. This is done by creating a file
223containing the appropriate Tcl code to read this file type.
224All that is needed to cause the code to be incorporated into
225EXPGUI is to name it
[550]226<FONT FACE="COURIER">import_</FONT><I>xxxx</I><FONT FACE="COURIER">.tcl</FONT> (where <I>xxxx</I> is arbitrary)
[524]227and place it in the EXPGUI directory. All files with
228such names are read when EXPGUI is started.
[550]230The <FONT FACE="COURIER">import_</FONT> file must contain four items:
233A description for the type of file to be read.
[270]236set description "PowderCell .CEL file"
[282]239The text should not be too long, but use a return (\n) if needed:
[270]241set description "My favorite coordinate\nfile from the GIGO pkg"
[282]243This description text shows up on the button for selecting a format.
[282]246A list of preferred file extensions.
[270]248set extensions .cel
[270]252set extensions {.jnk .junk}
[282]254In UNIX upper and lower case
255versions will be generated automatically, so do not worry about
256the case of the extension. Note that "*" (all files) is always added as well.
259The name of the routine that will read the data file
[270]261set procname ReadPowderCellFile
264A routine that takes the file name as an argument
[270]266proc ReadPowderCellFile {filename} {
[282]268and returns a list containing the following four items
[282]270<P><LI>Space Group
272The space group should be named and spaced appropriately for GSAS,
273e.g. P 21/c or P 21 21 21, not P21/c or P212121.
[282]275Note that GSAS requires that if a center of symmetry is present,
276this center defines the origin (Origin 2 settings, where more than one setting
277is given in the International Tables).
278<P><LI>Cell parameters
280All six parameters should be specified in a list
[282]282<P><LI>Atom Coordinates
284The atom coordinates should be specified as a list with a list element
285for each atom.
286The list contains the following items:
288<LI>Atom label
292<LI>Atom type
296If an item is not specified, it is left blank in the atom table, except for
297Occupancy and U<sub>iso</sub>, which default to 1.0 and 0.025, respectively.
298However, one must specify a null value, if an item will be skipped over.
299For example, use:
[270]301    "Li1 0 0 0 li 0.5"
[270]305    "{} 0 0 0 li 0.5"
[270]307but not
[270]309    "0 0 0 li 0.5"
[282]313<P><LI>Warning Message (optional)
315The warning message is displayed at the bottom of the
316Replace Atoms and Add Atoms box after the file is read. This can be used
317to warn the user about problems reading the file, for example if
318the space group symbol needs attention.
[550]321See the file <FONT FACE="COURIER">import_cell.tcl</FONT> as an example for how this code
[524]322is written.
[524]325<HR><H3><A NAME="export">Coordinate Export routines for EXPGUI</A>
326<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
328See the <A HREF="expgui.html#export">coordinate export discussion</A> 
329for description of available formats.
330It is possible to define new formats for EXPGUI to use for exporting
331phase/coordinate information. This is done by creating a file
332containing the appropriate Tcl code to read this file type.
333All that is needed to cause the code to be incorporated into
334EXPGUI is to name it
[550]335<FONT FACE="COURIER">export_</FONT><I>xxxx</I><FONT FACE="COURIER">.tcl</FONT> (where <I>xxxx</I> is arbitrary)
[524]336and place it in the EXPGUI directory. All files with
337such names are read when EXPGUI the Import/Export=>"Coord Export" submenu
338is first invoked.
[550]340The <FONT FACE="COURIER">export_</FONT> file must define two variables:
343This defines the text that appears on the submenu. For example:
[524]345        set label "MSI .xtl format"
348This defines the Tcl routine that will be used to
[524]350        set action exp2xtl
[550]353See the file <FONT FACE="COURIER">export_example.example</FONT>, as well as the
354<FONT FACE="COURIER">export_*.tcl</FONT> files
[524]355as examples for how this
356sort of routine is written.
[706]359The <FONT FACE="COURIER">localconfig</FONT> and
360<FONT FACE="COURIER">.gsas_config</FONT> 
361(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
362files are read, if present.
[41]363The following options are available for customization in these files:
[550]365<DT><FONT FACE="COURIER">txtvw(menulength)</FONT><DD>
[41]366This limits the number of entries that can
[36]367exist in a menu. For example, the default is 25, so when more than 25 cycles
368are found in a .LST file, only the last 25 are listed in the
369"Go To"/cycle submenu.
[550]370<DT><FONT FACE="COURIER">txtvw(maxchars)</FONT><DD>
[41]371This limits the maximum number of
[36]372characters that will be read from an existing .LST file to speed
[41]373the start of the program. The default is ~1Mb
[36]374for UNIX systems and ~200K for Windows.
[550]375<DT><FONT FACE="COURIER">txtvw(plotvars)</FONT><DD>
[524]376If txtvx(plotvars) is 1, a plot window is created for plotting of
377R-factors and parameter shifts as a function of cycle number.
378Note that the summary of shifts must be displayed, in order
379to plot parameter shifts. If this variable is set to 0, the
380plot window is not created and LSTVIEW runs a bit faster.
[706]383The following variables are written to
384<font face="courier">.gsas_config</font> 
385(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[81]387"Save Options" is used. These variables can be set from the GUI and therefore
388do not need to be edited manually.
[550]391<DT><FONT FACE="COURIER">txtvw(followcycle)</FONT><DD>
[41]392This sets the initial value for the
393"Auto Advance" button in the "Go To" menu. When this is true,
394the program will show the last cycle in the file. As new cycles are
395added, the "view" is advanced.
[550]397<DT><FONT FACE="COURIER">txtvw(font)</FONT><DD>
[81]398This sets the font used for LSTVIEW. See documentation on the font command in
399Tk for details on font naming.
402<hr><H3>LIVEPLOT</H3><A NAME="liveplot"></A>
[410]403A description of the customization options for LIVEPLOT can be
404found in the
405<A HREF="liveplot.html#customize">
406LIVEPLOT description</A>.
[524]410<a name="WIDPLT"></a>
[36]412The widplt script is used to display the FWHM for one or more histograms
[41]413from a .EXP file.
414At this point it only works for CW data.
415It is often convenient to add for reference the expected
[36]416instrumental curves as options to the menu. This can be done by creating a
417file called widplot_<i>name</i>. For example, renaming the
[550]418<font face="courier">example_widplt_BT1</font> file supplied with the distribution to
419<font face="courier">widplt_BT1</font> will cause the FWHM curves for the NIST BT-1 instrument
[36]420to be added to the menu of defined FWHM values.
422Creating such a file is easy. To add a entry define the following
423five array elements using a single, unique element name and then append that
424element name to variable datalist.
[36]427    set UVWP(Ge15) {398.5 -343.2  163.0 0}
428    set XY(Ge15) {0 0}
429    set wave(Ge15) 2.0775
430    set lblarr(Ge15) "BT-1 Ge(311) 15'"
431    set ttrange(Ge15) "5 160"
432    lappend datalist Ge15
[36]434Array element UVWP(item) contains the (Gaussian) GU, GV, GW and GP values,
[41]435while XY(item) contains the (Lorentzian) LX and LY terms. Array element
[36]436wave(item) contains a wavelength, array element lblarr(item) contains
437the text to be shown on the "Plot Contents" menu and ttrange(item)
438defines the range the function is valid.
[706]440The following variables are written to
441<font face="courier">.gsas_config</font> 
442(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[41]444"Save Options" is used. These variables are all set from the GUI and therefore
445do not need to be edited manually.
[550]448<DT><FONT FACE="COURIER">graph(printout)</FONT><DD>
[41]449This is set to 1 if PostScript files
450will be printed and 0 if they will be written to disk (for Windows all
451files should be written to disk).
[550]453<DT><FONT FACE="COURIER">graph(outname)</FONT><DD>
[41]454This is the default for the file name used
455when PostScript files will be written to disk.
[550]457<DT><FONT FACE="COURIER">graph(outcmd)</FONT><DD>
[41]458This is the default for the command used
459to print PostScript files (Unix only).
[550]461<DT><FONT FACE="COURIER">graph(legend)</FONT><DD>
[41]462Sets the default value for display of the legend in liveplot and widplt.
[550]464<DT><FONT FACE="COURIER">graph(plotunits)</FONT><DD>
[41]465Sets the units used for displaying the data. Values are "d", "q", "",
466for d-space, Q and 2-theta, respectively.
[550]467<DT><FONT FACE="COURIER">graph(equivwave)</FONT><DD>
[41]468Sets the wavelength used for displaying data, if blank, no conversion is
469done and data are shown in their original wavelength.
[114]473<a name="Customizing"><H2>
474Customizing Example 1: Adding a new button to the button bar
476When a LeBail extraction is used to refine lattice constants, profile
477terms, ... It is always a good idea to run GENLES a few times after running
478POWPREF. This is because GENLES sets the extracted intensities back to their
479crystallographic values, during the first GENLES cycle after POWPREF has been
480run. Refining anything until the extracted intensities return to reasonable
481values is a really bad idea. Forturnately, running GENLES with the number of
482cycles set to zero gives the Le Bail extraction a head start.
[550]484The code below can be used to define a new command, <font face="courier">leBail</font>. The first
[114]485command adds a command to the button bar and the second one defines what will
486be done when it is invoked (the number of cycles is set to zero and
487GENLES 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
488does not.
[114]491    lappend expgui(buttonlist) leBail
492    set expgui_cmdlist(leBail) {
493        {set entryvar(cycles) 0; runGSASwEXP "genles genles genles"}
494        {Converges GENLES with LeBail extractions;
495          Sets the number of cycles to zero and runs GENLES 3 times.}
496    }
499To make this customization, put the above in the <FONT FACE="COURIER">localconfig</FONT> 
[114]500file or the
[706]501<FONT FACE="COURIER">~/.gsas_config</FONT> or
502(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[143]506Customizing Example 2: Putting DISAGL Results in a Separate Box
508Barbara Reisner has been asking me to put the output from DISAGL in a separate
[143]509window. Sounds like a pretty reasonable request. Here is an example with code
510to do that as a customization option. Please note that this has now been
511incorporated into EXPGUI, so do not use this example.
[114]513  set expgui(disaglSeparateBox) 1
514  set expgui_cmdlist(disagl) {rundisagl {Hacked Distance/angle calculations}}
515  proc rundisagl {} {
516    global expgui txtvw tcl_version tcl_platform
[143]517    if {$expgui(disaglSeparateBox) && $tcl_platform(platform) != "windows"} {
[114]518        set root [file root $expgui(expfile)]
519        catch {file rename $root.LST $root.OLS}
520        runGSASwEXP disagl
521        catch {file rename $root.LST $root.DIS}
522        catch {file rename $root.OLS $root.LST}
524        # open a new window
525        catch {toplevel .disagl}
526        catch {eval grid forget [grid slaves .disagl]}
527        text .disagl.txt -width 100 -wrap none \
528                -yscrollcommand ".disagl.yscroll set" \
529                -xscrollcommand ".disagl.xscroll set"
530        if {$tcl_version >= 8.0} {.disagl.txt config -font $txtvw(font)}
531        scrollbar .disagl.yscroll -command ".disagl.txt yview"
532        scrollbar .disagl.xscroll -command ".disagl.txt xview" -orient horizontal
533        grid .disagl.xscroll -column 0 -row 2 -sticky ew
534        grid .disagl.txt -column 0 -row 1 -sticky nsew
535        grid .disagl.yscroll -column 1 -row 1 -sticky ns
536        grid columnconfigure .disagl 0 -weight 1
537        grid rowconfigure .disagl 1 -weight 1
538        wm title .disagl "DISAGL results $expgui(expfile)"
539        wm iconname .disagl "DISAGL $root"
540        set in [open $root.DIS r]
541        .disagl.txt insert end [read $in]
542        close $in
543        bind all <Control-KeyPress-c> {destroy .disagl}
544        bind .disagl <KeyPress-Prior> ".disagl.txt yview scroll -1 page"
545        bind .disagl <KeyPress-Next> ".disagl.txt yview scroll 1 page"
546        bind .disagl <KeyPress-Right> ".disagl.txt xview scroll 1 unit"
547        bind .disagl <KeyPress-Left> ".disagl.txt xview scroll -1 unit"
548        bind .disagl <KeyPress-Up> ".disagl.txt yview scroll -1 unit"
549        bind .disagl <KeyPress-Down> ".disagl.txt yview scroll 1 unit"
550        bind .disagl <KeyPress-Home> ".disagl.txt yview 0"
551        bind .disagl <KeyPress-End> ".disagl.txt yview end"
552        # don't disable in Win as this prevents the highlighting of selected text
553        if {$tcl_platform(platform) != "windows"} {
554            .disagl.txt config -state disabled
555        }
556    } else {
557        runGSASwEXP disagl
558    }
559  }
[143]561if {$tcl_platform(platform) != "windows"} {
562  append expgui(initstring) {
563      $expgui(fm) add checkbutton  -label "DISAGL window" \
564              -variable expgui(disaglSeparateBox) -underline 0;
565  }
569To make this customization, put the above in the <FONT FACE="COURIER">localconfig</FONT> 
[114]570file or the
[706]571<FONT FACE="COURIER">~/.gsas_config</FONT> or
572(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[550]575Note that the <font face="courier">expgui(initstring)</font> option became available in EXPGUI
[143]576version 1.21. (Previous versions will ignore this). This code must be executed
577after all the menus and other GUI code has been run. When executed, it
578creates a checkbutton on the Options menu to
579turn the "separate DISAGL window mode" mode on and off.
582Customizing Example 3: Adding a new page to EXPGUI
584The steps for creating support for additional functionality, implementation
585of atom constraints, is outlined here. Routines described here can be found in
[550]586file <font face="courier">atomcons.tcl</font> unless otherwise noted.
588<LI>Create a routine to read and write the appropriate records
589from the .EXP file. In this case, a new routine, constrinfo,
[550]590was added to file <font face="courier">readexp.tcl</font>.
[143]591This takes considerable care and manual testing.
592<LI>Create a routine that places the appropriate widgets into a frame
593(in this case MakeAtomsConstraintsPane). This routine will be called only once.
594Note that in this example expcons(atommaster) is defined to be the name of the
596<LI>Create a routine to display and edit the information shown in the
597frame. In this case, DisplayAtomConstraints. This routine will be called each
598time the page is displayed. Note that this routine and the previous can be
599tested in a separate toplevel until they work well.
600<LI>In this particular example, the previous frame is located on a notebook
601widget that in turn placed on a notebook page, so MakeConstraintsPane is used
602to create this inner notebook when the "Constraints" notebook page is first
603shown. This in turn calls MakeAtomsConstraintsPane and DisplayAtomConstraints.
[144]604To update this page each time it is displayed, DisplayConstraintsPane is
[550]606<LI>Edit file <font face="courier">expgui</font> to make the following changes:
[550]608<P><LI>load the <font face="courier">atomcons.tcl</font> file:
[144]610# commands for constraints
[143]611source [file join $expgui(scriptdir) atomcons.tcl]
[143]613<P><LI>Define a notebook page for the option. The -createcmd option
614is used only once, but the -raisecmd option is used every time
615the page is exposed.
[143]617set expgui(consFrame) [\
618            .n insert end consPane -text Constraints \
[144]619            -raisecmd "set expgui(pagenow) consFrame; DisplayConstraintsPane"\
[143]620            -createcmd MakeConstraintsPane]
[144]621lappend expgui(frameactionlist) "consFrame DisplayConstraintsPane"
[143]623Note that if we were displaying the atoms constraint page directly on
624the main notebook widget, the previous command would have been
[550]625<font face="courier">-raisecmd DisplayAtomConstraints -createcmd MakeAtomsConstraintsPane</font>
[144]627Since the frame will need to be updated when information in the .EXP file
628changes, the name of the frame and a command to execute are added into list
[550]629expgui(frameactionlist) using the <FONT FACE="COURIER">lappend expgui(frameactionlist)</FONT>
636Customizing Example 4: Changing the fonts used in the GUI
638<B>Question: </B>
[423]639<I>I am not happy with the fonts available via the Option/Screen Font
640menu option. Is there a way to select different font size(s)/families?
643<B>Answer: </B>
644The fonts used in EXPGUI can be customized by adding some code to the
[550]645<FONT FACE="COURIER">localconfig</FONT> file or the
[706]646<FONT FACE="COURIER">~/.gsas_config</FONT> or
647(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[347]649By default, fonts are 14 point for the menus, buttons, labels,... and
65012 point for the histogram and atom lists.
[423]652If you add a command like this:
[423]654option add *Coord.Listbox.Font "Courier -18 bold italic" 20
[423]657you will override the menu command and force the atom coordinates
658to be displayed at 18 points in a bold & italicied Courier font.
659(See the Tk documentation if this is not clear). The value 20 is a
660priority, which overrides the priority value of 10 in the
661standard initialization. Here are the options that can be specified:
[550]663<DT><FONT FACE="COURIER">*Graph*Font</FONT><DD>Used for Graph labels
664<DT><FONT FACE="COURIER">*Graph.font</FONT><DD>Used for Graph title
665<DT><FONT FACE="COURIER">*Canvas.font</FONT><DD>Used for notebook tabs
666<DT><FONT FACE="COURIER">*Button.font</FONT><DD>Used on most buttons
667<DT><FONT FACE="COURIER">*Menu.font</FONT><DD>Used on menu commands
668<DT><FONT FACE="COURIER">*Menubutton.font</FONT><DD>Used on "menu buttons" (e.g. Print options)
669<DT><FONT FACE="COURIER">*Label.font</FONT><DD>Used on labels
670<DT><FONT FACE="COURIER">*Scale.font</FONT><DD>Used on sliders (e.g. Marquardt damping)
671<DT><FONT FACE="COURIER">*TitleFrame.font</FONT><DD>Used on title frames (e.g. box labels such as
[423]672the "Diffractometer Constants" label
[550]673<DT><FONT FACE="COURIER">*SmallFont.Button.font</FONT><DD>Used for buttons with smaller letters
674<DT><FONT FACE="COURIER">*Coord.Listbox.font</FONT><DD>Used for coordinate listings, best as a
[423]675mono-spaced font, such as Courier
[550]676<DT><FONT FACE="COURIER">*HistList.Listbox.font</FONT><DD>Used for histogram listings
677<DT><FONT FACE="COURIER">*MonoSpc.Label.font</FONT><DD>Used in other places where a mono-spaced
[423]678font is required
[347]681It should be noted that the appearance of fonts depends on many factors --
682the fonts installed on your computer, the screen size and resolution and your
[423]683eyes, so it is wise to experiment with different values.
[144]688<A Href="">
[886]690is written by Allen C. Larson and
691Robert B. Von Dreele while at Los Alamos National Laboratory.
692Problems, questions
[735]693or kudos concerning GSAS should be sent to Robert B. Von Dreele at <A HREF=""></A>
[574]695<P>EXPGUI is written by Brian H. Toby of the NIST Center for Neutron Research,
[36]696<A HREF="MAILTO:Brian.Toby@NIST.GOV">Brian.Toby@NIST.GOV</A>.
698<P>GSAS is Copyright, 1984-1997, The Regents of the University of California.
699The GSAS software was produced under a U.S. Government contract (W-7405-ENG-36)
700by the Los Alamos National Laboratory, which is operated by the University
701of California for the U.S. Department of Energy. The U.S. Government is
702licensed to use, reproduce, and distribute this software. Permission is
703granted to the public to copy and use this software without charge, provided
704that this notice and any statement of authorship are reproduced on all
705copies. Neither the Government nor the University makes any warranty, express
706or implied, or assumes any liability or responsibility for the use of this
[574]709<P>EXPGUI is not subject to copyright. Have fun.
713<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
716<P><font size=-1><A HREF=" page <?=$PHP_SELF?>">Comments, corrections or questions:</A></font><BR>
717<font size=-1><? lastmod(); ?> </font>
719$Revision: 886 $ $Date: 2009-12-04 23:13:44 +0000 (Fri, 04 Dec 2009) $
Note: See TracBrowser for help on using the repository browser.