Changeset 3325 for trunk/GSASIIconstrGUI.py
- Timestamp:
- Mar 29, 2018 9:53:57 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r3317 r3325 1313 1313 'RBIds':{'Vector':[],'Residue':[]}}) #empty/bad dict - fill it 1314 1314 1315 global resList 1315 global resList,rbId 1316 1316 Indx = {} 1317 1317 resList = [] … … 1527 1527 print ('Rigid body UNKRB added') 1528 1528 text.close() 1529 UpdateResidueRB( )1529 UpdateResidueRB(rbId) 1530 1530 1531 1531 def FindNeighbors(Orig,XYZ,atTypes,atNames,AtInfo): … … 1567 1567 1568 1568 def OnDefineTorsSeq(event): 1569 rbKeys = list(data['Residue'].keys()) 1570 rbKeys.remove('AtInfo') 1571 rbNames = [data['Residue'][k]['RBname'] for k in rbKeys] 1572 rbIds = dict(zip(rbNames,rbKeys)) 1573 rbNames.sort() 1574 rbId = 0 1575 if len(rbNames) == 0: 1576 print ('There are no rigid bodies defined') 1577 G2frame.ErrorDialog('No rigid bodies','There are no rigid bodies defined', 1578 parent=G2frame) 1579 return 1580 elif len(rbNames) > 1: 1581 dlg = wx.SingleChoiceDialog(G2frame,'Select rigid body for torsion sequence','Torsion sequence',rbNames) 1582 if dlg.ShowModal() == wx.ID_OK: 1583 sel = dlg.GetSelection() 1584 rbId = rbIds[rbNames[sel]] 1585 rbData = data['Residue'][rbId] 1586 else: 1587 rbData = [] 1588 dlg.Destroy() 1589 else: 1590 rbId = rbIds[rbNames[0]] 1591 rbData = data['Residue'][rbId] 1569 global rbId 1570 rbData = data['Residue'][rbId] 1592 1571 if not len(rbData): 1593 1572 return … … 1614 1593 rbData['rbSeq'].append([Orig,Piv,0.0,Riding]) 1615 1594 dlg.Destroy() 1616 UpdateResidueRB( )1595 UpdateResidueRB(rbId) 1617 1596 1618 1597 def UpdateVectorRB(Scroll=0): … … 1829 1808 VectorRB.Scroll(0,Scroll) 1830 1809 1831 def UpdateResidueRB( ):1810 def UpdateResidueRB(rbId=0): 1832 1811 AtInfo = data['Residue']['AtInfo'] 1833 1812 refChoice = {} … … 1839 1818 Obj = event.GetEventObject() 1840 1819 rbData['RBname'] = Obj.GetValue() 1820 wx.CallAfter(UpdateResidueRB,rbId) 1841 1821 1842 1822 def OnDelRB(event): … … 1864 1844 rbData['rbXYZ'] = newXYZ 1865 1845 G2plt.PlotRigidBody(G2frame,'Residue',AtInfo,rbData,plotDefaults) 1866 wx.CallAfter(UpdateResidueRB )1846 wx.CallAfter(UpdateResidueRB,rbId) 1867 1847 1868 1848 def OnPlotRB(event): … … 1988 1968 for col in range(5): 1989 1969 vecGrid.SetCellStyle(row,col,VERY_LIGHT_GREY,True) 1990 # vecGrid.SetScrollRate(0,0)1991 1970 vecGrid.AutoSizeColumns(False) 1992 1971 vecSizer = wx.BoxSizer() … … 2045 2024 rbId,Seq = Indx[Obj.GetId()] 2046 2025 data['Residue'][rbId]['rbSeq'].remove(Seq) 2047 wx.CallAfter(UpdateResidueRB )2026 wx.CallAfter(UpdateResidueRB,rbId) 2048 2027 2049 2028 seqSizer = wx.FlexGridSizer(0,5,2,2) … … 2115 2094 for i in range(3): 2116 2095 refChoice[rbId][i].append(rbRef[i]) 2117 refChoice[rbId][i].sort() 2118 2119 ResidueRBDisplay.DestroyChildren() 2096 refChoice[rbId][i].sort() 2097 2098 def OnSelect(event): 2099 global rbId 2100 rbname = rbchoice[select.GetSelection()] 2101 rbId = RBnames[rbname] 2102 wx.CallAfter(UpdateResidueRB,rbId) 2103 2104 2105 if ResidueRBDisplay.GetSizer(): ResidueRBDisplay.GetSizer().Clear(True) 2120 2106 ResidueRBSizer = wx.BoxSizer(wx.VERTICAL) 2121 for rbId in data['RBIds']['Residue']: 2107 ResidueRBSizer.Add(wx.StaticText(ResidueRBDisplay,label=' Select residue to view:'),0) 2108 RBnames = {} 2109 for rbid in data['RBIds']['Residue']: 2110 RBnames.update({data['Residue'][rbid]['RBname']:rbid,}) 2111 rbchoice = RBnames.keys() 2112 rbchoice.sort() 2113 select = wx.ListBox(ResidueRBDisplay,choices=rbchoice,style=wx.LB_SINGLE,size=(-1,120)) 2114 select.Bind(wx.EVT_LISTBOX,OnSelect) 2115 ResidueRBSizer.Add(select,0) 2116 if rbId: 2122 2117 rbData = data['Residue'][rbId] 2123 if len(rbData['rbXYZ']) < 3: #patch - skip around bad RBs with too few atoms2124 continue2125 2118 FillRefChoice(rbId,rbData) 2126 2119 ResidueRBSizer.Add(rbNameSizer(rbId,rbData),0) … … 2137 2130 if rbData['rbSeq']: 2138 2131 ResidueRBSizer.Add(slideSizer,) 2139 ResidueRBSizer.Add(wx.StaticText(ResidueRBDisplay,-1,70*'-'))2140 2132 2141 2133 ResidueRBSizer.Add((5,25),)
Note: See TracChangeset
for help on using the changeset viewer.