Changeset 2588


Ignore:
Timestamp:
Dec 16, 2016 12:07:04 PM (5 years ago)
Author:
vondreele
Message:

TextCtrl? --> ValidatedTxtCtrl? for Pawley dmin & wt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r2572 r2588  
    839839                generalData['doPawley'] = pawlRef.GetValue()
    840840           
    841             def OnPawleyVal(event):
    842                 event.Skip()
    843                 try:
    844                     dmin = float(pawlVal.GetValue())
    845                     if 0.25 <= dmin <= 20.:
    846                         generalData['Pawley dmin'] = dmin
    847                 except ValueError:
    848                     pass
    849                 pawlVal.SetValue("%.5f"%(generalData['Pawley dmin']))          #reset in case of error               
    850            
    851             def OnPawleyNegWt(event):
    852                 event.Skip()
    853                 try:
    854                     wt = float(pawlNegWt.GetValue())
    855                     if 0. <= wt <= 1.:
    856                         generalData['Pawley neg wt'] = wt
    857                 except ValueError:
    858                     pass
    859                 pawlNegWt.SetValue("%.4f"%(generalData['Pawley neg wt']))          #reset in case of error
    860 
    861841            pawleySizer = wx.BoxSizer(wx.HORIZONTAL)
    862842            pawleySizer.Add(wx.StaticText(General,label=' Pawley controls: '),0,WACV)
     
    866846            pawleySizer.Add(pawlRef,0,WACV)
    867847            pawleySizer.Add(wx.StaticText(General,label=' Pawley dmin: '),0,WACV)
    868 #        azmthOff = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'azmthOff',nDig=(10,2),typeHint=float,OnLeave=OnAzmthOff)
    869             pawlVal = wx.TextCtrl(General,value='%.5f'%(generalData['Pawley dmin']),style=wx.TE_PROCESS_ENTER)
    870             pawlVal.Bind(wx.EVT_TEXT_ENTER,OnPawleyVal)       
    871             pawlVal.Bind(wx.EVT_KILL_FOCUS,OnPawleyVal)
     848            pawlVal = G2G.ValidatedTxtCtrl(General,generalData,'Pawley dmin',
     849                min=0.25,max=20.,nDig=(10,5),typeHint=float)
    872850            pawleySizer.Add(pawlVal,0,WACV)
    873851            pawleySizer.Add(wx.StaticText(General,label=' Pawley neg. wt.: '),0,WACV)
    874 #        azmthOff = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'azmthOff',nDig=(10,2),typeHint=float,OnLeave=OnAzmthOff)
    875             pawlNegWt = wx.TextCtrl(General,value='%.4f'%(generalData['Pawley neg wt']),style=wx.TE_PROCESS_ENTER)
    876             pawlNegWt.Bind(wx.EVT_TEXT_ENTER,OnPawleyNegWt)       
    877             pawlNegWt.Bind(wx.EVT_KILL_FOCUS,OnPawleyNegWt)
     852            pawlNegWt = G2G.ValidatedTxtCtrl(General,generalData,'Pawley neg wt',
     853                min=0.,max=1.,nDig=(10,4),typeHint=float)
    878854            pawleySizer.Add(pawlNegWt,0,WACV)
    879855            return pawleySizer
Note: See TracChangeset for help on using the changeset viewer.