Ignore:
Timestamp:
Dec 16, 2013 10:43:01 AM (9 years ago)
Author:
toby
Message:

update imports to provide error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sphinxdocs/build/html/_modules/GSASIIpwdGUI.html

    r1129 r1168  
    5454<span class="c">#GSASIIpwdGUI - powder data display routines</span>
    5555<span class="c">########### SVN repository information ###################</span>
    56 <span class="c"># $Date: 2013-10-15 15:01:21 -0500 (Tue, 15 Oct 2013) $</span>
    57 <span class="c"># $Author: vondreele $</span>
    58 <span class="c"># $Revision: 1107 $</span>
    59 <span class="c"># $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/GSASIIpwdGUI.py $</span>
    60 <span class="c"># $Id: GSASIIpwdGUI.py 1107 2013-10-15 20:01:21Z vondreele $</span>
     56<span class="c"># $Date: 2013-11-22 16:24:29 -0600 (Fri, 22 Nov 2013) $</span>
     57<span class="c"># $Author: toby $</span>
     58<span class="c"># $Revision: 1147 $</span>
     59<span class="c"># $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/GSASIIpwdGUI.py $</span>
     60<span class="c"># $Id: GSASIIpwdGUI.py 1147 2013-11-22 22:24:29Z toby $</span>
    6161<span class="c">########### SVN repository information ###################</span>
    6262<span class="sd">&#39;&#39;&#39;</span>
     
    8080<span class="kn">import</span> <span class="nn">cPickle</span>
    8181<span class="kn">import</span> <span class="nn">GSASIIpath</span>
    82 <span class="n">GSASIIpath</span><span class="o">.</span><span class="n">SetVersionNumber</span><span class="p">(</span><span class="s">&quot;$Revision: 1107 $&quot;</span><span class="p">)</span>
     82<span class="n">GSASIIpath</span><span class="o">.</span><span class="n">SetVersionNumber</span><span class="p">(</span><span class="s">&quot;$Revision: 1147 $&quot;</span><span class="p">)</span>
    8383<span class="kn">import</span> <span class="nn">GSASIImath</span> <span class="kn">as</span> <span class="nn">G2mth</span>
    8484<span class="kn">import</span> <span class="nn">GSASIIpwd</span> <span class="kn">as</span> <span class="nn">G2pwd</span>
     
    115115<div class="viewcode-block" id="SetDefaultSample"><a class="viewcode-back" href="../GSASIIGUI.html#GSASIIpwdGUI.SetDefaultSample">[docs]</a><span class="k">def</span> <span class="nf">SetDefaultSample</span><span class="p">():</span>
    116116    <span class="s">&#39;Needs a doc string&#39;</span>
    117     <span class="k">return</span> <span class="p">{</span><span class="s">&#39;ranId&#39;</span><span class="p">:</span><span class="n">ran</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="n">sys</span><span class="o">.</span><span class="n">maxint</span><span class="p">),</span>
     117    <span class="k">return</span> <span class="p">{</span>
     118        <span class="s">&#39;ranId&#39;</span><span class="p">:</span><span class="n">ran</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="n">sys</span><span class="o">.</span><span class="n">maxint</span><span class="p">),</span>
    118119        <span class="s">&#39;Scale&#39;</span><span class="p">:[</span><span class="mf">1.0</span><span class="p">,</span><span class="bp">True</span><span class="p">],</span><span class="s">&#39;Type&#39;</span><span class="p">:</span><span class="s">&#39;Debye-Scherrer&#39;</span><span class="p">,</span><span class="s">&#39;Absorption&#39;</span><span class="p">:[</span><span class="mf">0.0</span><span class="p">,</span><span class="bp">False</span><span class="p">],</span>
    119120        <span class="s">&#39;DisplaceX&#39;</span><span class="p">:[</span><span class="mf">0.0</span><span class="p">,</span><span class="bp">False</span><span class="p">],</span><span class="s">&#39;DisplaceY&#39;</span><span class="p">:[</span><span class="mf">0.0</span><span class="p">,</span><span class="bp">False</span><span class="p">],</span><span class="s">&#39;Diffuse&#39;</span><span class="p">:[],</span>
    120         <span class="s">&#39;Temperature&#39;</span><span class="p">:</span><span class="mf">300.</span><span class="p">,</span><span class="s">&#39;Pressure&#39;</span><span class="p">:</span><span class="mf">1.0</span><span class="p">,</span><span class="s">&#39;Humidity&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span>
    121         <span class="s">&#39;Voltage&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span><span class="s">&#39;Force&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span><span class="s">&#39;Gonio. radius&#39;</span><span class="p">:</span><span class="mf">200.0</span><span class="p">,</span>
    122         <span class="s">&#39;Omega&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span><span class="s">&#39;Chi&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span><span class="s">&#39;Phi&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">}</span>
     121        <span class="s">&#39;Temperature&#39;</span><span class="p">:</span><span class="mf">300.</span><span class="p">,</span><span class="s">&#39;Pressure&#39;</span><span class="p">:</span><span class="mf">1.0</span><span class="p">,</span>
     122        <span class="s">&#39;FreePrm1&#39;</span><span class="p">:</span><span class="mf">0.</span><span class="p">,</span><span class="s">&#39;FreePrm2&#39;</span><span class="p">:</span><span class="mf">0.</span><span class="p">,</span><span class="s">&#39;FreePrm3&#39;</span><span class="p">:</span><span class="mf">0.</span><span class="p">,</span>
     123        <span class="s">&#39;Gonio. radius&#39;</span><span class="p">:</span><span class="mf">200.0</span><span class="p">,</span>
     124        <span class="s">&#39;Omega&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span><span class="s">&#39;Chi&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span><span class="s">&#39;Phi&#39;</span><span class="p">:</span><span class="mf">0.0</span>
     125        <span class="p">}</span>
    123126                         
    124127<span class="c">################################################################################</span>
     
    12911294            <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
    12921295
     1296    <span class="k">def</span> <span class="nf">OnScaleRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1297        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
     1298        <span class="n">data</span><span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
     1299       
     1300    <span class="k">def</span> <span class="nf">OnScaleVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1301        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
     1302        <span class="k">try</span><span class="p">:</span>
     1303            <span class="n">scale</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
     1304            <span class="k">if</span> <span class="n">scale</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
     1305                <span class="n">data</span><span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">scale</span>
     1306        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
     1307            <span class="k">pass</span>
     1308        <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.4f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
     1309       
     1310    <span class="k">def</span> <span class="nf">OnHistoType</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1311        <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
     1312        <span class="n">data</span><span class="p">[</span><span class="s">&#39;Type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
     1313        <span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;Type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;Bragg-Brentano&#39;</span> <span class="ow">and</span> <span class="s">&#39;Shift&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>    <span class="c">#set up defaults for new type(s)</span>
     1314            <span class="n">data</span><span class="p">[</span><span class="s">&#39;Shift&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="bp">False</span><span class="p">]</span>
     1315            <span class="n">data</span><span class="p">[</span><span class="s">&#39;Transparency&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="bp">False</span><span class="p">]</span>
     1316        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateSampleGrid</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
     1317       
     1318    <span class="k">def</span> <span class="nf">SetNameVal</span><span class="p">():</span>
     1319        <span class="n">inst</span> <span class="o">=</span> <span class="n">instNameVal</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
     1320        <span class="n">data</span><span class="p">[</span><span class="s">&#39;InstrName&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">inst</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
     1321
     1322    <span class="k">def</span> <span class="nf">OnNameVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
     1323        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
     1324        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">SetNameVal</span><span class="p">)</span>       
     1325
     1326    <span class="c">######## DEBUG #######################################################</span>
     1327    <span class="c">#import GSASIIpwdGUI</span>
     1328    <span class="c">#reload(GSASIIpwdGUI)</span>
     1329    <span class="c">#reload(G2gd)</span>
     1330    <span class="c">######################################################################</span>
    12931331    <span class="k">if</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">:</span>
    12941332        <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
     
    13021340        <span class="n">Status</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="o">.</span><span class="n">CreateStatusBar</span><span class="p">()</span>   
    13031341    <span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataFrame</span><span class="p">)</span>
    1304 
     1342    <span class="n">Controls</span> <span class="o">=</span> <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">GetItemPyData</span><span class="p">(</span>
     1343        <span class="n">G2gd</span><span class="o">.</span><span class="n">GetPatternTreeItemId</span><span class="p">(</span><span class="n">G2frame</span><span class="p">,</span><span class="n">G2frame</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="s">&#39;Controls&#39;</span><span class="p">))</span>
    13051344<span class="c">#patch</span>
    13061345    <span class="k">if</span> <span class="s">&#39;ranId&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
     
    13101349    <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;Omega&#39;</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
    13111350        <span class="n">data</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="s">&#39;Omega&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span><span class="s">&#39;Chi&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span><span class="s">&#39;Phi&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">})</span>
     1351    <span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;Temperature&#39;</span><span class="p">])</span> <span class="ow">is</span> <span class="nb">int</span><span class="p">:</span>
     1352        <span class="n">data</span><span class="p">[</span><span class="s">&#39;Temperature&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;Temperature&#39;</span><span class="p">])</span>
     1353    <span class="k">if</span> <span class="s">&#39;FreePrm1&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">Controls</span><span class="p">:</span>
     1354        <span class="n">Controls</span><span class="p">[</span><span class="s">&#39;FreePrm1&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;Sample humidity (%)&#39;</span>
     1355    <span class="k">if</span> <span class="s">&#39;FreePrm2&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">Controls</span><span class="p">:</span>
     1356        <span class="n">Controls</span><span class="p">[</span><span class="s">&#39;FreePrm2&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;Sample voltage (V)&#39;</span>
     1357    <span class="k">if</span> <span class="s">&#39;FreePrm3&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">Controls</span><span class="p">:</span>
     1358        <span class="n">Controls</span><span class="p">[</span><span class="s">&#39;FreePrm3&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;Applied load (MN)&#39;</span>
     1359    <span class="k">if</span> <span class="s">&#39;FreePrm1&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
     1360        <span class="n">data</span><span class="p">[</span><span class="s">&#39;FreePrm1&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.</span>
     1361    <span class="k">if</span> <span class="s">&#39;FreePrm2&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
     1362        <span class="n">data</span><span class="p">[</span><span class="s">&#39;FreePrm2&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.</span>
     1363    <span class="k">if</span> <span class="s">&#39;FreePrm3&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
     1364        <span class="n">data</span><span class="p">[</span><span class="s">&#39;FreePrm3&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.</span>
    13121365<span class="c">#patch end</span>
    13131366   
    1314     <span class="n">parms</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&#39;Gonio. radius&#39;</span><span class="p">,</span><span class="s">&#39; Goniometer radius(mm): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.2f</span><span class="s">&#39;</span><span class="p">,]]</span>
     1367    <span class="n">parms</span> <span class="o">=</span> <span class="p">[]</span>
     1368    <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Scale&#39;</span><span class="p">,</span><span class="s">&#39;Histogram scale factor: &#39;</span><span class="p">])</span>
     1369    <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Gonio. radius&#39;</span><span class="p">,</span><span class="s">&#39;Goniometer radius (mm): &#39;</span><span class="p">])</span>
    13151370    <span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;Type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;Debye-Scherrer&#39;</span><span class="p">:</span>
    1316         <span class="n">parms</span> <span class="o">+=</span> <span class="p">[[</span><span class="s">&#39;DisplaceX&#39;</span><span class="p">,</span><span class="s">u&#39; Sample X displ. perp. to beam (</span><span class="se">\xb5</span><span class="s">m): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.2f</span><span class="s">&#39;</span><span class="p">,],</span>
    1317             <span class="p">[</span><span class="s">&#39;DisplaceY&#39;</span><span class="p">,</span><span class="s">u&#39; Sample Y displ. || to beam (</span><span class="se">\xb5</span><span class="s">m): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.2f</span><span class="s">&#39;</span><span class="p">,],</span>
    1318             <span class="p">[</span><span class="s">&#39;Absorption&#39;</span><span class="p">,</span><span class="s">u&#39; Sample absorption(</span><span class="se">\xb5</span><span class="s">r): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.4f</span><span class="s">&#39;</span><span class="p">,],]</span>
     1371        <span class="n">parms</span> <span class="o">+=</span> <span class="p">[[</span><span class="s">&#39;DisplaceX&#39;</span><span class="p">,</span><span class="s">u&#39;Sample X displ. perp. to beam (</span><span class="se">\xb5</span><span class="s">m): &#39;</span><span class="p">],</span>
     1372            <span class="p">[</span><span class="s">&#39;DisplaceY&#39;</span><span class="p">,</span><span class="s">u&#39;Sample Y displ. || to beam (</span><span class="se">\xb5</span><span class="s">m): &#39;</span><span class="p">],</span>
     1373            <span class="p">[</span><span class="s">&#39;Absorption&#39;</span><span class="p">,</span><span class="s">u&#39;Sample absorption (</span><span class="se">\xb5\xb7</span><span class="s">r): &#39;</span><span class="p">],]</span>
    13191374    <span class="k">elif</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;Type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;Bragg-Brentano&#39;</span><span class="p">:</span>
    1320         <span class="n">parms</span> <span class="o">+=</span> <span class="p">[[</span><span class="s">&#39;Shift&#39;</span><span class="p">,</span><span class="s">u&#39; Sample displacement(</span><span class="se">\xb5</span><span class="s">m): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.2f</span><span class="s">&#39;</span><span class="p">,],</span>
    1321             <span class="p">[</span><span class="s">&#39;Transparency&#39;</span><span class="p">,</span><span class="s">u&#39; Sample transparency(1/</span><span class="se">\xb5</span><span class="s">eff,cm): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.4f</span><span class="s">&#39;</span><span class="p">],]</span>
    1322     <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Omega&#39;</span><span class="p">,</span><span class="s">&#39;Goniometer omega:&#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.2f</span><span class="s">&#39;</span><span class="p">])</span>
    1323     <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Chi&#39;</span><span class="p">,</span><span class="s">&#39;Goniometer chi:&#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.2f</span><span class="s">&#39;</span><span class="p">])</span>
    1324     <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Phi&#39;</span><span class="p">,</span><span class="s">&#39;Goniometer phi:&#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.2f</span><span class="s">&#39;</span><span class="p">])</span>
    1325     <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Temperature&#39;</span><span class="p">,</span><span class="s">&#39; Sample temperature(K): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.2f</span><span class="s">&#39;</span><span class="p">])</span>
    1326     <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Pressure&#39;</span><span class="p">,</span><span class="s">&#39; Sample pressure(MPa): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.3f</span><span class="s">&#39;</span><span class="p">])</span>
    1327     <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Humidity&#39;</span><span class="p">,</span><span class="s">&#39; Sample humidity(%): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.1f</span><span class="s">&#39;</span><span class="p">])</span>
    1328     <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Voltage&#39;</span><span class="p">,</span><span class="s">&#39; Sample voltage(V): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.3f</span><span class="s">&#39;</span><span class="p">])</span>
    1329     <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Force&#39;</span><span class="p">,</span><span class="s">&#39; Applied load(MN): &#39;</span><span class="p">,</span><span class="s">&#39;</span><span class="si">%.3f</span><span class="s">&#39;</span><span class="p">])</span>
    1330     <span class="n">objList</span> <span class="o">=</span> <span class="p">{}</span>
    1331 
    1332     <span class="k">def</span> <span class="nf">OnScaleRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    1333         <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
    1334         <span class="n">data</span><span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
    1335        
    1336     <span class="k">def</span> <span class="nf">OnScaleVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    1337         <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
    1338         <span class="k">try</span><span class="p">:</span>
    1339             <span class="n">scale</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
    1340             <span class="k">if</span> <span class="n">scale</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
    1341                 <span class="n">data</span><span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">scale</span>
    1342         <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
    1343             <span class="k">pass</span>
    1344         <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%.4f</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
    1345        
    1346     <span class="k">def</span> <span class="nf">OnHistoType</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    1347         <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
    1348         <span class="n">data</span><span class="p">[</span><span class="s">&#39;Type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
    1349         <span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="s">&#39;Type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;Bragg-Brentano&#39;</span> <span class="ow">and</span> <span class="s">&#39;Shift&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>    <span class="c">#set up defaults for new type(s)</span>
    1350             <span class="n">data</span><span class="p">[</span><span class="s">&#39;Shift&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="bp">False</span><span class="p">]</span>
    1351             <span class="n">data</span><span class="p">[</span><span class="s">&#39;Transparency&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span><span class="bp">False</span><span class="p">]</span>
    1352         <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">UpdateSampleGrid</span><span class="p">,</span><span class="n">G2frame</span><span class="p">,</span><span class="n">data</span><span class="p">)</span>
    1353        
    1354     <span class="k">def</span> <span class="nf">OnParmRef</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    1355         <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
    1356         <span class="n">parm</span> <span class="o">=</span> <span class="n">objList</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
    1357         <span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
    1358        
    1359     <span class="k">def</span> <span class="nf">OnParmVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    1360         <span class="n">Obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
    1361         <span class="n">parm</span> <span class="o">=</span> <span class="n">objList</span><span class="p">[</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span>
    1362         <span class="k">try</span><span class="p">:</span>
    1363             <span class="k">if</span> <span class="s">&#39;list&#39;</span> <span class="ow">in</span> <span class="nb">str</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]])):</span>
    1364                 <span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
    1365             <span class="k">else</span><span class="p">:</span>
    1366                 <span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">Obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
    1367         <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
    1368             <span class="k">pass</span>
    1369         <span class="k">if</span> <span class="s">&#39;list&#39;</span> <span class="ow">in</span> <span class="nb">str</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]])):</span>
    1370             <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">parm</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="mi">0</span><span class="p">]))</span>          <span class="c">#reset in case of error</span>
    1371         <span class="k">else</span><span class="p">:</span>
    1372             <span class="n">Obj</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">parm</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]]))</span>          <span class="c">#reset in case of error</span>
    1373 
    1374     <span class="k">def</span> <span class="nf">SetNameVal</span><span class="p">():</span>
    1375         <span class="n">inst</span> <span class="o">=</span> <span class="n">instNameVal</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
    1376         <span class="n">data</span><span class="p">[</span><span class="s">&#39;InstrName&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">inst</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
    1377 
    1378     <span class="k">def</span> <span class="nf">OnNameVal</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    1379         <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
    1380         <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">SetNameVal</span><span class="p">)</span>       
     1375        <span class="n">parms</span> <span class="o">+=</span> <span class="p">[[</span><span class="s">&#39;Shift&#39;</span><span class="p">,</span><span class="s">u&#39;Sample displacement(</span><span class="se">\xb5</span><span class="s">m): &#39;</span><span class="p">],</span>
     1376            <span class="p">[</span><span class="s">&#39;Transparency&#39;</span><span class="p">,</span><span class="s">u&#39;Sample transparency(1/</span><span class="se">\xb5</span><span class="s">eff, cm): &#39;</span><span class="p">],]</span>
     1377    <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Omega&#39;</span><span class="p">,</span><span class="s">&#39;Goniometer omega:&#39;</span><span class="p">,])</span>
     1378    <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Chi&#39;</span><span class="p">,</span><span class="s">&#39;Goniometer chi:&#39;</span><span class="p">,])</span>
     1379    <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Phi&#39;</span><span class="p">,</span><span class="s">&#39;Goniometer phi:&#39;</span><span class="p">,])</span>
     1380    <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Temperature&#39;</span><span class="p">,</span><span class="s">&#39;Sample temperature (K): &#39;</span><span class="p">,])</span>
     1381    <span class="n">parms</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&#39;Pressure&#39;</span><span class="p">,</span><span class="s">&#39;Sample pressure (MPa): &#39;</span><span class="p">,])</span>
    13811382               
    13821383    <span class="n">mainSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
    13831384    <span class="n">topSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
    13841385    <span class="n">topSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span><span class="mi">1</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
    1385     <span class="n">topSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39; Sample and Experimental Parameters&#39;</span><span class="p">))</span>
     1386    <span class="n">topSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;Sample and Experimental Parameters&#39;</span><span class="p">))</span>
    13861387    <span class="n">topSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span><span class="mi">1</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
    13871388    <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">topSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
    13881389    <span class="n">nameSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
    1389     <span class="n">nameSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span><span class="s">&#39;Instrument Name&#39;</span><span class="p">),</span>
     1390    <span class="n">nameSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span><span class="s">&#39; Instrument Name&#39;</span><span class="p">),</span>
    13901391                <span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    13911392    <span class="n">nameSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span><span class="mi">1</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
     
    13951396    <span class="n">instNameVal</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_CHAR</span><span class="p">,</span><span class="n">OnNameVal</span><span class="p">)</span>
    13961397    <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">nameSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
    1397     <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">),</span><span class="mi">0</span><span class="p">)</span>
     1398    <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">5</span><span class="p">,</span><span class="mi">5</span><span class="p">),</span><span class="mi">0</span><span class="p">)</span>
    13981399
    1399     <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">5</span><span class="p">,</span><span class="mi">5</span><span class="p">),</span><span class="mi">0</span><span class="p">)</span>
    1400     <span class="n">parmSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FlexGridSizer</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span>
    1401     <span class="n">scaleRef</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">CheckBox</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39; Histogram scale factor: &#39;</span><span class="p">)</span>
    1402     <span class="n">scaleRef</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
    1403     <span class="n">scaleRef</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_CHECKBOX</span><span class="p">,</span> <span class="n">OnScaleRef</span><span class="p">)</span>
    1404     <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">scaleRef</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    1405     <span class="n">scaleVal</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span>
    1406         <span class="s">&#39;</span><span class="si">%.4f</span><span class="s">&#39;</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;Scale&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]),</span><span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
    1407     <span class="n">scaleVal</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT_ENTER</span><span class="p">,</span><span class="n">OnScaleVal</span><span class="p">)</span>
    1408     <span class="n">scaleVal</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_KILL_FOCUS</span><span class="p">,</span><span class="n">OnScaleVal</span><span class="p">)</span>
    1409     <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">scaleVal</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    1410     <span class="n">typeSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
     1400    <span class="n">nameSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BoxSizer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
     1401    <span class="n">nameSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span><span class="s">&#39; Diffractometer type: &#39;</span><span class="p">),</span>
     1402                <span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    14111403    <span class="n">choices</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;Debye-Scherrer&#39;</span><span class="p">,</span><span class="s">&#39;Bragg-Brentano&#39;</span><span class="p">,]</span>
    14121404    <span class="n">histoType</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ComboBox</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span><span class="n">value</span><span class="o">=</span><span class="n">data</span><span class="p">[</span><span class="s">&#39;Type&#39;</span><span class="p">],</span><span class="n">choices</span><span class="o">=</span><span class="n">choices</span><span class="p">,</span>
    14131405        <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">CB_READONLY</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">CB_DROPDOWN</span><span class="p">)</span>
    14141406    <span class="n">histoType</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">,</span> <span class="n">OnHistoType</span><span class="p">)</span>
    1415     <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">histoType</span><span class="p">)</span>
    1416     <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">5</span><span class="p">,</span><span class="mi">5</span><span class="p">),</span><span class="mi">0</span><span class="p">)</span>
    1417    
    1418     <span class="k">for</span> <span class="n">parm</span> <span class="ow">in</span> <span class="n">parms</span><span class="p">:</span>
    1419         <span class="k">if</span> <span class="s">&#39;list&#39;</span> <span class="ow">in</span> <span class="nb">str</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]])):</span>
    1420             <span class="n">parmRef</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">CheckBox</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">parm</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
    1421             <span class="n">objList</span><span class="p">[</span><span class="n">parmRef</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span> <span class="o">=</span> <span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
    1422             <span class="n">parmRef</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="mi">1</span><span class="p">])</span>
    1423             <span class="n">parmRef</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_CHECKBOX</span><span class="p">,</span> <span class="n">OnParmRef</span><span class="p">)</span>
    1424             <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">parmRef</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    1425             <span class="n">parmVal</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span>
    1426                 <span class="n">parm</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]][</span><span class="mi">0</span><span class="p">]),</span><span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
     1407    <span class="n">nameSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">histoType</span><span class="p">)</span>
     1408    <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">nameSizer</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
     1409    <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">5</span><span class="p">,</span><span class="mi">5</span><span class="p">),</span><span class="mi">0</span><span class="p">)</span>
     1410
     1411    <span class="n">parmSizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FlexGridSizer</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span>
     1412    <span class="k">for</span> <span class="n">key</span><span class="p">,</span><span class="n">lbl</span> <span class="ow">in</span> <span class="n">parms</span><span class="p">:</span>
     1413        <span class="k">if</span> <span class="s">&#39;list&#39;</span> <span class="ow">in</span> <span class="nb">str</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">key</span><span class="p">])):</span>
     1414            <span class="n">parmRef</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">G2CheckBox</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="s">&#39; &#39;</span><span class="o">+</span><span class="n">lbl</span><span class="p">,</span><span class="n">data</span><span class="p">[</span><span class="n">key</span><span class="p">],</span><span class="mi">1</span><span class="p">)</span>
     1415            <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">parmRef</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
     1416            <span class="n">parmVal</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">ValidatedTxtCtrl</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">data</span><span class="p">[</span><span class="n">key</span><span class="p">],</span><span class="mi">0</span><span class="p">,</span><span class="n">typeHint</span><span class="o">=</span><span class="nb">float</span><span class="p">)</span>
    14271417        <span class="k">else</span><span class="p">:</span>
    1428             <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">parm</span><span class="p">[</span><span class="mi">1</span><span class="p">]),</span>
    1429                 <span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="p">)</span>
    1430             <span class="n">parmVal</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span>
    1431                 <span class="n">parm</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">%</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">parm</span><span class="p">[</span><span class="mi">0</span><span class="p">]]),</span><span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>       
    1432         <span class="n">objList</span><span class="p">[</span><span class="n">parmVal</span><span class="o">.</span><span class="n">GetId</span><span class="p">()]</span> <span class="o">=</span> <span class="n">parm</span>
    1433         <span class="n">parmVal</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT_ENTER</span><span class="p">,</span><span class="n">OnParmVal</span><span class="p">)</span>
    1434         <span class="n">parmVal</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_KILL_FOCUS</span><span class="p">,</span><span class="n">OnParmVal</span><span class="p">)</span>
     1418            <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39; &#39;</span><span class="o">+</span><span class="n">lbl</span><span class="p">),</span>
     1419                <span class="mi">0</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_CENTER_VERTICAL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
     1420            <span class="n">parmVal</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">ValidatedTxtCtrl</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">data</span><span class="p">,</span><span class="n">key</span><span class="p">,</span><span class="n">typeHint</span><span class="o">=</span><span class="nb">float</span><span class="p">)</span>
    14351421        <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">parmVal</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
    1436     <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">parmSizer</span><span class="p">)</span>
     1422    <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">(</span><span class="s">&#39;FreePrm1&#39;</span><span class="p">,</span><span class="s">&#39;FreePrm2&#39;</span><span class="p">,</span><span class="s">&#39;FreePrm3&#39;</span><span class="p">):</span>
     1423        <span class="n">parmVal</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">ValidatedTxtCtrl</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">Controls</span><span class="p">,</span><span class="n">key</span><span class="p">,</span><span class="n">typeHint</span><span class="o">=</span><span class="nb">str</span><span class="p">,</span>
     1424                                        <span class="n">notBlank</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
     1425        <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">parmVal</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
     1426        <span class="n">parmVal</span> <span class="o">=</span> <span class="n">G2gd</span><span class="o">.</span><span class="n">ValidatedTxtCtrl</span><span class="p">(</span><span class="n">G2frame</span><span class="o">.</span><span class="n">dataDisplay</span><span class="p">,</span><span class="n">data</span><span class="p">,</span><span class="n">key</span><span class="p">,</span><span class="n">typeHint</span><span class="o">=</span><span class="nb">float</span><span class="p">)</span>
     1427        <span class="n">parmSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">parmVal</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
     1428    <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">parmSizer</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
    14371429    <span class="n">mainSizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">),</span><span class="mi">0</span><span class="p">)</span>   
    14381430   
     
    18521844                <span class="n">G2frame</span><span class="o">.</span><span class="n">PatternTree</span><span class="o">.</span><span class="n">SetItemPyData</span><span class="p">(</span><span class="n">sub</span><span class="p">,</span> \
    18531845                    <span class="n">G2IO</span><span class="o">.</span><span class="n">SetNewPhase</span><span class="p">(</span><span class="n">Name</span><span class="o">=</span><span class="n">PhaseName</span><span class="p">,</span><span class="n">SGData</span><span class="o">=</span><span class="n">SGData</span><span class="p">,</span><span class="n">cell</span><span class="o">=</span><span class="n">cell</span><span class="p">[</span><span class="mi">1</span><span class="p">:]))</span>
    1854                 <span class="n">Status</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&#39;Change space group if needed&#39;</span><span class="p">)</span>
     1846                <span class="n">Status</span><span class="o">.</span><span class="n">SetStatusText</span><span class="p">(</span><span class="s">&#39;Change space group from &#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">controls</span><span class="p">[</span><span class="mi">13</span><span class="p">])</span><span class="o">+</span><span class="s">&#39; if needed&#39;</span><span class="p">)</span>
    18551847        <span class="k">finally</span><span class="p">:</span>
    18561848            <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
Note: See TracChangeset for help on using the changeset viewer.