source: trunk/doc/expgui_cfg.html @ 984

Last change on this file since 984 was 971, checked in by toby, 11 years ago

change web pages to html

  • Property svn:keywords set to Author Date Revision Id
  • Property svn:mime-type set to text/html
File size: 30.7 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>
169  <P><B>Window location variables.</B> These variables determine where
170the EXPGUI window is located on the screen.
171Note that regardless of the values, the window will never be placed so
172that any part is outside of the screen.
174<DT><FONT FACE="COURIER">expgui(xpos)</FONT><DD>
175  Horizontal window location where 0 is fully to the left and 100 is
176  fully to the right. Default is 50 (middle).
177<DT><FONT FACE="COURIER">expgui(ypos)</FONT><DD>
178  Vertical window location where 0 is fully to the top and 100 is
179  fully to the bottom. Default is 50 (middle).
180<DT><FONT FACE="COURIER">expgui(poscenter)</FONT><DD>
181  Specifies what part of the window is placed at the specifed location: N for top and S for
182  bottom; W for left and E for right. These letters can be combined,
183  so that NS centers vertically and EW centers horizontally. Default
184  is the middle of the window (NSEW).
186  <B>Example 1:</B> This code placed in the localconfig or gsas.config
187  (or .gsas_config) file causes the window to be placed in the lower
188  right side of the screen. Depending on the screen size, it may be
189  flush to the bottom-left:
191set expgui(xpos) 25
192set expgui(ypos) 75
195  <B>Example 2:</B> Instead, this code causes the window to be placed on the right side of
196  the screen, vertically centered, but only when the screen has more than 2000 pixels (probably
197  indicating a dual-screen configuration)
199  if {[winfo screenwidth .] > 2000} {
200    set expgui(xpos) 25
[706]208The following variables are written to
209<font face="courier">.gsas_config</font> 
210(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[41]212"Save Options" is used. These variables are all set from the GUI and therefore
213do not need to be edited manually.
[550]216<DT><FONT FACE="COURIER">expgui(archive)</FONT><DD>
[41]217This defines the default state for the archive flag,
218where 0 is off and 1 is on. When archive is on, a copy of the .EXP file
[461]219is saved before a new version of the file is saved in EXPGUI.
[550]221<DT><FONT FACE="COURIER">expgui(font)</FONT><DD>
[423]222This determines the base font used in the programs. You conceivably
223could want to use an integer value not present in the
224"Options/Screen Font" menu command.
[550]226<DT><FONT FACE="COURIER">expgui(asorttype)</FONT><DD>
[41]227This determines the atom sort mode.
[550]229<DT><FONT FACE="COURIER">expgui(hsorttype)</FONT><DD>
[41]230This determines the histogram sort mode.
[550]232<DT><FONT FACE="COURIER">expgui(filesort)</FONT><DD>
[81]233This determines the default file sorting mode for the expnam command.
[550]235<DT><FONT FACE="COURIER">expgui(autoexpload)</FONT><DD>
[314]236If set to 1, the experiment file is automatically reread after
237GSAS programs modify it.
238(UNIX only)
[550]240<DT><FONT FACE="COURIER">expgui(showexptool)</FONT><DD>
[314]241If set to 1, output from EXPTOOL is shown after the program is run.
242This is probably needed only for debugging purposes.
[41]245Used only for UNIX: This determines if the default definition
[36]246for the backspace key is overridden; some UNIX systems need this so that
247expedt and other terminal-oriented programs work correctly and
[143]248other systems do not. You can toggle this option using the
249"Override Backspace" option on the file menu to see what works for you.
253<HR><H3><A NAME="import">Coordinate import routines for EXPGUI</A>
[299]254<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
[524]256See the <A HREF="expgui.html#import">coordinate import discussion</A> 
257for description of available formats.
[270]258It is possible to define new formats for EXPGUI to use for importing
[524]259phase/coordinate information. This is done by creating a file
260containing the appropriate Tcl code to read this file type.
261All that is needed to cause the code to be incorporated into
262EXPGUI is to name it
[550]263<FONT FACE="COURIER">import_</FONT><I>xxxx</I><FONT FACE="COURIER">.tcl</FONT> (where <I>xxxx</I> is arbitrary)
[524]264and place it in the EXPGUI directory. All files with
265such names are read when EXPGUI is started.
[550]267The <FONT FACE="COURIER">import_</FONT> file must contain four items:
270A description for the type of file to be read.
[270]273set description "PowderCell .CEL file"
[282]276The text should not be too long, but use a return (\n) if needed:
[270]278set description "My favorite coordinate\nfile from the GIGO pkg"
[282]280This description text shows up on the button for selecting a format.
[282]283A list of preferred file extensions.
[270]285set extensions .cel
[270]289set extensions {.jnk .junk}
[282]291In UNIX upper and lower case
292versions will be generated automatically, so do not worry about
293the case of the extension. Note that "*" (all files) is always added as well.
296The name of the routine that will read the data file
[270]298set procname ReadPowderCellFile
301A routine that takes the file name as an argument
[270]303proc ReadPowderCellFile {filename} {
[282]305and returns a list containing the following four items
[282]307<P><LI>Space Group
309The space group should be named and spaced appropriately for GSAS,
310e.g. P 21/c or P 21 21 21, not P21/c or P212121.
[282]312Note that GSAS requires that if a center of symmetry is present,
313this center defines the origin (Origin 2 settings, where more than one setting
314is given in the International Tables).
315<P><LI>Cell parameters
317All six parameters should be specified in a list
[282]319<P><LI>Atom Coordinates
321The atom coordinates should be specified as a list with a list element
322for each atom.
323The list contains the following items:
325<LI>Atom label
329<LI>Atom type
333If an item is not specified, it is left blank in the atom table, except for
334Occupancy and U<sub>iso</sub>, which default to 1.0 and 0.025, respectively.
335However, one must specify a null value, if an item will be skipped over.
336For example, use:
[270]338    "Li1 0 0 0 li 0.5"
[270]342    "{} 0 0 0 li 0.5"
[270]344but not
[270]346    "0 0 0 li 0.5"
[282]350<P><LI>Warning Message (optional)
352The warning message is displayed at the bottom of the
353Replace Atoms and Add Atoms box after the file is read. This can be used
354to warn the user about problems reading the file, for example if
355the space group symbol needs attention.
[550]358See the file <FONT FACE="COURIER">import_cell.tcl</FONT> as an example for how this code
[524]359is written.
[524]362<HR><H3><A NAME="export">Coordinate Export routines for EXPGUI</A>
363<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
365See the <A HREF="expgui.html#export">coordinate export discussion</A> 
366for description of available formats.
367It is possible to define new formats for EXPGUI to use for exporting
368phase/coordinate information. This is done by creating a file
369containing the appropriate Tcl code to read this file type.
370All that is needed to cause the code to be incorporated into
371EXPGUI is to name it
[550]372<FONT FACE="COURIER">export_</FONT><I>xxxx</I><FONT FACE="COURIER">.tcl</FONT> (where <I>xxxx</I> is arbitrary)
[524]373and place it in the EXPGUI directory. All files with
374such names are read when EXPGUI the Import/Export=>"Coord Export" submenu
375is first invoked.
[550]377The <FONT FACE="COURIER">export_</FONT> file must define two variables:
380This defines the text that appears on the submenu. For example:
[524]382        set label "MSI .xtl format"
385This defines the Tcl routine that will be used to
[524]387        set action exp2xtl
[550]390See the file <FONT FACE="COURIER">export_example.example</FONT>, as well as the
391<FONT FACE="COURIER">export_*.tcl</FONT> files
[524]392as examples for how this
393sort of routine is written.
[706]396The <FONT FACE="COURIER">localconfig</FONT> and
397<FONT FACE="COURIER">.gsas_config</FONT> 
398(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
399files are read, if present.
[41]400The following options are available for customization in these files:
[550]402<DT><FONT FACE="COURIER">txtvw(menulength)</FONT><DD>
[41]403This limits the number of entries that can
[36]404exist in a menu. For example, the default is 25, so when more than 25 cycles
405are found in a .LST file, only the last 25 are listed in the
406"Go To"/cycle submenu.
[550]407<DT><FONT FACE="COURIER">txtvw(maxchars)</FONT><DD>
[41]408This limits the maximum number of
[36]409characters that will be read from an existing .LST file to speed
[41]410the start of the program. The default is ~1Mb
[36]411for UNIX systems and ~200K for Windows.
[550]412<DT><FONT FACE="COURIER">txtvw(plotvars)</FONT><DD>
[524]413If txtvx(plotvars) is 1, a plot window is created for plotting of
414R-factors and parameter shifts as a function of cycle number.
415Note that the summary of shifts must be displayed, in order
416to plot parameter shifts. If this variable is set to 0, the
417plot window is not created and LSTVIEW runs a bit faster.
[706]420The following variables are written to
421<font face="courier">.gsas_config</font> 
422(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[81]424"Save Options" is used. These variables can be set from the GUI and therefore
425do not need to be edited manually.
[550]428<DT><FONT FACE="COURIER">txtvw(followcycle)</FONT><DD>
[41]429This sets the initial value for the
430"Auto Advance" button in the "Go To" menu. When this is true,
431the program will show the last cycle in the file. As new cycles are
432added, the "view" is advanced.
[550]434<DT><FONT FACE="COURIER">txtvw(font)</FONT><DD>
[81]435This sets the font used for LSTVIEW. See documentation on the font command in
436Tk for details on font naming.
439<hr><H3>LIVEPLOT</H3><A NAME="liveplot"></A>
[410]440A description of the customization options for LIVEPLOT can be
441found in the
442<A HREF="liveplot.html#customize">
443LIVEPLOT description</A>.
[524]447<a name="WIDPLT"></a>
[36]449The widplt script is used to display the FWHM for one or more histograms
[41]450from a .EXP file.
451At this point it only works for CW data.
452It is often convenient to add for reference the expected
[36]453instrumental curves as options to the menu. This can be done by creating a
454file called widplot_<i>name</i>. For example, renaming the
[550]455<font face="courier">example_widplt_BT1</font> file supplied with the distribution to
456<font face="courier">widplt_BT1</font> will cause the FWHM curves for the NIST BT-1 instrument
[36]457to be added to the menu of defined FWHM values.
459Creating such a file is easy. To add a entry define the following
460five array elements using a single, unique element name and then append that
461element name to variable datalist.
[36]464    set UVWP(Ge15) {398.5 -343.2  163.0 0}
465    set XY(Ge15) {0 0}
466    set wave(Ge15) 2.0775
467    set lblarr(Ge15) "BT-1 Ge(311) 15'"
468    set ttrange(Ge15) "5 160"
469    lappend datalist Ge15
[36]471Array element UVWP(item) contains the (Gaussian) GU, GV, GW and GP values,
[41]472while XY(item) contains the (Lorentzian) LX and LY terms. Array element
[36]473wave(item) contains a wavelength, array element lblarr(item) contains
474the text to be shown on the "Plot Contents" menu and ttrange(item)
475defines the range the function is valid.
[706]477The following variables are written to
478<font face="courier">.gsas_config</font> 
479(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[41]481"Save Options" is used. These variables are all set from the GUI and therefore
482do not need to be edited manually.
[550]485<DT><FONT FACE="COURIER">graph(printout)</FONT><DD>
[41]486This is set to 1 if PostScript files
487will be printed and 0 if they will be written to disk (for Windows all
488files should be written to disk).
[550]490<DT><FONT FACE="COURIER">graph(outname)</FONT><DD>
[41]491This is the default for the file name used
492when PostScript files will be written to disk.
[550]494<DT><FONT FACE="COURIER">graph(outcmd)</FONT><DD>
[41]495This is the default for the command used
496to print PostScript files (Unix only).
[550]498<DT><FONT FACE="COURIER">graph(legend)</FONT><DD>
[41]499Sets the default value for display of the legend in liveplot and widplt.
[550]501<DT><FONT FACE="COURIER">graph(plotunits)</FONT><DD>
[41]502Sets the units used for displaying the data. Values are "d", "q", "",
503for d-space, Q and 2-theta, respectively.
[550]504<DT><FONT FACE="COURIER">graph(equivwave)</FONT><DD>
[41]505Sets the wavelength used for displaying data, if blank, no conversion is
506done and data are shown in their original wavelength.
[114]510<a name="Customizing"><H2>
511Customizing Example 1: Adding a new button to the button bar
513When a LeBail extraction is used to refine lattice constants, profile
514terms, ... It is always a good idea to run GENLES a few times after running
515POWPREF. This is because GENLES sets the extracted intensities back to their
516crystallographic values, during the first GENLES cycle after POWPREF has been
517run. Refining anything until the extracted intensities return to reasonable
518values is a really bad idea. Forturnately, running GENLES with the number of
519cycles set to zero gives the Le Bail extraction a head start.
[550]521The code below can be used to define a new command, <font face="courier">leBail</font>. The first
[114]522command adds a command to the button bar and the second one defines what will
523be done when it is invoked (the number of cycles is set to zero and
524GENLES 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
525does not.
[114]528    lappend expgui(buttonlist) leBail
529    set expgui_cmdlist(leBail) {
530        {set entryvar(cycles) 0; runGSASwEXP "genles genles genles"}
531        {Converges GENLES with LeBail extractions;
532          Sets the number of cycles to zero and runs GENLES 3 times.}
533    }
536To make this customization, put the above in the <FONT FACE="COURIER">localconfig</FONT> 
[114]537file or the
[706]538<FONT FACE="COURIER">~/.gsas_config</FONT> or
539(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[143]543Customizing Example 2: Putting DISAGL Results in a Separate Box
545Barbara Reisner has been asking me to put the output from DISAGL in a separate
[143]546window. Sounds like a pretty reasonable request. Here is an example with code
547to do that as a customization option. Please note that this has now been
548incorporated into EXPGUI, so do not use this example.
[114]550  set expgui(disaglSeparateBox) 1
551  set expgui_cmdlist(disagl) {rundisagl {Hacked Distance/angle calculations}}
552  proc rundisagl {} {
553    global expgui txtvw tcl_version tcl_platform
[143]554    if {$expgui(disaglSeparateBox) && $tcl_platform(platform) != "windows"} {
[114]555        set root [file root $expgui(expfile)]
556        catch {file rename $root.LST $root.OLS}
557        runGSASwEXP disagl
558        catch {file rename $root.LST $root.DIS}
559        catch {file rename $root.OLS $root.LST}
561        # open a new window
562        catch {toplevel .disagl}
563        catch {eval grid forget [grid slaves .disagl]}
564        text .disagl.txt -width 100 -wrap none \
565                -yscrollcommand ".disagl.yscroll set" \
566                -xscrollcommand ".disagl.xscroll set"
567        if {$tcl_version >= 8.0} {.disagl.txt config -font $txtvw(font)}
568        scrollbar .disagl.yscroll -command ".disagl.txt yview"
569        scrollbar .disagl.xscroll -command ".disagl.txt xview" -orient horizontal
570        grid .disagl.xscroll -column 0 -row 2 -sticky ew
571        grid .disagl.txt -column 0 -row 1 -sticky nsew
572        grid .disagl.yscroll -column 1 -row 1 -sticky ns
573        grid columnconfigure .disagl 0 -weight 1
574        grid rowconfigure .disagl 1 -weight 1
575        wm title .disagl "DISAGL results $expgui(expfile)"
576        wm iconname .disagl "DISAGL $root"
577        set in [open $root.DIS r]
578        .disagl.txt insert end [read $in]
579        close $in
580        bind all <Control-KeyPress-c> {destroy .disagl}
581        bind .disagl <KeyPress-Prior> ".disagl.txt yview scroll -1 page"
582        bind .disagl <KeyPress-Next> ".disagl.txt yview scroll 1 page"
583        bind .disagl <KeyPress-Right> ".disagl.txt xview scroll 1 unit"
584        bind .disagl <KeyPress-Left> ".disagl.txt xview scroll -1 unit"
585        bind .disagl <KeyPress-Up> ".disagl.txt yview scroll -1 unit"
586        bind .disagl <KeyPress-Down> ".disagl.txt yview scroll 1 unit"
587        bind .disagl <KeyPress-Home> ".disagl.txt yview 0"
588        bind .disagl <KeyPress-End> ".disagl.txt yview end"
589        # don't disable in Win as this prevents the highlighting of selected text
590        if {$tcl_platform(platform) != "windows"} {
591            .disagl.txt config -state disabled
592        }
593    } else {
594        runGSASwEXP disagl
595    }
596  }
[143]598if {$tcl_platform(platform) != "windows"} {
599  append expgui(initstring) {
600      $expgui(fm) add checkbutton  -label "DISAGL window" \
601              -variable expgui(disaglSeparateBox) -underline 0;
602  }
606To make this customization, put the above in the <FONT FACE="COURIER">localconfig</FONT> 
[114]607file or the
[706]608<FONT FACE="COURIER">~/.gsas_config</FONT> or
609(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[550]612Note that the <font face="courier">expgui(initstring)</font> option became available in EXPGUI
[143]613version 1.21. (Previous versions will ignore this). This code must be executed
614after all the menus and other GUI code has been run. When executed, it
615creates a checkbutton on the Options menu to
616turn the "separate DISAGL window mode" mode on and off.
619Customizing Example 3: Adding a new page to EXPGUI
621The steps for creating support for additional functionality, implementation
622of atom constraints, is outlined here. Routines described here can be found in
[550]623file <font face="courier">atomcons.tcl</font> unless otherwise noted.
625<LI>Create a routine to read and write the appropriate records
626from the .EXP file. In this case, a new routine, constrinfo,
[550]627was added to file <font face="courier">readexp.tcl</font>.
[143]628This takes considerable care and manual testing.
629<LI>Create a routine that places the appropriate widgets into a frame
630(in this case MakeAtomsConstraintsPane). This routine will be called only once.
631Note that in this example expcons(atommaster) is defined to be the name of the
633<LI>Create a routine to display and edit the information shown in the
634frame. In this case, DisplayAtomConstraints. This routine will be called each
635time the page is displayed. Note that this routine and the previous can be
636tested in a separate toplevel until they work well.
637<LI>In this particular example, the previous frame is located on a notebook
638widget that in turn placed on a notebook page, so MakeConstraintsPane is used
639to create this inner notebook when the "Constraints" notebook page is first
640shown. This in turn calls MakeAtomsConstraintsPane and DisplayAtomConstraints.
[144]641To update this page each time it is displayed, DisplayConstraintsPane is
[550]643<LI>Edit file <font face="courier">expgui</font> to make the following changes:
[550]645<P><LI>load the <font face="courier">atomcons.tcl</font> file:
[144]647# commands for constraints
[143]648source [file join $expgui(scriptdir) atomcons.tcl]
[143]650<P><LI>Define a notebook page for the option. The -createcmd option
651is used only once, but the -raisecmd option is used every time
652the page is exposed.
[143]654set expgui(consFrame) [\
655            .n insert end consPane -text Constraints \
[144]656            -raisecmd "set expgui(pagenow) consFrame; DisplayConstraintsPane"\
[143]657            -createcmd MakeConstraintsPane]
[144]658lappend expgui(frameactionlist) "consFrame DisplayConstraintsPane"
[143]660Note that if we were displaying the atoms constraint page directly on
661the main notebook widget, the previous command would have been
[550]662<font face="courier">-raisecmd DisplayAtomConstraints -createcmd MakeAtomsConstraintsPane</font>
[144]664Since the frame will need to be updated when information in the .EXP file
665changes, the name of the frame and a command to execute are added into list
[550]666expgui(frameactionlist) using the <FONT FACE="COURIER">lappend expgui(frameactionlist)</FONT>
673Customizing Example 4: Changing the fonts used in the GUI
675<B>Question: </B>
[423]676<I>I am not happy with the fonts available via the Option/Screen Font
677menu option. Is there a way to select different font size(s)/families?
680<B>Answer: </B>
681The fonts used in EXPGUI can be customized by adding some code to the
[550]682<FONT FACE="COURIER">localconfig</FONT> file or the
[706]683<FONT FACE="COURIER">~/.gsas_config</FONT> or
684(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
[347]686By default, fonts are 14 point for the menus, buttons, labels,... and
68712 point for the histogram and atom lists.
[423]689If you add a command like this:
[423]691option add *Coord.Listbox.Font "Courier -18 bold italic" 20
[423]694you will override the menu command and force the atom coordinates
695to be displayed at 18 points in a bold & italicied Courier font.
696(See the Tk documentation if this is not clear). The value 20 is a
697priority, which overrides the priority value of 10 in the
698standard initialization. Here are the options that can be specified:
[550]700<DT><FONT FACE="COURIER">*Graph*Font</FONT><DD>Used for Graph labels
701<DT><FONT FACE="COURIER">*Graph.font</FONT><DD>Used for Graph title
702<DT><FONT FACE="COURIER">*Canvas.font</FONT><DD>Used for notebook tabs
703<DT><FONT FACE="COURIER">*Button.font</FONT><DD>Used on most buttons
704<DT><FONT FACE="COURIER">*Menu.font</FONT><DD>Used on menu commands
705<DT><FONT FACE="COURIER">*Menubutton.font</FONT><DD>Used on "menu buttons" (e.g. Print options)
706<DT><FONT FACE="COURIER">*Label.font</FONT><DD>Used on labels
707<DT><FONT FACE="COURIER">*Scale.font</FONT><DD>Used on sliders (e.g. Marquardt damping)
708<DT><FONT FACE="COURIER">*TitleFrame.font</FONT><DD>Used on title frames (e.g. box labels such as
[423]709the "Diffractometer Constants" label
[550]710<DT><FONT FACE="COURIER">*SmallFont.Button.font</FONT><DD>Used for buttons with smaller letters
711<DT><FONT FACE="COURIER">*Coord.Listbox.font</FONT><DD>Used for coordinate listings, best as a
[423]712mono-spaced font, such as Courier
[550]713<DT><FONT FACE="COURIER">*HistList.Listbox.font</FONT><DD>Used for histogram listings
714<DT><FONT FACE="COURIER">*MonoSpc.Label.font</FONT><DD>Used in other places where a mono-spaced
[423]715font is required
[347]718It should be noted that the appearance of fonts depends on many factors --
719the fonts installed on your computer, the screen size and resolution and your
[423]720eyes, so it is wise to experiment with different values.
[144]725<A Href="">
[886]727is written by Allen C. Larson and
728Robert B. Von Dreele while at Los Alamos National Laboratory.
729Problems, questions
[735]730or kudos concerning GSAS should be sent to Robert B. Von Dreele at <A HREF=""></A>
[896]732<P>EXPGUI was written by Brian H. Toby while at the NIST Center for Neutron Research,
733<A HREF="MAILTO:Brian.Toby@ANL.GOV">Brian.Toby@ANL.GOV</A>.
735<P>GSAS is Copyright, 1984-1997, The Regents of the University of California.
736The GSAS software was produced under a U.S. Government contract (W-7405-ENG-36)
737by the Los Alamos National Laboratory, which is operated by the University
738of California for the U.S. Department of Energy. The U.S. Government is
739licensed to use, reproduce, and distribute this software. Permission is
740granted to the public to copy and use this software without charge, provided
741that this notice and any statement of authorship are reproduced on all
742copies. Neither the Government nor the University makes any warranty, express
743or implied, or assumes any liability or responsibility for the use of this
[574]746<P>EXPGUI is not subject to copyright. Have fun.
750<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
[574]754<font size=-1><? lastmod(); ?> </font>
756$Revision: 971 $ $Date: 2010-03-28 14:19:30 +0000 (Sun, 28 Mar 2010) $
Note: See TracBrowser for help on using the repository browser.