source: trunk/doc/expgui_cfg.html

Last change on this file 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
Line 
1<HTML>
2   <TITLE>Customizing EXPGUI and Associated Programs</TITLE>
3
4   <meta name="keywords" content="crystallography, Rietveld, diffraction,
5   GSAS, EXPGUI">
6</HEAD>
7<style>
8A:link {text-decoration:none}
9A:vlink {text-decoration:none}
10</style>
11
12<BODY BGCOLOR="#FFFFFF"
13      topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" 
14      text="#000000" link="#0033ff" vlink="#0033ff" alink="#0033ff">
15
16<?
17   include("/var/www/include/navigation.inc");
18   include("/var/www/include/utility.inc");
19?>
20<blockquote><font face="arial, helvetica, sans-serif">
21
22<TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT>
23<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
24</TH></TR></TABLE><BR CLEAR=ALL>
25
26<CENTER><H1>
27<HR noshade width="75%" size="2" align="center">
28Customizing EXPGUI and Associated Programs
29<HR noshade width="75%" size="2" align="center">
30</H1></CENTER>
31
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
35significant reprogramming. A little bit of programming skills in Tcl/Tk
36can go a long way in adding new features. See the
37<a HREF="#Customizing">Customizing</A> examples, below.
38
39<H3>EXPGUI</H3>
40The main GUI is created by file expgui, which in turn uses the following files
41sequentially:
42<UL>
43<LI><FONT FACE="COURIER">readexp.tcl</FONT>
44<LI><FONT FACE="COURIER">gsascmds.tcl</FONT>
45<LI><FONT FACE="COURIER">gsasmenu.tcl</FONT>
46</UL>
47Two additional files are read if they are found:
48<UL>
49<LI><FONT FACE="COURIER">localconfig</FONT>
50<LI>UNIX: <FONT FACE="COURIER">.gsas_config</FONT>
51or Windows: <FONT FACE="COURIER">c:\gsas.config</FONT></UL>
52<P>The first three files,
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.
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
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
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>)
71overrides that in <FONT FACE="COURIER">localconfig</FONT>.
72No error occurs if either of these files are not found.
73
74<P>
75The <FONT FACE="COURIER">readexp.tcl</FONT> and <FONT FACE="COURIER">gsascmds.tcl</FONT> files contain
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.
80<P>
81The <FONT FACE="COURIER">gsasmenu.tcl</FONT> file defines the contents of the
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,
85or by overriding definitions in the <FONT FACE="COURIER">localconfig</FONT> or
86<FONT FACE="COURIER">.gsas_config</FONT> 
87(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
88files.
89
90The important variables defined in the <FONT FACE="COURIER">gsasmenu.tcl</FONT> file are:
91<DL><DL>
92<DT><FONT FACE="COURIER">expgui(menunames)</FONT><DD>
93This list defines the menu bar headings other than File, Options & Help
94<DT><FONT FACE="COURIER">expgui_menulist</FONT><DD>
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.
98<DT><FONT FACE="COURIER">expgui_cmdlist</FONT><DD>
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
105<FONT FACE="COURIER"><PRE>
106    expgui_cmdlist(powpref) {{runGSASwEXP $cmd} {Powder data preparation}}
107</PRE></FONT>
108means that "runGSASwEXP powpref" will be invoked when powpref is invoked.
109For example, when powpref is selected, the tcl command
110"runGSASwEXP $cmd" is invoked, where variable cmd is set to "powpref".
111<DT><FONT FACE="COURIER">expgui(buttonlist)</FONT><DD>
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
116<FONT FACE="COURIER"><PRE>
117   set expgui(buttonlist) {expnam expedt genles ortep fourier forsrh forplot lstview}
118</PRE></FONT>
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
123redefine the contents of the button bar.
124</DL></DL>
125
126In addition to the variables defined in the previous file, expgui, uses
127a small number of array elements for other configuration options. They are:
128<DL><DL>
129
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
133it rarely needs to be changed.
134
135<DT><FONT FACE="COURIER">expgui(gsasdir)</FONT><DD>
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.
140
141<DT><FONT FACE="COURIER">expgui(gsasexe)</FONT><DD>
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.
147
148<DT><FONT FACE="COURIER">expgui(bkgcolor1)</FONT><DD>
149Sets the background color for the bottom box on the phase panel.
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.
153
154<DT><FONT FACE="COURIER">liveplot(hst)</FONT><DD>
155Sets the default histogram used for liveplot
156
157<DT><FONT FACE="COURIER">liveplot(legend)</FONT><DD>
158Sets the default value for display of the legend in liveplot
159
160<DT><FONT FACE="COURIER">expgui(initstring)</FONT><DD>
161Defines commands to be executed by EXPGUI after all other commands
162have been run. This is used to define initialization commands in
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
167run at the time when the files are sourced. <I>(added in EXPGUI v1.21)</I>
168</DL>
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.
173<DL>
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).
185<P>
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:
190<blockquote><PRE>
191set expgui(xpos) 25
192set expgui(ypos) 75
193</PRE></blockquote> 
194<P>
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)
198<blockquote><PRE>
199  if {[winfo screenwidth .] > 2000} {
200    set expgui(xpos) 25
201}
202</PRE></blockquote>
203
204</DL>
205
206</DL></DL>
207
208The following variables are written to
209<font face="courier">.gsas_config</font> 
210(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
211when
212"Save Options" is used. These variables are all set from the GUI and therefore
213do not need to be edited manually.
214
215<DL><DL>
216<DT><FONT FACE="COURIER">expgui(archive)</FONT><DD>
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
219is saved before a new version of the file is saved in EXPGUI.
220
221<DT><FONT FACE="COURIER">expgui(font)</FONT><DD>
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.
225
226<DT><FONT FACE="COURIER">expgui(asorttype)</FONT><DD>
227This determines the atom sort mode.
228
229<DT><FONT FACE="COURIER">expgui(hsorttype)</FONT><DD>
230This determines the histogram sort mode.
231
232<DT><FONT FACE="COURIER">expgui(filesort)</FONT><DD>
233This determines the default file sorting mode for the expnam command.
234
235<DT><FONT FACE="COURIER">expgui(autoexpload)</FONT><DD>
236If set to 1, the experiment file is automatically reread after
237GSAS programs modify it.
238(UNIX only)
239
240<DT><FONT FACE="COURIER">expgui(showexptool)</FONT><DD>
241If set to 1, output from EXPTOOL is shown after the program is run.
242This is probably needed only for debugging purposes.
243
244<DT><FONT FACE="COURIER">env(GSASBACKSPACE)</FONT><DD>
245Used only for UNIX: This determines if the default definition
246for the backspace key is overridden; some UNIX systems need this so that
247expedt and other terminal-oriented programs work correctly and
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.
250</DL></DL>
251
252
253<HR><H3><A NAME="import">Coordinate import routines for EXPGUI</A>
254<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
255</H3>
256See the <A HREF="expgui.html#import">coordinate import discussion</A> 
257for description of available formats.
258It is possible to define new formats for EXPGUI to use for importing
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
263<FONT FACE="COURIER">import_</FONT><I>xxxx</I><FONT FACE="COURIER">.tcl</FONT> (where <I>xxxx</I> is arbitrary)
264and place it in the EXPGUI directory. All files with
265such names are read when EXPGUI is started.
266
267The <FONT FACE="COURIER">import_</FONT> file must contain four items:
268<UL>
269<LI>
270A description for the type of file to be read.
271<DL><DL>
272<FONT FACE="COURIER"><PRE>
273set description "PowderCell .CEL file"
274</PRE></FONT>
275</DL>
276The text should not be too long, but use a return (\n) if needed:
277<DL><FONT FACE="COURIER"><PRE>
278set description "My favorite coordinate\nfile from the GIGO pkg"
279</PRE></FONT></DL></DL>
280This description text shows up on the button for selecting a format.
281<P>
282<LI>
283A list of preferred file extensions.
284<DL><DL><FONT FACE="COURIER"><PRE>
285set extensions .cel
286</PRE></FONT></DL>
287or
288<DL><FONT FACE="COURIER"><PRE>
289set extensions {.jnk .junk}
290</PRE></FONT></DL></DL>
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.
294<P>
295<LI>
296The name of the routine that will read the data file
297<DL><DL><FONT FACE="COURIER"><PRE>
298set procname ReadPowderCellFile
299</PRE></FONT></DL></DL>
300<LI>
301A routine that takes the file name as an argument
302<DL><DL><FONT FACE="COURIER"><PRE>
303proc ReadPowderCellFile {filename} {
304</PRE></FONT></DL></DL>
305and returns a list containing the following four items
306<OL>
307<P><LI>Space Group
308<DL><DL>
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.
311</DL></DL>
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
316<DL><DL>
317All six parameters should be specified in a list
318</DL></DL>
319<P><LI>Atom Coordinates
320<DL><DL>
321The atom coordinates should be specified as a list with a list element
322for each atom.
323The list contains the following items:
324<OL>
325<LI>Atom label
326<LI><I>x</I>
327<LI><I>y</I>
328<LI><I>z</I>
329<LI>Atom type
330<LI>Occupancy
331<LI>U<sub>iso</sub>
332</OL>
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:
337<FONT FACE="COURIER"><PRE>
338    "Li1 0 0 0 li 0.5"
339</PRE></FONT>
340or
341<FONT FACE="COURIER"><PRE>
342    "{} 0 0 0 li 0.5"
343</PRE></FONT>
344but not
345<FONT FACE="COURIER"><PRE>
346    "0 0 0 li 0.5"
347</PRE></FONT>
348
349</DL></DL>
350<P><LI>Warning Message (optional)
351<DL><DL>
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.
356</DL></DL>
357</OL>
358See the file <FONT FACE="COURIER">import_cell.tcl</FONT> as an example for how this code
359is written.
360
361</UL>
362<HR><H3><A NAME="export">Coordinate Export routines for EXPGUI</A>
363<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
364</H3>
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
372<FONT FACE="COURIER">export_</FONT><I>xxxx</I><FONT FACE="COURIER">.tcl</FONT> (where <I>xxxx</I> is arbitrary)
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.
376
377The <FONT FACE="COURIER">export_</FONT> file must define two variables:
378<DL><DL>
379<DT>label<DD>
380This defines the text that appears on the submenu. For example:
381<FONT FACE="COURIER"><PRE>
382        set label "MSI .xtl format"
383</PRE></FONT>
384<DT>action<DD>
385This defines the Tcl routine that will be used to
386<FONT FACE="COURIER"><PRE>
387        set action exp2xtl
388</PRE></FONT>
389</DL></DL>
390See the file <FONT FACE="COURIER">export_example.example</FONT>, as well as the
391<FONT FACE="COURIER">export_*.tcl</FONT> files
392as examples for how this
393sort of routine is written.
394
395<HR><H3>LSTVIEW</H3>
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.
400The following options are available for customization in these files:
401<DL><DL>
402<DT><FONT FACE="COURIER">txtvw(menulength)</FONT><DD>
403This limits the number of entries that can
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.
407<DT><FONT FACE="COURIER">txtvw(maxchars)</FONT><DD>
408This limits the maximum number of
409characters that will be read from an existing .LST file to speed
410the start of the program. The default is ~1Mb
411for UNIX systems and ~200K for Windows.
412<DT><FONT FACE="COURIER">txtvw(plotvars)</FONT><DD>
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.
418</DL></DL>
419
420The following variables are written to
421<font face="courier">.gsas_config</font> 
422(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
423when
424"Save Options" is used. These variables can be set from the GUI and therefore
425do not need to be edited manually.
426
427<DL><DL>
428<DT><FONT FACE="COURIER">txtvw(followcycle)</FONT><DD>
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.
433
434<DT><FONT FACE="COURIER">txtvw(font)</FONT><DD>
435This sets the font used for LSTVIEW. See documentation on the font command in
436Tk for details on font naming.
437</DL></DL>
438
439<hr><H3>LIVEPLOT</H3><A NAME="liveplot"></A>
440A description of the customization options for LIVEPLOT can be
441found in the
442<A HREF="liveplot.html#customize">
443LIVEPLOT description</A>.
444
445
446<HR>
447<a name="WIDPLT"></a>
448<H3>WIDPLT</H3>
449The widplt script is used to display the FWHM for one or more histograms
450from a .EXP file.
451At this point it only works for CW data.
452It is often convenient to add for reference the expected
453instrumental curves as options to the menu. This can be done by creating a
454file called widplot_<i>name</i>. For example, renaming the
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
457to be added to the menu of defined FWHM values.
458<P>
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.
462Define
463<FONT FACE="COURIER"><PRE>
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
470</PRE></FONT>
471Array element UVWP(item) contains the (Gaussian) GU, GV, GW and GP values,
472while XY(item) contains the (Lorentzian) LX and LY terms. Array element
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.
476<P>
477The following variables are written to
478<font face="courier">.gsas_config</font> 
479(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
480when
481"Save Options" is used. These variables are all set from the GUI and therefore
482do not need to be edited manually.
483
484<DL><DL>
485<DT><FONT FACE="COURIER">graph(printout)</FONT><DD>
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).
489
490<DT><FONT FACE="COURIER">graph(outname)</FONT><DD>
491This is the default for the file name used
492when PostScript files will be written to disk.
493
494<DT><FONT FACE="COURIER">graph(outcmd)</FONT><DD>
495This is the default for the command used
496to print PostScript files (Unix only).
497
498<DT><FONT FACE="COURIER">graph(legend)</FONT><DD>
499Sets the default value for display of the legend in liveplot and widplt.
500
501<DT><FONT FACE="COURIER">graph(plotunits)</FONT><DD>
502Sets the units used for displaying the data. Values are "d", "q", "",
503for d-space, Q and 2-theta, respectively.
504<DT><FONT FACE="COURIER">graph(equivwave)</FONT><DD>
505Sets the wavelength used for displaying data, if blank, no conversion is
506done and data are shown in their original wavelength.
507</DL></DL>
508
509<hr>
510<a name="Customizing"><H2>
511Customizing Example 1: Adding a new button to the button bar
512</H2></A>
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.
520<P>
521The code below can be used to define a new command, <font face="courier">leBail</font>. The first
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.
526
527<FONT FACE="COURIER"><PRE>
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    }
534
535</PRE></FONT>
536To make this customization, put the above in the <FONT FACE="COURIER">localconfig</FONT> 
537file or the
538<FONT FACE="COURIER">~/.gsas_config</FONT> or
539(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
540file.
541<hr>
542<H2>
543Customizing Example 2: Putting DISAGL Results in a Separate Box
544</H2>
545Barbara Reisner has been asking me to put the output from DISAGL in a separate
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.
549<FONT FACE="COURIER"><PRE>
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
554    if {$expgui(disaglSeparateBox) && $tcl_platform(platform) != "windows"} {
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}
560
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  }
597
598if {$tcl_platform(platform) != "windows"} {
599  append expgui(initstring) {
600      $expgui(fm).option.menu add checkbutton  -label "DISAGL window" \
601              -variable expgui(disaglSeparateBox) -underline 0;
602  }
603}
604
605</PRE></FONT>
606To make this customization, put the above in the <FONT FACE="COURIER">localconfig</FONT> 
607file or the
608<FONT FACE="COURIER">~/.gsas_config</FONT> or
609(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
610file.
611<P>
612Note that the <font face="courier">expgui(initstring)</font> option became available in EXPGUI
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.
617
618<hr><H2>
619Customizing Example 3: Adding a new page to EXPGUI
620</H2>
621The steps for creating support for additional functionality, implementation
622of atom constraints, is outlined here. Routines described here can be found in
623file <font face="courier">atomcons.tcl</font> unless otherwise noted.
624<OL>
625<LI>Create a routine to read and write the appropriate records
626from the .EXP file. In this case, a new routine, constrinfo,
627was added to file <font face="courier">readexp.tcl</font>.
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
632frame.
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.
641To update this page each time it is displayed, DisplayConstraintsPane is
642called.
643<LI>Edit file <font face="courier">expgui</font> to make the following changes:
644<UL>
645<P><LI>load the <font face="courier">atomcons.tcl</font> file:
646<FONT FACE="COURIER"><PRE>
647# commands for constraints
648source [file join $expgui(scriptdir) atomcons.tcl]
649</PRE></FONT>
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.
653<FONT FACE="COURIER"><PRE>
654set expgui(consFrame) [\
655            .n insert end consPane -text Constraints \
656            -raisecmd "set expgui(pagenow) consFrame; DisplayConstraintsPane"\
657            -createcmd MakeConstraintsPane]
658lappend expgui(frameactionlist) "consFrame DisplayConstraintsPane"
659</PRE></FONT>
660Note that if we were displaying the atoms constraint page directly on
661the main notebook widget, the previous command would have been
662<font face="courier">-raisecmd DisplayAtomConstraints -createcmd MakeAtomsConstraintsPane</font>
663<P>
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
666expgui(frameactionlist) using the <FONT FACE="COURIER">lappend expgui(frameactionlist)</FONT>
667command.
668</PRE></FONT>
669</UL>
670</OL>
671
672<hr><H2>
673Customizing Example 4: Changing the fonts used in the GUI
674</H2>
675<B>Question: </B>
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?
678</I>
679<UL>
680<B>Answer: </B>
681The fonts used in EXPGUI can be customized by adding some code to the
682<FONT FACE="COURIER">localconfig</FONT> file or the
683<FONT FACE="COURIER">~/.gsas_config</FONT> or
684(or <FONT FACE="COURIER">c:\gsas.config</FONT>)
685file.
686By default, fonts are 14 point for the menus, buttons, labels,... and
68712 point for the histogram and atom lists.
688<P>
689If you add a command like this:
690<UL><FONT FACE="COURIER"><PRE>
691option add *Coord.Listbox.Font "Courier -18 bold italic" 20
692</PRE></FONT></UL>
693<P>
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:
699<DL><DL>
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
709the "Diffractometer Constants" label
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
712mono-spaced font, such as Courier
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
715font is required
716</DL></DL>
717<P>
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
720eyes, so it is wise to experiment with different values.
721</UL>
722<hr>
723<blockquote>
724
725<A Href="http://www.ncnr.nist.gov/programs/crystallography/software/gsas.html">
726GSAS</A>
727is written by Allen C. Larson and
728Robert B. Von Dreele while at Los Alamos National Laboratory.
729Problems, questions
730or kudos concerning GSAS should be sent to Robert B. Von Dreele at <A HREF="MAILTO:vondreele@anl.gov">vondreele@anl.gov</A>
731
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>.
734
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
744software.
745
746<P>EXPGUI is not subject to copyright. Have fun.
747</blockquote>
748<P><hr>
749<TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT>
750<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
751</TH></TR></TABLE>
752
753<P>
754<font size=-1><? lastmod(); ?> </font>
755<BR>
756$Revision: 971 $ $Date: 2010-03-28 14:19:30 +0000 (Sun, 28 Mar 2010) $
757</blockquote>
758</BODY>
759</HTML>
Note: See TracBrowser for help on using the repository browser.