1 | <HTML> |
---|
2 | <META NAME="Author" CONTENT="Brian H. Toby"> |
---|
3 | <TITLE>Customizing EXPGUI and Associated Programs</TITLE> |
---|
4 | <HEAD> |
---|
5 | </HEAD> |
---|
6 | <BODY BGCOLOR="#FFFFFF"> |
---|
7 | |
---|
8 | <A HREF=http://www.ncnr.nist.gov> |
---|
9 | <IMG SRC="http://www.ncnr.nist.gov/images/ncnrtrans.gif" |
---|
10 | alt="Link to NIST Center for Neutron Research home page" |
---|
11 | ALIGN=RIGHT></A> |
---|
12 | <A HREF=http://www.nist.gov> |
---|
13 | <IMG SRC="http://www.ncnr.nist.gov/images/webidblue_2lineright.gif" |
---|
14 | alt="Link to National Institute of Standards & Technology home page" |
---|
15 | ALIGN=LEFT></A> |
---|
16 | <CENTER> |
---|
17 | <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html"> |
---|
18 | <IMG SRC="tcltklogo100.gif" |
---|
19 | alt="Link to Tcl/Tk information"> |
---|
20 | </CENTER></A> |
---|
21 | <hr> |
---|
22 | |
---|
23 | <CENTER> |
---|
24 | <H1> |
---|
25 | Customizing EXPGUI and Associated Programs</H1></CENTER> |
---|
26 | |
---|
27 | The EXPGUI GSAS graphical user interface can be modified in many |
---|
28 | ways quite easily. |
---|
29 | This document describes how the GUI works and how to modify the menus without |
---|
30 | significant reprogramming. A little bit of programming in Tcl/Tk can go a |
---|
31 | long way in adding new features. See the |
---|
32 | <a HREF="#Customizing">Customizing</A> examples, below. |
---|
33 | |
---|
34 | <H3>EXPGUI</H3> |
---|
35 | The main GUI is created by file expgui, which in turn uses the following files |
---|
36 | sequentially: |
---|
37 | <UL> |
---|
38 | <LI><TT>readexp.tcl</TT> |
---|
39 | <LI><TT>gsascmds.tcl</TT> |
---|
40 | <LI><TT>gsasmenu.tcl</TT> |
---|
41 | </UL> |
---|
42 | Two additional files are read if they are found: |
---|
43 | <UL> |
---|
44 | <LI><TT>localconfig</TT> |
---|
45 | <LI><TT>.gsas_config</TT> |
---|
46 | </UL> |
---|
47 | <P>The first three files, |
---|
48 | (<TT>readexp.tcl</TT>, <TT>gsascmds.tcl</TT>, <TT>gsasmenu.tcl</TT>) |
---|
49 | must be located in the same directory where the <TT>expgui</TT> file is found. |
---|
50 | The <TT>localconfig</TT> file also is read from this directory, if it exists. |
---|
51 | The final file, <TT>.gsas_config</TT>, is read from the user's login directory (UNIX) or <TT>C:\</TT> (Windows). |
---|
52 | The <TT>localconfig</TT> and <TT>.gsas_config</TT> are intended to |
---|
53 | contain system-wide and user-level default values for parameters |
---|
54 | that are described in this document. Most routines have |
---|
55 | a "Save Options" command that writes some of the current parameters to |
---|
56 | file <TT>.gsas_config</TT>. Note that information in <TT>.gsas_config</TT> |
---|
57 | overrides that in <TT>localconfig</TT>. |
---|
58 | No error occurs if either of these files are not found. |
---|
59 | |
---|
60 | <P> |
---|
61 | The <TT>readexp.tcl</TT> and <TT>gsascmds.tcl</TT> files contain |
---|
62 | tcl procedures that are |
---|
63 | used for more than one application, so it is convenient to place them |
---|
64 | in separate files. They are only of interest to someone trying to debug |
---|
65 | or add new functionality to expgui. |
---|
66 | <P> |
---|
67 | The <TT>gsasmenu.tcl</TT> file defines the contents of the |
---|
68 | menu bar, the contents of the |
---|
69 | button bar and definitions for each command. The contents of this file |
---|
70 | are designed to be modified and extended by users, either by editing the file, |
---|
71 | or by overriding definitions in the <TT>localconfig</TT> or |
---|
72 | <TT>.gsas_config</TT> files. |
---|
73 | |
---|
74 | The important variables defined in the <TT>gsasmenu.tcl</TT> file are: |
---|
75 | <DL><DL> |
---|
76 | <DT>expgui(menunames)<DD> |
---|
77 | This list defines the menu bar headings other than File, Options & Help |
---|
78 | <DT>expgui_menulist<DD> |
---|
79 | Each array element, e.g. expgui_menulist(file) and expgui_menulist(powder), |
---|
80 | defines commands to be added to a menu heading. Each command will appear |
---|
81 | as an array element in expgui_cmdlist. |
---|
82 | <DT>expgui_cmdlist<DD> |
---|
83 | Each array element, e.g. expgui_cmdlist(Save) or expgui_cmdlist(expnam) |
---|
84 | contains two items. The first defines a tcl procedure to be executed |
---|
85 | when the command is invoked, or "-" if no command will be invoked and |
---|
86 | the second contains help information describing what the command does. |
---|
87 | Note that when menu item is selected the variable cmd is set to the |
---|
88 | name of the command, so |
---|
89 | <PRE> |
---|
90 | expgui_cmdlist(powpref) {{runGSASwEXP $cmd} {Powder data preparation}} |
---|
91 | </PRE> |
---|
92 | means that "runGSASwEXP powpref" will be invoked when powpref is invoked. |
---|
93 | . For example, when powpref is selected, the tcl command |
---|
94 | "runGSASwEXP $cmd" is invoked, where variable cmd is set to "powpref". |
---|
95 | <DT>expgui(buttonlist)<DD> |
---|
96 | This list defines the commands that will appear on the button bar where |
---|
97 | each item that appears on the button bar must have a matching pair of entries |
---|
98 | in expgui_cmdlist. |
---|
99 | Thus if the command |
---|
100 | <PRE> |
---|
101 | set expgui(buttonlist) {expnam expedt genles ortep fourier forsrh forplot lstview} |
---|
102 | </PRE> |
---|
103 | is placed in the <TT>localconfig</TT> or <TT>.gsas_config</TT> files this will |
---|
104 | redefine the contents of the button bar. |
---|
105 | </DL></DL> |
---|
106 | |
---|
107 | In addition to the variables defined in the previous file, expgui, uses |
---|
108 | a small number of array elements for other configuration options. They are: |
---|
109 | <DL><DL> |
---|
110 | |
---|
111 | <DT>expgui(scriptdir)<DD> |
---|
112 | This determines where files such as <TT>readexp.tcl</TT>, etc. |
---|
113 | are located. This defaults to the location where <TT>expgui</TT> is located so |
---|
114 | it rarely needs to be changed. |
---|
115 | |
---|
116 | <DT>expgui(gsasdir)<DD> |
---|
117 | This contains the location of the GSAS directory, if it is not the |
---|
118 | parent director where expgui is found. |
---|
119 | This determines where a number of GSAS data files will be located. If expedt |
---|
120 | crashes when you try to add new atoms, this is probably wrong. |
---|
121 | |
---|
122 | <DT>expgui(gsasexe)<DD> |
---|
123 | This determines where the GSAS executable files are located. |
---|
124 | You might want to change this is you keep multiple versions of GSAS |
---|
125 | around or if you keep the GSAS files in a different location than |
---|
126 | the default or want to keep the tcl files somewhere other than |
---|
127 | in a subdirectory of the GSAS files. |
---|
128 | |
---|
129 | <DT>expgui(coordfont)<DD> |
---|
130 | Sets the font used for the coordinates scroll box |
---|
131 | |
---|
132 | <DT>expgui(histfont)<DD> |
---|
133 | Sets the font used for the histogram scroll box |
---|
134 | |
---|
135 | <DT>liveplot(hst)<DD> |
---|
136 | Sets the default histogram used for liveplot |
---|
137 | |
---|
138 | <DT>liveplot(legend)<DD> |
---|
139 | Sets the default value for display of the legend in liveplot |
---|
140 | |
---|
141 | <DT>expgui(initstring)<DD> |
---|
142 | Defines commands to be executed by EXPGUI after all other commands |
---|
143 | have been run. This is used to define initialization commands in |
---|
144 | the <TT>localconfig</TT> or <TT>.gsas_config</TT> files that cannot be |
---|
145 | run at the time when the files are sourced. <I>(added in EXPGUI v1.21)</I> |
---|
146 | </DL></DL> |
---|
147 | |
---|
148 | The following variables are written to <tt>.gsas_config</tt> when |
---|
149 | "Save Options" is used. These variables are all set from the GUI and therefore |
---|
150 | do not need to be edited manually. |
---|
151 | |
---|
152 | <DL><DL> |
---|
153 | <DT>expgui(archive)<DD> |
---|
154 | This defines the default state for the archive flag, |
---|
155 | where 0 is off and 1 is on. When archive is on, a copy of the .EXP file |
---|
156 | is saved before a new version of the file is saved and before EXPEDT is run. |
---|
157 | |
---|
158 | <DT>expgui(asorttype)<DD> |
---|
159 | This determines the atom sort mode. |
---|
160 | |
---|
161 | <DT>expgui(hsorttype)<DD> |
---|
162 | This determines the histogram sort mode. |
---|
163 | |
---|
164 | <DT>expgui(filesort)<DD> |
---|
165 | This determines the default file sorting mode for the expnam command. |
---|
166 | |
---|
167 | <DT>env(GSASBACKSPACE)<DD> |
---|
168 | Used only for UNIX: This determines if the default definition |
---|
169 | for the backspace key is overridden; some UNIX systems need this so that |
---|
170 | expedt and other terminal-oriented programs work correctly and |
---|
171 | other systems do not. You can toggle this option using the |
---|
172 | "Override Backspace" option on the file menu to see what works for you. |
---|
173 | |
---|
174 | </DL></DL> |
---|
175 | |
---|
176 | <HR><H3>LSTVIEW</H3> |
---|
177 | The <TT>localconfig</TT> and <TT>.gsas_config</TT> files are read, if present. |
---|
178 | The following options are available for customization in these files: |
---|
179 | <DL><DL> |
---|
180 | <DT>txtvw(menulength)<DD> |
---|
181 | This limits the number of entries that can |
---|
182 | exist in a menu. For example, the default is 25, so when more than 25 cycles |
---|
183 | are found in a .LST file, only the last 25 are listed in the |
---|
184 | "Go To"/cycle submenu. |
---|
185 | <DT>txtvw(maxchars)<DD> |
---|
186 | This limits the maximum number of |
---|
187 | characters that will be read from an existing .LST file to speed |
---|
188 | the start of the program. The default is ~1Mb |
---|
189 | for UNIX systems and ~200K for Windows. |
---|
190 | </DL></DL> |
---|
191 | |
---|
192 | The following variables are written to <tt>.gsas_config</tt> when |
---|
193 | "Save Options" is used. These variables can be set from the GUI and therefore |
---|
194 | do not need to be edited manually. |
---|
195 | |
---|
196 | <DL><DL> |
---|
197 | <DT>txtvw(followcycle)<DD> |
---|
198 | This sets the initial value for the |
---|
199 | "Auto Advance" button in the "Go To" menu. When this is true, |
---|
200 | the program will show the last cycle in the file. As new cycles are |
---|
201 | added, the "view" is advanced. |
---|
202 | |
---|
203 | <DT>txtvw(font)<DD> |
---|
204 | This sets the font used for LSTVIEW. See documentation on the font command in |
---|
205 | Tk for details on font naming. |
---|
206 | </DL></DL> |
---|
207 | |
---|
208 | One additional variable is present that I don't suggest using at present: |
---|
209 | <UL> |
---|
210 | <LI>plotvars: I am in the process of developing code that tracks |
---|
211 | and plots shifts and R values as a function cycle number. Setting plotvars to 1 |
---|
212 | allows this code to be tested. |
---|
213 | </LI></UL> |
---|
214 | |
---|
215 | <hr><H3>LIVEPLOT</H3><A NAME="liveplot"></A> |
---|
216 | The <TT>localconfig</TT> and <TT>.gsas_config</TT> files are read, if present. |
---|
217 | Note that some of these options are relevant only if the tcldump program is |
---|
218 | present. |
---|
219 | <P> |
---|
220 | The following options are available for customization in these files: |
---|
221 | <DL><DL> |
---|
222 | <DT>peakinfo(flag<i>n</i>)<DD> |
---|
223 | These variables define if peak positions will be shown |
---|
224 | for reflections in phase "<i>n</i>". Reflections will be shown if |
---|
225 | the value is non-zero. |
---|
226 | |
---|
227 | <DT>peakinfo(color<i>n</i>)<DD> |
---|
228 | These variables define the default colors for |
---|
229 | reflections in phase "<i>n</i>" |
---|
230 | |
---|
231 | <DT>peakinfo(dashes<i>n</i>)<DD> |
---|
232 | These variables define if peaks will be dashed for |
---|
233 | reflections in phase "<i>n</i>" (UNIX only). Lines will be dashed if |
---|
234 | the value is non-zero. |
---|
235 | |
---|
236 | <DT>peakinfo(min<i>n</i>) and peakinfo(max<i>n</i>)<DD> |
---|
237 | These variables dictate the placement vertical position for reflection |
---|
238 | markers, when manually placed (see expgui(autotick), below). To draw |
---|
239 | to the edge of the screen, use -Inf and Inf. |
---|
240 | </DL></DL> |
---|
241 | |
---|
242 | The following variables are written to <tt>.gsas_config</tt> when |
---|
243 | "Save Options" is used. These variables are all set from the GUI and therefore |
---|
244 | do not need to be edited manually. |
---|
245 | |
---|
246 | <DL><DL> |
---|
247 | <DT>graph(printout)<DD> |
---|
248 | This is set to 1 if PostScript files |
---|
249 | will be printed and 0 if they will be written to disk (for Windows all |
---|
250 | files should be written to disk). |
---|
251 | |
---|
252 | <DT>graph(outname)<DD> |
---|
253 | This is the default for the file name used |
---|
254 | when PostScript files will be written to disk. |
---|
255 | |
---|
256 | <DT>graph(outcmd)<DD> |
---|
257 | This is the default for the command used |
---|
258 | to print PostScript files (Unix only). |
---|
259 | |
---|
260 | <DT>graph(legend)<DD> |
---|
261 | Sets the default value for display of the legend in liveplot and widplt. |
---|
262 | |
---|
263 | <DT>peakinfo(obssym)<DD> |
---|
264 | Symbol for observed data points. Valid choices are square, circle, diamond, |
---|
265 | plus, cross, splus and scross. |
---|
266 | |
---|
267 | <DT>peakinfo(obssize)<DD> |
---|
268 | Size for the symbol for observed data points. A value of 1 corresponds to about 1/8 inch |
---|
269 | (about 3 mm). |
---|
270 | |
---|
271 | <DT>expgui(pixelregion)<DD> |
---|
272 | When hkl values are loaded (using tcldump) and reflections are labeled, reflections |
---|
273 | can be labeled using a Shift-Left-Mouse click. All labeled reflections within expgui(pixelregion) |
---|
274 | pixels of the mouse position are assumed to be overlapped and are labeled. |
---|
275 | |
---|
276 | <DT>expgui(fadetime)<DD> |
---|
277 | The time in seconds before reflection labels are removed. A value of zero means that reflections |
---|
278 | must be deleted manually (Shift-Right-Mouse). |
---|
279 | |
---|
280 | <DT>expgui(lblfontsize)<DD> |
---|
281 | A size for reflections labels in pixels. |
---|
282 | |
---|
283 | <DT>expgui(hklbox)<DD> |
---|
284 | If this variable is non-zero, reflection indices are shown in a box. |
---|
285 | |
---|
286 | <DT>expgui(autotick)<DD> |
---|
287 | If this variable is non-zero, reflection markers positions are |
---|
288 | set automatically. |
---|
289 | </DL></DL> |
---|
290 | |
---|
291 | <P> |
---|
292 | <B>Using TCLDUMP with LIVEPLOT.</B> |
---|
293 | LIVEPLOT works with the standard GSAS program HSTDMP, but it works faster and is more |
---|
294 | powerful when used with the TCLDUMP program. Instructions for downloading this file can |
---|
295 | be found in the installation notes for |
---|
296 | <A HREF="expgui_Win_readme.html"> |
---|
297 | Windows</A> and |
---|
298 | <A HREF="expgui_Unix_readme.html"> |
---|
299 | UNIX</A>. Note that as of the April 2000 releases, GSAS is now distributed |
---|
300 | with TCLDUMP. |
---|
301 | <P> |
---|
302 | <B>Combining CMPR and LIVEPLOT.</B> |
---|
303 | If you have <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/cmpr.html">CMPR</A> |
---|
304 | installed on your computer, you can use superimpose on the GSAS results |
---|
305 | the peaks for an arbitrary unit cell. If desired, space group extinctions |
---|
306 | can even be shown. |
---|
307 | This is pretty neat! To enable this feature, you must have a version |
---|
308 | of CMPR downloaded after 4 May 1998 |
---|
309 | <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/cmpr.html"> |
---|
310 | (see the CMPR installation instructions.)</A> |
---|
311 | For UNIX, create a link from in the expgui |
---|
312 | directory to file cellgen.tcl in the CMPR directory. For example: |
---|
313 | <PRE> |
---|
314 | ln -s /usr/local/cmpr/cellgen.tcl /usr/local/gsas/expgui/cellgen.tcl |
---|
315 | </PRE> |
---|
316 | For Windows, copy all the CMPR .tcl and .exe files into the expgui directory. |
---|
317 | <P> |
---|
318 | <B>Combining LOGIC and LIVEPLOT</B> |
---|
319 | If you have <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/logic.html">LOGIC</A> |
---|
320 | installed on your computer, you can superimpose peaks |
---|
321 | for a entry from the ICDD/JCPDS database on a pattern in LIVEPLOT. |
---|
322 | This is also pretty neat! |
---|
323 | To enable this feature, you must have |
---|
324 | a version of LOGIC downloaded after 4 May 1998 |
---|
325 | <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/logic.html"> |
---|
326 | (see the LOGIC installation instructions.)</A> |
---|
327 | For UNIX, create a link from in the GSAS GUI |
---|
328 | directory to file icddcmd.tcl in the LOGIC directory. For example: |
---|
329 | <PRE> |
---|
330 | ln -s /usr/local/powdersuite/icddcmd.tcl /usr/local/gsas/tcl/icddcmd.tcl |
---|
331 | </PRE> |
---|
332 | For Windows, copy all the LOGIC files into the expgui directory. |
---|
333 | <HR> |
---|
334 | <H3>WIDPLT</H3> |
---|
335 | The widplt script is used to display the FWHM for one or more histograms |
---|
336 | from a .EXP file. |
---|
337 | At this point it only works for CW data. |
---|
338 | It is often convenient to add for reference the expected |
---|
339 | instrumental curves as options to the menu. This can be done by creating a |
---|
340 | file called widplot_<i>name</i>. For example, renaming the |
---|
341 | <tt>example_widplt_BT1</tt> file supplied with the distribution to |
---|
342 | <tt>widplt_BT1</tt> will cause the FWHM curves for the NIST BT-1 instrument |
---|
343 | to be added to the menu of defined FWHM values. |
---|
344 | <P> |
---|
345 | Creating such a file is easy. To add a entry define the following |
---|
346 | five array elements using a single, unique element name and then append that |
---|
347 | element name to variable datalist. |
---|
348 | Define |
---|
349 | <PRE> |
---|
350 | set UVWP(Ge15) {398.5 -343.2 163.0 0} |
---|
351 | set XY(Ge15) {0 0} |
---|
352 | set wave(Ge15) 2.0775 |
---|
353 | set lblarr(Ge15) "BT-1 Ge(311) 15'" |
---|
354 | set ttrange(Ge15) "5 160" |
---|
355 | lappend datalist Ge15 |
---|
356 | </PRE> |
---|
357 | Array element UVWP(item) contains the (Gaussian) GU, GV, GW and GP values, |
---|
358 | while XY(item) contains the (Lorentzian) LX and LY terms. Array element |
---|
359 | wave(item) contains a wavelength, array element lblarr(item) contains |
---|
360 | the text to be shown on the "Plot Contents" menu and ttrange(item) |
---|
361 | defines the range the function is valid. |
---|
362 | <P> |
---|
363 | The following variables are written to <tt>.gsas_config</tt> when |
---|
364 | "Save Options" is used. These variables are all set from the GUI and therefore |
---|
365 | do not need to be edited manually. |
---|
366 | |
---|
367 | <DL><DL> |
---|
368 | <DT>graph(printout)<DD> |
---|
369 | This is set to 1 if PostScript files |
---|
370 | will be printed and 0 if they will be written to disk (for Windows all |
---|
371 | files should be written to disk). |
---|
372 | |
---|
373 | <DT>graph(outname)<DD> |
---|
374 | This is the default for the file name used |
---|
375 | when PostScript files will be written to disk. |
---|
376 | |
---|
377 | <DT>graph(outcmd)<DD> |
---|
378 | This is the default for the command used |
---|
379 | to print PostScript files (Unix only). |
---|
380 | |
---|
381 | <DT>graph(legend)<DD> |
---|
382 | Sets the default value for display of the legend in liveplot and widplt. |
---|
383 | |
---|
384 | <DT>graph(plotunits)<DD> |
---|
385 | Sets the units used for displaying the data. Values are "d", "q", "", |
---|
386 | for d-space, Q and 2-theta, respectively. |
---|
387 | <DT>graph(equivwave)<DD> |
---|
388 | Sets the wavelength used for displaying data, if blank, no conversion is |
---|
389 | done and data are shown in their original wavelength. |
---|
390 | </DL></DL> |
---|
391 | |
---|
392 | <hr> |
---|
393 | <a name="Customizing"><H2> |
---|
394 | Customizing Example 1: Adding a new button to the button bar |
---|
395 | </H2></A> |
---|
396 | When a LeBail extraction is used to refine lattice constants, profile |
---|
397 | terms, ... It is always a good idea to run GENLES a few times after running |
---|
398 | POWPREF. This is because GENLES sets the extracted intensities back to their |
---|
399 | crystallographic values, during the first GENLES cycle after POWPREF has been |
---|
400 | run. Refining anything until the extracted intensities return to reasonable |
---|
401 | values is a really bad idea. Forturnately, running GENLES with the number of |
---|
402 | cycles set to zero gives the Le Bail extraction a head start. |
---|
403 | <P> |
---|
404 | The code below can be used to define a new command, <tt>leBail</tt>. The first |
---|
405 | command adds a command to the button bar and the second one defines what will |
---|
406 | be done when it is invoked (the number of cycles is set to zero and |
---|
407 | GENLES 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 |
---|
408 | does not. |
---|
409 | |
---|
410 | <PRE> |
---|
411 | lappend expgui(buttonlist) leBail |
---|
412 | set expgui_cmdlist(leBail) { |
---|
413 | {set entryvar(cycles) 0; runGSASwEXP "genles genles genles"} |
---|
414 | {Converges GENLES with LeBail extractions; |
---|
415 | Sets the number of cycles to zero and runs GENLES 3 times.} |
---|
416 | } |
---|
417 | |
---|
418 | </PRE> |
---|
419 | To make this customization, put the above in the <TT>localconfig</TT> |
---|
420 | file or the |
---|
421 | <TT>~/.gsas_config</TT> or (or <TT>C:\GSAS\EXPGUI\.gsas_config</TT>) |
---|
422 | file. |
---|
423 | <hr> |
---|
424 | <H2> |
---|
425 | Customizing Example 2: Putting DISAGL Results in a Separate Box |
---|
426 | </H2> |
---|
427 | Barbara Reisner has been asking me to put the output from DISAGL in a separate |
---|
428 | window. Sounds like a pretty reasonable request. Here is an example with code |
---|
429 | to do that as a customization option. Please note that this has now been |
---|
430 | incorporated into EXPGUI, so do not use this example. |
---|
431 | <PRE> |
---|
432 | set expgui(disaglSeparateBox) 1 |
---|
433 | set expgui_cmdlist(disagl) {rundisagl {Hacked Distance/angle calculations}} |
---|
434 | proc rundisagl {} { |
---|
435 | global expgui txtvw tcl_version tcl_platform |
---|
436 | if {$expgui(disaglSeparateBox) && $tcl_platform(platform) != "windows"} { |
---|
437 | set root [file root $expgui(expfile)] |
---|
438 | catch {file rename $root.LST $root.OLS} |
---|
439 | runGSASwEXP disagl |
---|
440 | catch {file rename $root.LST $root.DIS} |
---|
441 | catch {file rename $root.OLS $root.LST} |
---|
442 | |
---|
443 | # open a new window |
---|
444 | catch {toplevel .disagl} |
---|
445 | catch {eval grid forget [grid slaves .disagl]} |
---|
446 | text .disagl.txt -width 100 -wrap none \ |
---|
447 | -yscrollcommand ".disagl.yscroll set" \ |
---|
448 | -xscrollcommand ".disagl.xscroll set" |
---|
449 | if {$tcl_version >= 8.0} {.disagl.txt config -font $txtvw(font)} |
---|
450 | scrollbar .disagl.yscroll -command ".disagl.txt yview" |
---|
451 | scrollbar .disagl.xscroll -command ".disagl.txt xview" -orient horizontal |
---|
452 | grid .disagl.xscroll -column 0 -row 2 -sticky ew |
---|
453 | grid .disagl.txt -column 0 -row 1 -sticky nsew |
---|
454 | grid .disagl.yscroll -column 1 -row 1 -sticky ns |
---|
455 | grid columnconfigure .disagl 0 -weight 1 |
---|
456 | grid rowconfigure .disagl 1 -weight 1 |
---|
457 | wm title .disagl "DISAGL results $expgui(expfile)" |
---|
458 | wm iconname .disagl "DISAGL $root" |
---|
459 | set in [open $root.DIS r] |
---|
460 | .disagl.txt insert end [read $in] |
---|
461 | close $in |
---|
462 | bind all <Control-KeyPress-c> {destroy .disagl} |
---|
463 | bind .disagl <KeyPress-Prior> ".disagl.txt yview scroll -1 page" |
---|
464 | bind .disagl <KeyPress-Next> ".disagl.txt yview scroll 1 page" |
---|
465 | bind .disagl <KeyPress-Right> ".disagl.txt xview scroll 1 unit" |
---|
466 | bind .disagl <KeyPress-Left> ".disagl.txt xview scroll -1 unit" |
---|
467 | bind .disagl <KeyPress-Up> ".disagl.txt yview scroll -1 unit" |
---|
468 | bind .disagl <KeyPress-Down> ".disagl.txt yview scroll 1 unit" |
---|
469 | bind .disagl <KeyPress-Home> ".disagl.txt yview 0" |
---|
470 | bind .disagl <KeyPress-End> ".disagl.txt yview end" |
---|
471 | # don't disable in Win as this prevents the highlighting of selected text |
---|
472 | if {$tcl_platform(platform) != "windows"} { |
---|
473 | .disagl.txt config -state disabled |
---|
474 | } |
---|
475 | } else { |
---|
476 | runGSASwEXP disagl |
---|
477 | } |
---|
478 | } |
---|
479 | |
---|
480 | if {$tcl_platform(platform) != "windows"} { |
---|
481 | append expgui(initstring) { |
---|
482 | $expgui(fm).option.menu add checkbutton -label "DISAGL window" \ |
---|
483 | -variable expgui(disaglSeparateBox) -underline 0; |
---|
484 | } |
---|
485 | } |
---|
486 | |
---|
487 | </PRE> |
---|
488 | To make this customization, put the above in the <TT>localconfig</TT> |
---|
489 | file or the |
---|
490 | <TT>~/.gsas_config</TT> or (or <TT>C:\GSAS\EXPGUI\.gsas_config</TT>) |
---|
491 | file. |
---|
492 | <P> |
---|
493 | Note that the <tt>expgui(initstring)</tt> option became available in EXPGUI |
---|
494 | version 1.21. (Previous versions will ignore this). This code must be executed |
---|
495 | after all the menus and other GUI code has been run. When executed, it |
---|
496 | creates a checkbutton on the Options menu to |
---|
497 | turn the "separate DISAGL window mode" mode on and off. |
---|
498 | |
---|
499 | <hr><H2> |
---|
500 | Customizing Example 3: Adding a new page to EXPGUI |
---|
501 | </H2> |
---|
502 | The steps for creating support for additional functionality, implementation |
---|
503 | of atom constraints, is outlined here. Routines described here can be found in |
---|
504 | file <tt>atomcons.tcl</tt> unless otherwise noted. |
---|
505 | <OL> |
---|
506 | <LI>Create a routine to read and write the appropriate records |
---|
507 | from the .EXP file. In this case, a new routine, constrinfo, |
---|
508 | was added to file <tt>readexp.tcl</tt>. |
---|
509 | This takes considerable care and manual testing. |
---|
510 | <LI>Create a routine that places the appropriate widgets into a frame |
---|
511 | (in this case MakeAtomsConstraintsPane). This routine will be called only once. |
---|
512 | Note that in this example expcons(atommaster) is defined to be the name of the |
---|
513 | frame. |
---|
514 | <LI>Create a routine to display and edit the information shown in the |
---|
515 | frame. In this case, DisplayAtomConstraints. This routine will be called each |
---|
516 | time the page is displayed. Note that this routine and the previous can be |
---|
517 | tested in a separate toplevel until they work well. |
---|
518 | <LI>In this particular example, the previous frame is located on a notebook |
---|
519 | widget that in turn placed on a notebook page, so MakeConstraintsPane is used |
---|
520 | to create this inner notebook when the "Constraints" notebook page is first |
---|
521 | shown. This in turn calls MakeAtomsConstraintsPane and DisplayAtomConstraints. |
---|
522 | To update this page each time it is displayed, DisplayConstraintsPane is |
---|
523 | called. |
---|
524 | <LI>Edit file <tt>expgui</tt> to make the following changes: |
---|
525 | <UL> |
---|
526 | <P><LI>load the <tt>atomcons.tcl</tt> file: |
---|
527 | <PRE> |
---|
528 | # commands for constraints |
---|
529 | source [file join $expgui(scriptdir) atomcons.tcl] |
---|
530 | </PRE> |
---|
531 | <P><LI>Define a notebook page for the option. The -createcmd option |
---|
532 | is used only once, but the -raisecmd option is used every time |
---|
533 | the page is exposed. |
---|
534 | <PRE> |
---|
535 | set expgui(consFrame) [\ |
---|
536 | .n insert end consPane -text Constraints \ |
---|
537 | -raisecmd "set expgui(pagenow) consFrame; DisplayConstraintsPane"\ |
---|
538 | -createcmd MakeConstraintsPane] |
---|
539 | lappend expgui(frameactionlist) "consFrame DisplayConstraintsPane" |
---|
540 | </PRE> |
---|
541 | Note that if we were displaying the atoms constraint page directly on |
---|
542 | the main notebook widget, the previous command would have been |
---|
543 | <tt>-raisecmd DisplayAtomConstraints -createcmd MakeAtomsConstraintsPane</tt> |
---|
544 | <P> |
---|
545 | Since the frame will need to be updated when information in the .EXP file |
---|
546 | changes, the name of the frame and a command to execute are added into list |
---|
547 | expgui(frameactionlist) using the <TT>lappend expgui(frameactionlist)</TT> |
---|
548 | command. |
---|
549 | </PRE> |
---|
550 | </UL> |
---|
551 | </OL> |
---|
552 | <hr> |
---|
553 | <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/gsas.html"> |
---|
554 | GSAS</A> |
---|
555 | is written by Allen C. Larson and <A HREF="http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://lansce.lanl.gov/lujan/staff12/vondreele.htm"> |
---|
556 | Robert B. Von Dreele</A>, MS-H805, |
---|
557 | Los Alamos National Laboratory, Los Alamos, NM 87545. Problems, questions |
---|
558 | or kudos concerning GSAS should be sent to Robert B. Von Dreele at <A HREF="MAILTO:vondreele@lanl.gov">vondreele@lanl.gov</A> |
---|
559 | |
---|
560 | <P>This GUI is written by Brian H. Toby of the NIST Center for Neutron Research, |
---|
561 | <A HREF="MAILTO:Brian.Toby@NIST.GOV">Brian.Toby@NIST.GOV</A>. |
---|
562 | |
---|
563 | <P>GSAS is Copyright, 1984-1997, The Regents of the University of California. |
---|
564 | The GSAS software was produced under a U.S. Government contract (W-7405-ENG-36) |
---|
565 | by the Los Alamos National Laboratory, which is operated by the University |
---|
566 | of California for the U.S. Department of Energy. The U.S. Government is |
---|
567 | licensed to use, reproduce, and distribute this software. Permission is |
---|
568 | granted to the public to copy and use this software without charge, provided |
---|
569 | that this notice and any statement of authorship are reproduced on all |
---|
570 | copies. Neither the Government nor the University makes any warranty, express |
---|
571 | or implied, or assumes any liability or responsibility for the use of this |
---|
572 | software. |
---|
573 | |
---|
574 | <P>The GUI is not subject to copyright. Have fun. |
---|
575 | |
---|
576 | <P>Brian Toby (<A HREF="MAILTO:Brian.Toby@NIST.GOV">Brian.Toby@NIST.GOV)</A> |
---|
577 | <BR> |
---|
578 | $Revision: 144 $ $Date: 2009-12-04 23:01:08 +0000 (Fri, 04 Dec 2009) $ |
---|
579 | </BODY> |
---|
580 | </HTML> |
---|