Changeset 2769


Ignore:
Timestamp:
Apr 1, 2017 8:41:24 AM (5 years ago)
Author:
vondreele
Message:

remove commented imports from G2ctrls
force float for all common transform matrices
replace wx.TextCtrl? with G2G.ValidatedTxtCtrl? for floats in G2grid
(old code commented out for now - to be removed)
force r space group for H->R transformations (easily forgotten)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrls.py

    r2755 r2769  
    2626import time
    2727import copy
    28 # import cPickle
    29 # import numpy as np
    30 # import numpy.ma as ma
    31 # import scipy.optimize as so
    3228import wx.html        # could postpone this for quicker startup
    3329import webbrowser     # could postpone this for quicker startup
     
    3632GSASIIpath.SetVersionNumber("$Revision$")
    3733import GSASIIgrid as G2gd
    38 # import GSASIImath as G2mth
    39 # import GSASIIIO as G2IO
    40 # import GSASIIstrIO as G2stIO
    41 # import GSASIIlattice as G2lat
    42 # import GSASIIplot as G2plt
    4334import GSASIIpwdGUI as G2pdG
    44 # import GSASIIimgGUI as G2imG
    45 # import GSASIIphsGUI as G2phG
    46 # import GSASIIspc as G2spc
    47 # import GSASIImapvars as G2mv
    48 # import GSASIIconstrGUI as G2cnstG
    49 # import GSASIIrestrGUI as G2restG
    5035import GSASIIpy3 as G2py3
    51 # import GSASIIobj as G2obj
    52 # import GSASIIexprGUI as G2exG
    5336import GSASIIlog as log
    5437
  • trunk/GSASIIgrid.py

    r2767 r2769  
    161161VERY_LIGHT_GREY = wx.Colour(235,235,235)
    162162
    163 commonTrans = {'abc':np.eye(3),'a-cb':np.array([[1,0,0],[0,0,-1],[0,1,0]]),
    164     'ba-c':np.array([[0,1,0],[1,0,0],[0,0,-1]]),'-cba':np.array([[0,0,-1],[0,1,0],[1,0,0]]),
    165     'bca':np.array([[0,1,0],[0,0,1],[1,0,0]]),'cab':np.array([[0,0,1],[1,0,0],[0,1,0]]),
    166     'R->H':np.array([[1,-1,0],[0,1,-1],[1,1,1]]),'H->R':np.array([[2./3,1./3,1./3],[-1./3,1./3,1./3],[-1./3,-2./3,1./3]]),
    167     'P->A':np.array([[-1,0,0],[0,-1,1],[0,1,1]]),'R->O':np.array([[-1,0,0],[0,-1,0],[0,0,1]]),
    168     'P->B':np.array([[-1,0,1],[0,-1,0],[1,0,1]]),'B->P':np.array([[-.5,0,.5],[0,-1,0],[.5,0,.5]]),
    169     'P->C':np.array([[1,1,0],[1,-1,0],[0,0,-1]]),'C->P':np.array([[.5,.5,0],[.5,-.5,0],[0,0,-1]]),
    170     'P->F':np.array([[-1,1,1],[1,-1,1],[1,1,-1]]),'F->P':np.array([[0,.5,.5],[.5,0,.5],[.5,.5,0]]),   
    171     'P->I':np.array([[0,1,1],[1,0,1],[1,1,0]]),'I->P':np.array([[-.5,.5,.5],[.5,-.5,.5],[.5,.5,-.5]]),   
    172     'A->P':np.array([[-1,0,0],[0,-.5,.5],[0,.5,.5]]),'O->R':np.array([[-1,0,0],[0,-1,0],[0,0,1]]),
     163commonTrans = {'abc':np.eye(3),'a-cb':np.array([[1.,0.,0.],[0.,0.,-1.],[0.,1.,0.]]),
     164    'ba-c':np.array([[0.,1.,0.],[1.,0.,0.],[0.,0.,-1.]]),'-cba':np.array([[0.,0.,-1.],[0.,1.,0.],[1.,0.,0.]]),
     165    'bca':np.array([[0.,1.,0.],[0.,0.,1.],[1.,0.,0.]]),'cab':np.array([[0.,0.,1.],[1.,0.,0.],[0.,1.,0.]]),
     166    'R->H':np.array([[1.,-1.,0.],[0.,1.,-1.],[1.,1.,1.]]),'H->R':np.array([[2./3,1./3,1./3],[-1./3,1./3,1./3],[-1./3,-2./3,1./3]]),
     167    'P->A':np.array([[-1.,0.,0.],[0.,-1.,1.],[0.,1.,1.]]),'R->O':np.array([[-1.,0.,0.],[0.,-1.,0.],[0.,0.,1.]]),
     168    'P->B':np.array([[-1.,0.,1.],[0.,-1.,0.],[1.,0.,1.]]),'B->P':np.array([[-.5,0.,.5],[0.,-1.,0.],[.5,0.,.5]]),
     169    'P->C':np.array([[1.,1.,0.],[1.,-1.,0.],[0.,0.,-1.]]),'C->P':np.array([[.5,.5,0.],[.5,-.5,0.],[0.,0.,-1.]]),
     170    'P->F':np.array([[-1.,1.,1.],[1.,-1.,1.],[1.,1.,-1.]]),'F->P':np.array([[0.,.5,.5],[.5,0.,.5],[.5,.5,0.]]),   
     171    'P->I':np.array([[0.,1.,1.],[1.,0.,1.],[1.,1.,0.]]),'I->P':np.array([[-.5,.5,.5],[.5,-.5,.5],[.5,.5,-.5]]),   
     172    'A->P':np.array([[-1.,0.,0.],[0.,-.5,.5],[0.,.5,.5]]),'O->R':np.array([[-1.,0.,0.],[0.,-1.,0.],[0.,0.,1.]]),
    173173    'abc*':np.eye(3), }
    174174commonNames = ['abc','bca','cab','a-cb','ba-c','-cba','P->A','A->P','P->B','B->P','P->C','C->P',
    175     'P->I','I->P','P->F','F->P','P->R','R->P','R->O','O->R','abc*',]
     175    'P->I','I->P','P->F','F->P','H->R','R->H','R->O','O->R','abc*',]
    176176
    177177# Should SGMessageBox, SymOpDialog, DisAglDialog be moved?
     
    421421    def Draw(self):
    422422       
    423         def OnRadius(event):
    424             event.Skip()
    425             try:
    426                 val = float(radius.GetValue())
    427                 if val < 0.5:
    428                     raise ValueError
    429                 self.Sphere = val
    430             except ValueError:
    431                 pass
    432             radius.SetValue('%.3f'%(self.Sphere))
    433            
     423#        def OnRadius(event):
     424#            event.Skip()
     425#            try:
     426#                val = float(radius.GetValue())
     427#                if val < 0.5:
     428#                    raise ValueError
     429#                self.Sphere = val
     430#            except ValueError:
     431#                pass
     432#            radius.SetValue('%.3f'%(self.Sphere))
     433#           
    434434        def OnAtomType(event):
    435435            Obj = event.GetEventObject()
     
    459459        sphereSizer = wx.BoxSizer(wx.HORIZONTAL)
    460460        sphereSizer.Add(wx.StaticText(self.panel,label=' Sphere radius: '),0,WACV)
    461         radius = wx.TextCtrl(self.panel,value='%.3f'%(self.Sphere),style=wx.TE_PROCESS_ENTER)
    462         radius.Bind(wx.EVT_TEXT_ENTER,OnRadius)
    463         radius.Bind(wx.EVT_KILL_FOCUS,OnRadius)
     461        radius = G2G.ValidatedTxtCtrl(self.panel,self.Sphere,nDig=(10,3),typeHint=float,size=(65,25))
     462#        radius = wx.TextCtrl(self.panel,value='%.3f'%(self.Sphere),style=wx.TE_PROCESS_ENTER)
     463#        radius.Bind(wx.EVT_TEXT_ENTER,OnRadius)
     464#        radius.Bind(wx.EVT_KILL_FOCUS,OnRadius)
    464465        sphereSizer.Add(radius,0,WACV)
    465466        mainSizer.Add(sphereSizer,0,WACV)
     
    541542    def Draw(self):
    542543               
    543         def OnMatValue(event):
    544             event.Skip()
    545             Obj = event.GetEventObject()
    546             ix,iy = Ind[Obj.GetId()]
    547             val = Obj.GetValue()
    548             try:
    549                 if '/' in val:
    550                     vals = val.split('/')
    551                     self.Trans[iy,ix] = float(vals[0])/float(vals[1])
    552                 else:   
    553                     self.Trans[iy,ix] = float(Obj.GetValue())
    554             except ValueError:
    555                 pass
    556             Obj.SetValue('%5.3f'%(self.Trans[iy,ix]))
    557            
    558         def OnVecValue(event):
    559             event.Skip()
    560             Obj = event.GetEventObject()
    561             iy = Ind[Obj.GetId()]
    562             val = Obj.GetValue()
    563             try:
    564                 if '/' in val:
    565                     vals = val.split('/')
    566                     self.Vec[iy] = float(vals[0])/float(vals[1])
    567                 else:   
    568                     self.Vec[iy] = float(Obj.GetValue())
    569             except ValueError:
    570                 pass
    571             Obj.SetValue('%5.3f'%(self.Vec[iy]))
    572                
    573544        def OnCommon(event):
    574545            Obj = event.GetEventObject()
     
    584555            else:
    585556                self.Trans = commonTrans[self.Common]
     557                if 'R' == self.Common[-1]:
     558                    self.newSpGrp += ' r'
     559                    SGErr,SGData = G2spc.SpcGroup(self.newSpGrp)
     560                    self.Phase['General']['SGData'] = SGData
     561                    SGTxt.SetValue(self.newSpGrp)
    586562            OnTest(event)
    587563       
     
    636612        self.panel.Destroy()
    637613        self.panel = wx.Panel(self)
    638         Ind = {}
     614#        Ind = {}
    639615        mainSizer = wx.BoxSizer(wx.VERTICAL)
    640616        MatSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    654630        for iy,line in enumerate(self.Trans):
    655631            for ix,val in enumerate(line):
    656                 item = wx.TextCtrl(self.panel,value='%5.3f'%(val),
    657                     size=(50,25),style=wx.TE_PROCESS_ENTER)
    658                 Ind[item.GetId()] = [ix,iy]
    659                 item.Bind(wx.EVT_TEXT_ENTER,OnMatValue)
    660                 item.Bind(wx.EVT_KILL_FOCUS,OnMatValue)
     632                item = G2G.ValidatedTxtCtrl(self.panel,self.Trans[iy],ix,nDig=(10,3),typeHint=float,size=(65,25))
    661633                Trmat.Add(item)
    662634            Trmat.Add((25,0),0)
    663             vec = wx.TextCtrl(self.panel,value='%5.3f'%(self.Vec[iy]),
    664                     size=(50,25),style=wx.TE_PROCESS_ENTER)
    665             Ind[vec.GetId()] = [iy]       
    666             vec.Bind(wx.EVT_TEXT_ENTER,OnVecValue)
    667             vec.Bind(wx.EVT_KILL_FOCUS,OnVecValue)
     635            vec = G2G.ValidatedTxtCtrl(self.panel,self.Vec,iy,nDig=(10,3),typeHint=float,size=(65,25))
    668636            Trmat.Add(vec)
    669637        transSizer.Add(Trmat)
     
    834802    def Draw(self):
    835803
    836         def OnMatValue(event):
    837             event.Skip()
    838             Obj = event.GetEventObject()
    839             ix,iy = Ind[Obj.GetId()]
    840             val = Obj.GetValue()
    841             if '/' in val:
    842                 vals = val.split('/')
    843                 self.Trans[iy,ix] = float(vals[0])/float(vals[1])
    844             else:   
    845                 self.Trans[iy,ix] = float(Obj.GetValue())
    846             Obj.SetValue('%5.3f'%(self.Trans[iy,ix]))
    847            
    848            
    849         def OnVecValue(event):
    850             event.Skip()
    851             Obj = event.GetEventObject()
    852             iy = Ind[Obj.GetId()]
    853             val = Obj.GetValue()
    854             if '/' in val:
    855                 vals = val.split('/')
    856                 self.Vec[iy] = float(vals[0])/float(vals[1])
    857             else:   
    858                 self.Vec[iy] = float(Obj.GetValue())
    859             Obj.SetValue('%5.3f'%(self.Vec[iy]))
    860            
     804#        def OnMatValue(event):
     805#            event.Skip()
     806#            Obj = event.GetEventObject()
     807#            ix,iy = Ind[Obj.GetId()]
     808#            val = Obj.GetValue()
     809#            if '/' in val:
     810#                vals = val.split('/')
     811#                self.Trans[iy,ix] = float(vals[0])/float(vals[1])
     812#            else:   
     813#                self.Trans[iy,ix] = float(Obj.GetValue())
     814#            Obj.SetValue('%5.3f'%(self.Trans[iy,ix]))
     815#           
     816#           
     817#        def OnVecValue(event):
     818#            event.Skip()
     819#            Obj = event.GetEventObject()
     820#            iy = Ind[Obj.GetId()]
     821#            val = Obj.GetValue()
     822#            if '/' in val:
     823#                vals = val.split('/')
     824#                self.Vec[iy] = float(vals[0])/float(vals[1])
     825#            else:   
     826#                self.Vec[iy] = float(Obj.GetValue())
     827#            Obj.SetValue('%5.3f'%(self.Vec[iy]))
     828#           
    861829        def OnExpand(event):
    862830            self.Expand = expand.GetValue()
     
    882850        self.panel.Destroy()
    883851        self.panel = wx.Panel(self)
    884         Ind = {}
     852#        Ind = {}
    885853        mainSizer = wx.BoxSizer(wx.VERTICAL)
    886854        MatSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    891859        for iy,line in enumerate(self.Trans):
    892860            for ix,val in enumerate(line):
    893                 item = wx.TextCtrl(self.panel,value='%5.3f'%(val),
    894                     size=(50,25),style=wx.TE_PROCESS_ENTER)
    895                 Ind[item.GetId()] = [ix,iy]
    896                 item.Bind(wx.EVT_TEXT_ENTER,OnMatValue)
    897                 item.Bind(wx.EVT_KILL_FOCUS,OnMatValue)
     861                item = G2G.ValidatedTxtCtrl(self.panel,self.Trans[iy],ix,nDig=(10,3),typeHint=float,size=(65,25))
     862#                item = wx.TextCtrl(self.panel,value='%5.3f'%(val),
     863#                    size=(50,25),style=wx.TE_PROCESS_ENTER)
     864#                Ind[item.GetId()] = [ix,iy]
     865#                item.Bind(wx.EVT_TEXT_ENTER,OnMatValue)
     866#                item.Bind(wx.EVT_KILL_FOCUS,OnMatValue)
    898867                Trmat.Add(item)
    899868            Trmat.Add((25,0),0)
    900             vec = wx.TextCtrl(self.panel,value='%5.3f'%(self.Vec[iy]),
    901                     size=(50,25),style=wx.TE_PROCESS_ENTER)
    902             Ind[vec.GetId()] = [iy]       
    903             vec.Bind(wx.EVT_TEXT_ENTER,OnVecValue)
    904             vec.Bind(wx.EVT_KILL_FOCUS,OnVecValue)
     869            vec = G2G.ValidatedTxtCtrl(self.panel,self.Vec,iy,nDig=(10,3),typeHint=float,size=(65,25))
     870#            vec = wx.TextCtrl(self.panel,value='%5.3f'%(self.Vec[iy]),
     871#                    size=(50,25),style=wx.TE_PROCESS_ENTER)
     872#            Ind[vec.GetId()] = [iy]       
     873#            vec.Bind(wx.EVT_TEXT_ENTER,OnVecValue)
     874#            vec.Bind(wx.EVT_KILL_FOCUS,OnVecValue)
    905875            Trmat.Add(vec)
    906876        transSizer.Add(Trmat)
     
    11331103    def Draw(self):
    11341104               
    1135         def OnMatValue(event):
    1136             event.Skip()
    1137             Obj = event.GetEventObject()
    1138             ix,iy = Ind[Obj.GetId()]
    1139             self.Trans[ix,iy] = float(Obj.GetValue())
    1140                
     1105#        def OnMatValue(event):
     1106#            event.Skip()
     1107#            Obj = event.GetEventObject()
     1108#            ix,iy = Ind[Obj.GetId()]
     1109#            self.Trans[ix,iy] = float(Obj.GetValue())
     1110#               
    11411111        def OnCent(event):
    11421112            Obj = event.GetEventObject()
     
    11641134        self.panel.Destroy()
    11651135        self.panel = wx.Panel(self)
    1166         Ind = {}
     1136#        Ind = {}
    11671137        mainSizer = wx.BoxSizer(wx.VERTICAL)
    11681138        MatSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    11821152        for iy,line in enumerate(self.Trans):
    11831153            for ix,val in enumerate(line):
    1184                 item = wx.TextCtrl(self.panel,value='%5.3f'%(val),
    1185                     size=(50,25),style=wx.TE_PROCESS_ENTER)
    1186                 Ind[item.GetId()] = [ix,iy]
    1187                 item.Bind(wx.EVT_TEXT_ENTER,OnMatValue)
    1188                 item.Bind(wx.EVT_KILL_FOCUS,OnMatValue)
     1154                item = G2G.ValidatedTxtCtrl(self.panel,self.Trans[iy],ix,nDig=(10,3),typeHint=float,size=(65,25))
     1155#                item = wx.TextCtrl(self.panel,value='%5.3f'%(val),
     1156#                    size=(50,25),style=wx.TE_PROCESS_ENTER)
     1157#                Ind[item.GetId()] = [ix,iy]
     1158#                item.Bind(wx.EVT_TEXT_ENTER,OnMatValue)
     1159#                item.Bind(wx.EVT_KILL_FOCUS,OnMatValue)
    11891160                Trmat.Add(item)
    11901161        transSizer.Add(Trmat)
     
    28832854            wx.CallAfter(UpdateControls,G2frame,data)
    28842855           
    2885         def OnConvergence(event):
    2886             event.Skip()
    2887             try:
    2888                 value = max(1.e-9,min(1.0,float(Cnvrg.GetValue())))
    2889             except ValueError:
    2890                 value = 0.0001
    2891             data['min dM/M'] = value
    2892             Cnvrg.SetValue('%.2g'%(value))
    2893            
     2856#        def OnConvergence(event):
     2857#            event.Skip()
     2858#            try:
     2859#                value = max(1.e-9,min(1.0,float(Cnvrg.GetValue())))
     2860#            except ValueError:
     2861#                value = 0.0001
     2862#            data['min dM/M'] = value
     2863#            Cnvrg.SetValue('%.2g'%(value))
     2864#           
    28942865        def OnMaxCycles(event):
    28952866            data['max cyc'] = int(maxCyc.GetValue())
     
    29152886#            data['HatomFix'] = Hfix.GetValue()
    29162887       
    2917         def OnUsrRej(event):
    2918             event.Skip()
    2919             Obj = event.GetEventObject()
    2920             item,limits = Indx[Obj]
    2921             try:
    2922                 value = min(max(float(Obj.GetValue()),limits[0]),limits[1])
    2923             except ValueError:
    2924                 value = data['UsrReject'][item]
    2925             data['UsrReject'][item] = value
    2926             Obj.SetValue('%.2f'%(value))
    2927 
     2888#        def OnUsrRej(event):
     2889#            event.Skip()
     2890#            Obj = event.GetEventObject()
     2891#            item,limits = Indx[Obj]
     2892#            try:
     2893#                value = min(max(float(Obj.GetValue()),limits[0]),limits[1])
     2894#            except ValueError:
     2895#                value = data['UsrReject'][item]
     2896#            data['UsrReject'][item] = value
     2897#            Obj.SetValue('%.2f'%(value))
     2898#
    29282899        LSSizer = wx.FlexGridSizer(cols=4,vgap=5,hgap=5)
    29292900        LSSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Refinement derivatives: '),0,WACV)
     
    29362907        LSSizer.Add(derivSel,0,WACV)
    29372908        LSSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Min delta-M/M: '),0,WACV)
    2938         Cnvrg = wx.TextCtrl(G2frame.dataDisplay,-1,value='%.2g'%(data['min dM/M']),style=wx.TE_PROCESS_ENTER)
    2939         Cnvrg.Bind(wx.EVT_TEXT_ENTER,OnConvergence)
    2940         Cnvrg.Bind(wx.EVT_KILL_FOCUS,OnConvergence)
     2909        Cnvrg = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'min dM/M',nDig=(10,2,'g'),min=1.e-9,max=1.,typeHint=float)
     2910#        Cnvrg = wx.TextCtrl(G2frame.dataDisplay,-1,value='%.2g'%(data['min dM/M']),style=wx.TE_PROCESS_ENTER)
     2911#        Cnvrg.Bind(wx.EVT_TEXT_ENTER,OnConvergence)
     2912#        Cnvrg.Bind(wx.EVT_KILL_FOCUS,OnConvergence)
    29412913        LSSizer.Add(Cnvrg,0,WACV)
    2942         Indx = {}
     2914#        Indx = {}
    29432915        if 'Hessian' in data['deriv type']:
    29442916            LSSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Max cycles: '),0,WACV)
     
    29572929        else:
    29582930            LSSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Initial shift factor: '),0,WACV)
    2959             Factr = wx.TextCtrl(G2frame.dataDisplay,-1,value='%.5f'%(data['shift factor']),style=wx.TE_PROCESS_ENTER)
    2960             Factr.Bind(wx.EVT_TEXT_ENTER,OnFactor)
    2961             Factr.Bind(wx.EVT_KILL_FOCUS,OnFactor)
     2931            Factr = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'shift factor',nDig=(10,5),min=1.e-5,max=100.,typeHint=float)
     2932#            Factr = wx.TextCtrl(G2frame.dataDisplay,-1,value='%.5f'%(data['shift factor']),style=wx.TE_PROCESS_ENTER)
     2933#            Factr.Bind(wx.EVT_TEXT_ENTER,OnFactor)
     2934#            Factr.Bind(wx.EVT_KILL_FOCUS,OnFactor)
    29622935            LSSizer.Add(Factr,0,WACV)
    29632936        if G2frame.Sngl:
     
    29742947            for item in usrRej:
    29752948                LSSizer.Add(wx.StaticText(G2frame.dataDisplay,-1,label=usrRej[item][0]),0,WACV)
    2976                 usrrej = wx.TextCtrl(G2frame.dataDisplay,-1,value='%.2f'%(userReject[item]),style=wx.TE_PROCESS_ENTER)
    2977                 Indx[usrrej] = [item,usrRej[item][1]]
    2978                 usrrej.Bind(wx.EVT_TEXT_ENTER,OnUsrRej)
    2979                 usrrej.Bind(wx.EVT_KILL_FOCUS,OnUsrRej)
     2949                usrrej = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,userReject,item,nDig=(10,2),
     2950                    min=usrRej[item][1][0],max=usrRej[item][1][1],typeHint=float)
     2951#                usrrej = wx.TextCtrl(G2frame.dataDisplay,-1,value='%.2f'%(userReject[item]),style=wx.TE_PROCESS_ENTER)
     2952#                Indx[usrrej] = [item,usrRej[item][1]]
     2953#                usrrej.Bind(wx.EVT_TEXT_ENTER,OnUsrRej)
     2954#                usrrej.Bind(wx.EVT_KILL_FOCUS,OnUsrRej)
    29802955                LSSizer.Add(usrrej,0,WACV)
    29812956#        Hfix = wx.CheckBox(G2frame.dataDisplay,-1,label='Regularize H atoms? ')
     
    44334408        G2plt.PlotDeltSig(G2frame,kind)
    44344409       
    4435     def OnWtFactor(event):
    4436         event.Skip()
    4437         try:
    4438             val = float(wtval.GetValue())
    4439         except ValueError:
    4440             val = data[0]['wtFactor']
    4441         data[0]['wtFactor'] = val
    4442         wtval.SetValue('%.3f'%(val))
    4443        
     4410#    def OnWtFactor(event):
     4411#        event.Skip()
     4412#        try:
     4413#            val = float(wtval.GetValue())
     4414#        except ValueError:
     4415#            val = data[0]['wtFactor']
     4416#        data[0]['wtFactor'] = val
     4417#        wtval.SetValue('%.3f'%(val))
     4418#       
    44444419#    def OnCompression(event):
    44454420#        data[0] = int(comp.GetValue())
     
    44944469    wtSizer = wx.BoxSizer(wx.HORIZONTAL)
    44954470    wtSizer.Add(wx.StaticText(G2frame.dataDisplay,-1,' Weight factor: '),0,WACV)
    4496     wtval = wx.TextCtrl(G2frame.dataDisplay,-1,'%.3f'%(data[0]['wtFactor']),style=wx.TE_PROCESS_ENTER)
    4497     wtval.Bind(wx.EVT_TEXT_ENTER,OnWtFactor)
    4498     wtval.Bind(wx.EVT_KILL_FOCUS,OnWtFactor)
     4471    wtval = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data[0],'wtFactor',nDig=(10,3),min=1.e-9,typeHint=float)
     4472#    wtval = wx.TextCtrl(G2frame.dataDisplay,-1,'%.3f'%(data[0]['wtFactor']),style=wx.TE_PROCESS_ENTER)
     4473#    wtval.Bind(wx.EVT_TEXT_ENTER,OnWtFactor)
     4474#    wtval.Bind(wx.EVT_KILL_FOCUS,OnWtFactor)
    44994475    wtSizer.Add(wtval,0,WACV)
    45004476#    if kind == 'PWDR':         #possible future compression feature; NB above patch as well
Note: See TracChangeset for help on using the changeset viewer.