source: trunk/doc/expgui_cfg.html @ 550

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

# on 2002/01/23 20:00:50, toby did:
clean up font references

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