Changeset 2581 for trunk/GSASIIpwdGUI.py


Ignore:
Timestamp:
Dec 14, 2016 3:40:34 PM (5 years ago)
Author:
vondreele
Message:

Add Test button to Powder Sum popup - see plot of result by pressing Test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwdGUI.py

    r2579 r2581  
    22622262           
    22632263    def OnMaterial(event):
    2264         event.Skip()
    22652264        Obj = event.GetEventObject()
    2266         id,key = Info[Obj.GetId()]
    2267         if key == 'Name':
    2268             data['Materials'][id][key] = Obj.GetValue()
    2269         elif key == 'VolFrac':
    2270             try:
    2271                 value = min(max(0.,float(Obj.GetValue())),1.)
    2272             except ValueError:
    2273                 value = data['Materials'][id][key]
    2274             data['Materials'][id][key] = value
    2275             data['Materials'][not id][key] = 1.-value
     2265        id = Info[Obj.GetId()]
     2266        data['Materials'][id]['Name'] = Obj.GetValue()
     2267        wx.CallAfter(UpdateSampleGrid,G2frame,data)
     2268       
     2269    def OnVolFrac(invalid,value,tc):
     2270        id = Info[tc.GetId()]
     2271        data['Materials'][not id][key] = 1.-value
    22762272        wx.CallAfter(UpdateSampleGrid,G2frame,data)
    22772273
     
    24292425            matsel = wx.ComboBox(G2frame.dataDisplay,value=item['Name'],choices=Substances['Substances'].keys(),
    24302426                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    2431             Info[matsel.GetId()] = [id,'Name']
     2427            Info[matsel.GetId()] = id
    24322428            matsel.Bind(wx.EVT_COMBOBOX,OnMaterial)       
    24332429            subSizer.Add(matsel,0,WACV)
    24342430            subSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Volume fraction: '),0,WACV)
    2435 #        azmthOff = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'azmthOff',nDig=(10,2),typeHint=float,OnLeave=OnAzmthOff)
    2436             volfrac = wx.TextCtrl(G2frame.dataDisplay,value=str('%.3f'%(item['VolFrac'])),style=wx.TE_PROCESS_ENTER)
    2437             Info[volfrac.GetId()] = [id,'VolFrac']
    2438             volfrac.Bind(wx.EVT_TEXT_ENTER,OnMaterial)
    2439             volfrac.Bind(wx.EVT_KILL_FOCUS,OnMaterial)
     2431            volfrac = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,item,'VolFrac',
     2432                min=0.,max=1.,nDig=(10,3),typeHint=float,OnLeave=OnVolFrac)
    24402433            subSizer.Add(volfrac,0,WACV)
    24412434            material = Substances['Substances'][item['Name']]
     
    26812674        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    26822675       
    2683     def OnModVal(event):
    2684         event.Skip()
    2685         Obj = event.GetEventObject()
    2686         ObjId = Obj.GetId()
    2687         Id = Indx[ObjId]
    2688         try:
    2689             value = min(0.98,max(-0.98,float(Obj.GetValue())))
    2690         except ValueError:
    2691             value = ssopt['ModVec'][Id]
    2692         Obj.SetValue('%.4f'%(value))
    2693         ssopt['ModVec'][Id] = value
    2694         OnHklShow(event)
     2676    def OnModVal(invalid,value,tc):
     2677        OnHklShow(tc.event)
    26952678       
    26962679    def OnMoveMod(event):
     
    32433226            if show:
    32443227                valSizer = wx.BoxSizer(wx.HORIZONTAL)
    3245 #        azmthOff = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'azmthOff',nDig=(10,2),typeHint=float,OnLeave=OnAzmthOff)
    3246                 modVal = wx.TextCtrl(G2frame.dataDisplay,value=('%.4f'%(val)),
    3247                     size=wx.Size(50,20),style=wx.TE_PROCESS_ENTER)
    3248                 modVal.Bind(wx.EVT_TEXT_ENTER,OnModVal)       
    3249                 modVal.Bind(wx.EVT_KILL_FOCUS,OnModVal)
     3228                modVal = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,ssopt['ModVec'],i,
     3229                    min=-.98,max=.98,nDig=(10,4),typeHint=float,OnLeave=OnModVal)
    32503230                valSizer.Add(modVal,0,WACV)
    32513231                modSpin = wx.SpinButton(G2frame.dataDisplay,style=wx.SP_VERTICAL,size=wx.Size(20,20))
Note: See TracChangeset for help on using the changeset viewer.