def OnHstrainVal(event): Snames = G2spc.HStrainNames(SGData) Obj = event.GetEventObject() hist,pid = Indx[Obj.GetId()] try: strain = float(Obj.GetValue()) UseList[G2frame.hist]['HStrain'][0][pid] = strain except ValueError: pass Obj.SetValue("%.3g"%(UseList[G2frame.hist]['HStrain'][0][pid])) #reset in case of error
def HstrainSizer(): hstrainSizer = wx.FlexGridSizer(0,6,5,5) Hsnames = G2spc.HStrainNames(SGData) parms = zip(Hsnames,UseList[G2frame.hist]['HStrain'][0],UseList[G2frame.hist]['HStrain'][1],range(len(Hsnames))) for Pa,val,ref,id in parms: hstrainRef = wx.CheckBox(DData,wx.ID_ANY,label=Pa) hstrainRef.thisown = False hstrainRef.SetValue(ref) Indx[hstrainRef.GetId()] = [G2frame.hist,id] hstrainRef.Bind(wx.EVT_CHECKBOX, OnHstrainRef) hstrainSizer.Add(hstrainRef,0,WACV|wx.LEFT,5) hstrainVal = wx.TextCtrl(DData,wx.ID_ANY,'%.3g'%(val),style=wx.TE_PROCESS_ENTER) Indx[hstrainVal.GetId()] = [G2frame.hist,id] hstrainVal.Bind(wx.EVT_TEXT_ENTER,OnHstrainVal) hstrainVal.Bind(wx.EVT_KILL_FOCUS,OnHstrainVal) hstrainSizer.Add(hstrainVal,0,WACV) return hstrainSizer
def _setup_additional_phase_data(self, powder_histo_name, phase_data): """ Setup more phase data parameters in 'Phases' / 'General' and 'Phases' / 'Histograms'. @param phase_data :: from GSAS-II, the first entry in 'Phases' """ import GSASIIspc SGData = phase_data['General']['SGData'] use_list = phase_data['Histograms'] NShkl = len(GSASIIspc.MustrainNames(SGData)) NDij = len(GSASIIspc.HStrainNames(SGData)) # like 'PWDR ENGINX_ceria_1000_spectrum-0.txt' histo_name = 'PWDR ' + powder_histo_name # 'Reflection Lists' is not defined at this point: # item_id = GSASIIgrid.GetPatternTreeItemId(gs2, gs2.root, histo_name) # refList = gs2.PatternTree.GetItemPyData( # GSASIIgrid.GetPatternTreeItemId(gs2, item_id, 'Reflection Lists')) # refList[general_phase_data['Name']] = {} use_list[histo_name] = GSASII.SetDefaultDData('PWDR', histo_name, NShkl=NShkl, NDij=NDij)