Changeset 807
- Timestamp:
- Nov 27, 2012 4:43:28 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIgrid.py ¶
r796 r807 49 49 [ wxID_ATOMSEDITADD, wxID_ATOMSEDITINSERT, wxID_ATOMSEDITDELETE, wxID_ATOMSREFINE, 50 50 wxID_ATOMSMODIFY, wxID_ATOMSTRANSFORM, wxID_ATOMSVIEWADD, wxID_ATOMVIEWINSERT, 51 wxID_RELOADDRAWATOMS,wxID_ATOMSDISAGL, 52 ] = [wx.NewId() for item in range(1 0)]51 wxID_RELOADDRAWATOMS,wxID_ATOMSDISAGL,wxID_ATOMMOVE, 52 ] = [wx.NewId() for item in range(11)] 53 53 54 54 [ wxID_DRAWATOMSTYLE, wxID_DRAWATOMLABEL, wxID_DRAWATOMCOLOR, wxID_DRAWATOMRESETCOLOR, … … 710 710 self.AtomEdit.Append(id=wxID_ATOMVIEWINSERT, kind=wx.ITEM_NORMAL,text='Insert view point', 711 711 help='Select atom row to insert before; inserted as an H atom') 712 self.AtomEdit.Append(id=wxID_ATOMMOVE, kind=wx.ITEM_NORMAL,text='Move atom to view point', 713 help='Select single atom to move') 712 714 self.AtomEdit.Append(id=wxID_ATOMSEDITDELETE, kind=wx.ITEM_NORMAL,text='Delete atom', 713 715 help='Select atoms to delete first') … … 1896 1898 1897 1899 def AddBondRestraint(): 1898 print 'Bond restraint' 1900 General = phasedata['General'] 1901 cx,ct = General['AtomPtrs'][:2] 1902 Atoms = phasedata['Atoms'] 1903 radiiDict = dict(zip(General['AtomTypes'],General['BondRadii'])) 1904 Names = ['all '+ name for name in General['AtomTypes']] 1905 Types = [name for name in General['AtomTypes']] 1906 Names += [atom[ct-1] for atom in Atoms] 1907 Types += [atom[ct] for atom in Atoms] 1908 Lists = {'origin':[],'target':[]} 1909 for listName in ['origin','target']: 1910 dlg = wx.MultiChoiceDialog(G2frame,'Bond restraint'+listName+' for '+General['Name'], 1911 'Select bond restraint '+listName+' atoms',Names) 1912 if dlg.ShowModal() == wx.ID_OK: 1913 sel = dlg.GetSelections() 1914 for x in sel: 1915 Lists[listName].append([Names[x],Types[x]]) 1916 SGData = General['SGData'] 1917 Bonds = restrData['Bond']['Bonds'] 1899 1918 1900 1919 def AddAngleRestraint(): … … 1951 1970 Bonds.ClearSelection() 1952 1971 val = bondList[rows[0]][4] 1953 dlg = G2phG.SingleFloatDialog(G2frame,'New value','Enter new value for bond',val,[0.,5.] )1972 dlg = G2phG.SingleFloatDialog(G2frame,'New value','Enter new value for bond',val,[0.,5.],'%.4f') 1954 1973 if dlg.ShowModal() == wx.ID_OK: 1955 1974 parm = dlg.GetValue() … … 1965 1984 Bonds.ClearSelection() 1966 1985 val = bondList[rows[0]][5] 1967 dlg = G2phG.SingleFloatDialog(G2frame,'New value','Enter new esd for bond',val,[0.,1.] )1986 dlg = G2phG.SingleFloatDialog(G2frame,'New value','Enter new esd for bond',val,[0.,1.],'%.4f') 1968 1987 if dlg.ShowModal() == wx.ID_OK: 1969 1988 parm = dlg.GetValue() … … 2041 2060 Angles.ClearSelection() 2042 2061 val = angleList[rows[0]][4] 2043 dlg = G2phG.SingleFloatDialog(G2frame,'New value','Enter new value for angle',val,[0.,360.] )2062 dlg = G2phG.SingleFloatDialog(G2frame,'New value','Enter new value for angle',val,[0.,360.],'%.2f') 2044 2063 if dlg.ShowModal() == wx.ID_OK: 2045 2064 parm = dlg.GetValue() … … 2055 2074 Angles.ClearSelection() 2056 2075 val = angleList[rows[0]][5] 2057 dlg = G2phG.SingleFloatDialog(G2frame,'New value','Enter new esd for angle',val,[0.,5.] )2076 dlg = G2phG.SingleFloatDialog(G2frame,'New value','Enter new esd for angle',val,[0.,5.],'%.2f') 2058 2077 if dlg.ShowModal() == wx.ID_OK: 2059 2078 parm = dlg.GetValue() -
TabularUnified trunk/GSASIIphsGUI.py ¶
r804 r807 244 244 class SingleFloatDialog(wx.Dialog): 245 245 246 def __init__(self,parent,title,prompt,value,limits=[0.,1.] ):246 def __init__(self,parent,title,prompt,value,limits=[0.,1.],format='%.5g'): 247 247 wx.Dialog.__init__(self,parent,-1,title, 248 248 pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE) … … 251 251 self.value = value 252 252 self.prompt = prompt 253 self.format = format 253 254 self.Draw() 254 255 … … 263 264 val = self.value 264 265 self.value = val 265 valItem.SetValue( '%.5g'%(self.value))266 valItem.SetValue(self.format%(self.value)) 266 267 267 268 self.panel.Destroy() … … 269 270 mainSizer = wx.BoxSizer(wx.VERTICAL) 270 271 mainSizer.Add(wx.StaticText(self.panel,-1,self.prompt),0,wx.ALIGN_CENTER) 271 valItem = wx.TextCtrl(self.panel,-1,value= '%.5g'%(self.value),style=wx.TE_PROCESS_ENTER)272 valItem = wx.TextCtrl(self.panel,-1,value=self.format%(self.value),style=wx.TE_PROCESS_ENTER) 272 273 mainSizer.Add(valItem,0,wx.ALIGN_CENTER) 273 274 valItem.Bind(wx.EVT_TEXT_ENTER,OnValItem) … … 970 971 atomData = data['Atoms'] 971 972 DData = data['Drawing'] 972 Items = [G2gd.wxID_ATOMSEDITINSERT, G2gd.wxID_ATOMSEDITDELETE,G2gd.wxID_ATOMSREFINE,973 G2gd.wxID_ATOMSMODIFY, G2gd.wxID_ATOMSTRANSFORM, G2gd.wxID_ATOMVIEWINSERT]973 Items = [G2gd.wxID_ATOMSEDITINSERT,G2gd.wxID_ATOMSEDITDELETE,G2gd.wxID_ATOMSREFINE, 974 G2gd.wxID_ATOMSMODIFY,G2gd.wxID_ATOMSTRANSFORM,G2gd.wxID_ATOMVIEWINSERT,G2gd.wxID_ATOMMOVE] 974 975 if atomData: 975 976 for item in Items: … … 978 979 for item in Items: 979 980 G2frame.dataFrame.AtomsMenu.Enable(item,False) 980 Items = [G2gd.wxID_ATOMVIEWINSERT, G2gd.wxID_ATOMSVIEWADD ]981 Items = [G2gd.wxID_ATOMVIEWINSERT, G2gd.wxID_ATOMSVIEWADD,G2gd.wxID_ATOMMOVE] 981 982 if 'showABC' in data['Drawing']: 982 983 for item in Items: … … 1371 1372 FillAtomsGrid() 1372 1373 event.StopPropagation() 1374 1375 def OnAtomMove(event): 1376 drawData = data['Drawing'] 1377 atomData = data['Atoms'] 1378 x,y,z = drawData['viewPoint'][0] 1379 colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())] 1380 cx = colLabels.index('x') 1381 indx = Atoms.GetSelectedRows() 1382 if len(indx) != 1: 1383 print '**** ERROR - only one atom can be moved ****' 1384 else: 1385 atomData[indx[0]][cx:cx+3] = [x,y,z] 1386 SetupGeneral() 1387 FillAtomsGrid() 1388 ID = atomData[indx[0]][-1] 1389 DrawAtomsReplaceByID(data['Drawing'],atomData[indx[0]],ID) 1390 G2plt.PlotStructure(G2frame,data) 1391 event.StopPropagation() 1373 1392 1374 1393 def AtomInsert(x,y,z): … … 1430 1449 dlg.Destroy() 1431 1450 1432 def AtomModify(event): #intent to implement global modifications (+,-,*,/, etc.)?1451 def AtomModify(event): 1433 1452 indx = Atoms.GetSelectedRows() 1434 1453 if indx: … … 1723 1742 bondData = restData[PhaseName]['Bond'] 1724 1743 except KeyError: 1725 bondData = {'wtFactor':1.0,'Bonds':[] }1744 bondData = {'wtFactor':1.0,'Bonds':[],'Use':True} 1726 1745 restData[PhaseName] = {} 1727 1746 restData[PhaseName]['Bond'] = bondData … … 1732 1751 angleData = restData[PhaseName]['Angle'] 1733 1752 except KeyError: 1734 angleData = {'wtFactor':1.0,'Angles':[] }1753 angleData = {'wtFactor':1.0,'Angles':[],'Use':True} 1735 1754 restData[PhaseName] = {} 1736 1755 restData[PhaseName]['Angle'] = angleData … … 1741 1760 planeData = restData[PhaseName]['Plane'] 1742 1761 except KeyError: 1743 planeData = {'wtFactor':1.0,'Planes':[] }1762 planeData = {'wtFactor':1.0,'Planes':[],'Use':True} 1744 1763 restData[PhaseName] = {} 1745 1764 restData[PhaseName]['Plane'] = planeData … … 1750 1769 chiralData = restData[PhaseName]['Chiral'] 1751 1770 except KeyError: 1752 chiralData = {'wtFactor':1.0,'Volumes':[] }1771 chiralData = {'wtFactor':1.0,'Volumes':[],'Use':True} 1753 1772 restData[PhaseName] = {} 1754 1773 restData[PhaseName]['Chiral'] = chiralData … … 4173 4192 for ind in Ind: 4174 4193 mag,x,y,z,d = mapPeaks[ind] 4175 AtomAdd(x,y,z,' C',Name='M '+'%d'%(int(100*mag/peakMax)))4194 AtomAdd(x,y,z,'H',Name='M '+'%d'%(int(100*mag/peakMax))) 4176 4195 4177 4196 def OnPeaksClear(event): … … 4445 4464 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAtomInsert, id=G2gd.wxID_ATOMSEDITINSERT) 4446 4465 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAtomViewInsert, id=G2gd.wxID_ATOMVIEWINSERT) 4466 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAtomMove, id=G2gd.wxID_ATOMMOVE) 4447 4467 G2frame.dataFrame.Bind(wx.EVT_MENU, AtomDelete, id=G2gd.wxID_ATOMSEDITDELETE) 4448 4468 G2frame.dataFrame.Bind(wx.EVT_MENU, AtomRefine, id=G2gd.wxID_ATOMSREFINE) -
TabularUnified trunk/GSASIIplot.py ¶
r803 r807 2693 2693 G2frame.dataDisplay.GetPage(page).SelectRow(ind,Add) 2694 2694 elif G2frame.dataDisplay.GetPageText(page) == 'Atoms': 2695 Id = drawAtoms[ind][- 2]2695 Id = drawAtoms[ind][-3] 2696 2696 for i,atom in enumerate(atomData): 2697 2697 if atom[-1] == Id:
Note: See TracChangeset
for help on using the changeset viewer.