Changeset 1214
- Timestamp:
- Feb 3, 2014 4:31:54 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r1209 r1214 457 457 if var in varbs: continue 458 458 varbs.append(var) 459 else: # constraints with atoms 460 if l[3] == "all": 459 else: # constraints with atoms or rigid bodies 460 if len(l) == 5: # rigid body parameter 461 var = ':'.join(l) 462 if var in varbs: continue 463 varbs.append(var) 464 elif l[3] == "all": 461 465 for ph in phlist: 462 466 key = G2obj.LookupPhaseName(l[0])[0] -
trunk/GSASIIgrid.py
r1211 r1214 2382 2382 2383 2383 # Restraints 2384 self.RestraintTab = wx.Menu(title='') 2384 2385 self.RestraintEdit = wx.Menu(title='') 2385 2386 self.RestraintEdit.Append(id=wxID_RESTSELPHASE, kind=wx.ITEM_NORMAL,text='Select phase', … … 2403 2404 self.RestraintMenu = wx.MenuBar() 2404 2405 self.PrefillDataMenu(self.RestraintMenu,helpType='Restraints') 2406 self.RestraintMenu.Append(menu=self.RestraintTab, title='Select tab') 2405 2407 self.RestraintMenu.Append(menu=self.RestraintEdit, title='Edit') 2406 2408 self.PostfillDataMenu() -
trunk/GSASIIobj.py
r1209 r1214 1339 1339 before creating or later using the G2VarObj object. 1340 1340 1341 TODO: This does not handle rigid body variables at present 1341 This can store rigid body variables, but does not translate the residue # and 1342 body # to/from random Ids 1342 1343 1343 1344 A :class:`G2VarObj` object can be created with a single parameter: … … 1349 1350 * h is the histogram number (which may be left blank or may be '*' to indicate all histograms); 1350 1351 * a is the atom number (which may be left blank in which case the third colon is omitted). 1351 The atom number can be specified as '*' if a phase number is specified (not as '*') 1352 The atom number can be specified as '*' if a phase number is specified (not as '*'). 1353 For rigid body variables, specify a will be a string of form "residue:body#" 1352 1354 1353 1355 Alternately a single tuple of form (Phase,Histogram,VarName,AtomID) can be used, where 1354 1356 Phase, Histogram, and AtomID are None or are ranId values (or one can be '*') 1355 1357 and VarName is a string. Note that if Phase is '*' then the AtomID is an atom number. 1358 For a rigid body variables, AtomID is a string of form "residue:body#". 1356 1359 1357 1360 If four positional arguments are supplied, they are: … … 1382 1385 else: 1383 1386 self.phase = PhaseIdLookup.get(lst[0],[None,None])[1] 1384 if len(lst) > 3:1387 if len(lst) == 4: 1385 1388 if lst[3] == '*': 1386 1389 self.atom = '*' 1387 1390 else: 1388 1391 self.atom = AtomIdLookup[lst[0]].get(lst[3],[None,None])[1] 1392 elif len(lst) == 5: 1393 self.atom = lst[3]+":"+lst[4] 1394 else: 1395 raise Exception,"Too many colons in var name "+str(args[0]) 1389 1396 1390 1397 if lst[1] == '*': … … 1432 1439 a = ':*' 1433 1440 elif self.atom: 1434 if ph in AtomRanIdLookup: 1441 if ":" in str(self.atom): 1442 a = ":" + str(self.atom) 1443 elif ph in AtomRanIdLookup: 1435 1444 a = ":" + AtomRanIdLookup[ph].get(self.atom,'?') 1436 1445 else: … … 1450 1459 s += "Phases: all; " 1451 1460 if self.atom is not None: 1452 s += "Atom #" + str(self.atom) + "; " 1461 if ":" in str(self.atom): 1462 s += "Rigid body" + str(self.atom) + "; " 1463 else: 1464 s += "Atom #" + str(self.atom) + "; " 1453 1465 elif self.phase is not None: 1454 1466 ph = _lookup(PhaseRanIdLookup,self.phase) … … 1456 1468 if self.atom == '*': 1457 1469 s += "Atoms: all; " 1470 elif ":" in self(self.atom): 1471 s += "Rigid body" + str(self.atom) + "; " 1458 1472 elif self.atom is not None: 1459 1473 s += "Atom rId=" + str(self.atom) -
trunk/GSASIIrestrGUI.py
r1103 r1214 47 47 return 48 48 phasedata = Phases[phaseName] 49 tabIndex = {} 49 50 if phaseName not in data: 50 51 data[phaseName] = {} … … 1777 1778 1778 1779 def OnPageChanged(event): 1780 #print 'OnPageChanged' 1779 1781 page = event.GetSelection() 1780 1782 text = G2frame.dataDisplay.GetPageText(page) … … 1839 1841 def SetStatusLine(text): 1840 1842 Status.SetStatusText(text) 1841 1843 1844 def RaisePage(event): 1845 'Respond to a "select tab" menu button' 1846 # class PseudoEvent(object): 1847 # def __init__(self,page): self.page = page 1848 # def Skip(self): pass 1849 # def GetSelection(self): return self.page 1850 try: 1851 i = tabIndex.get(event.GetId()) 1852 G2frame.dataDisplay.SetSelection(i) 1853 #OnPageChanged(PseudoEvent(i)) 1854 except ValueError: 1855 print('Unexpected event in RaisePage') 1856 1842 1857 if G2frame.dataDisplay: 1843 1858 G2frame.dataDisplay.Destroy() … … 1860 1875 G2frame.dataDisplay = G2gd.GSNoteBook(parent=G2frame.dataFrame,size=G2frame.dataFrame.GetClientSize()) 1861 1876 1877 # clear menu and menu pointers 1878 tabIndex.clear() 1879 tabcount = -1 1880 for i in G2frame.dataFrame.RestraintTab.GetMenuItems(): 1881 G2frame.dataFrame.RestraintTab.DestroyItem(i) 1882 1883 txt = 'Bond restraints' 1862 1884 BondRestr = wx.ScrolledWindow(G2frame.dataDisplay) 1863 G2frame.dataDisplay.AddPage(BondRestr,'Bond restraints') 1885 G2frame.dataDisplay.AddPage(BondRestr,txt) 1886 item = G2frame.dataFrame.RestraintTab.Append( 1887 id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text=txt, 1888 help='Select restraint editing tab') 1889 G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=item.GetId()) 1890 tabcount += 1 1891 tabIndex[item.GetId()] = tabcount 1892 1893 txt = 'Angle restraints' 1864 1894 AngleRestr = wx.ScrolledWindow(G2frame.dataDisplay) 1865 G2frame.dataDisplay.AddPage(AngleRestr,'Angle restraints') 1895 G2frame.dataDisplay.AddPage(AngleRestr,txt) 1896 item = G2frame.dataFrame.RestraintTab.Append( 1897 id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text=txt, 1898 help='Select restraint editing tab') 1899 G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=item.GetId()) 1900 tabcount += 1 1901 tabIndex[item.GetId()] = tabcount 1902 1903 txt = 'Plane restraints' 1866 1904 PlaneRestr = wx.ScrolledWindow(G2frame.dataDisplay) 1867 G2frame.dataDisplay.AddPage(PlaneRestr,'Plane restraints') 1905 G2frame.dataDisplay.AddPage(PlaneRestr,txt) 1906 item = G2frame.dataFrame.RestraintTab.Append( 1907 id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text=txt, 1908 help='Select restraint editing tab') 1909 G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=item.GetId()) 1910 tabcount += 1 1911 tabIndex[item.GetId()] = tabcount 1912 1913 txt = 'Chiral restraints' 1868 1914 ChiralRestr = wx.ScrolledWindow(G2frame.dataDisplay) 1869 G2frame.dataDisplay.AddPage(ChiralRestr,'Chiral restraints') 1915 G2frame.dataDisplay.AddPage(ChiralRestr,txt) 1916 item = G2frame.dataFrame.RestraintTab.Append( 1917 id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text=txt, 1918 help='Select restraint editing tab') 1919 G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=item.GetId()) 1920 tabcount += 1 1921 tabIndex[item.GetId()] = tabcount 1922 1870 1923 if 'macro' in General['Type']: 1924 txt = 'Torsion restraints' 1871 1925 TorsionRestr = wx.ScrolledWindow(G2frame.dataDisplay) 1872 G2frame.dataDisplay.AddPage(TorsionRestr,'Torsion restraints') 1926 G2frame.dataDisplay.AddPage(TorsionRestr,txt) 1927 item = G2frame.dataFrame.RestraintTab.Append( 1928 id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text=txt, 1929 help='Select restraint editing tab') 1930 G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=item.GetId()) 1931 tabcount += 1 1932 tabIndex[item.GetId()] = tabcount 1933 1934 txt = 'Ramachandran restraints' 1873 1935 RamaRestr = wx.ScrolledWindow(G2frame.dataDisplay) 1874 G2frame.dataDisplay.AddPage(RamaRestr,'Ramachandran restraints') 1936 G2frame.dataDisplay.AddPage(RamaRestr,txt) 1937 item = G2frame.dataFrame.RestraintTab.Append( 1938 id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text=txt, 1939 help='Select restraint editing tab') 1940 G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=item.GetId()) 1941 tabcount += 1 1942 tabIndex[item.GetId()] = tabcount 1943 1944 txt = 'Chem. comp. restraints' 1875 1945 ChemCompRestr = wx.ScrolledWindow(G2frame.dataDisplay) 1876 G2frame.dataDisplay.AddPage(ChemCompRestr,'Chem. comp. restraints') 1946 G2frame.dataDisplay.AddPage(ChemCompRestr,txt) 1947 item = G2frame.dataFrame.RestraintTab.Append( 1948 id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text=txt, 1949 help='Select restraint editing tab') 1950 G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=item.GetId()) 1951 tabcount += 1 1952 tabIndex[item.GetId()] = tabcount 1953 1877 1954 if General['SH Texture']['Order']: 1955 txt = 'Texture restraints' 1878 1956 TextureRestr = wx.ScrolledWindow(G2frame.dataDisplay) 1879 G2frame.dataDisplay.AddPage(TextureRestr,'Texture restraints') 1957 G2frame.dataDisplay.AddPage(TextureRestr,txt) 1958 item = G2frame.dataFrame.RestraintTab.Append( 1959 id=wx.ID_ANY, kind=wx.ITEM_NORMAL,text=txt, 1960 help='Select restraint editing tab') 1961 G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=item.GetId()) 1962 tabcount += 1 1963 tabIndex[item.GetId()] = tabcount 1880 1964 1881 1965 UpdateBondRestr(restrData['Bond'])
Note: See TracChangeset
for help on using the changeset viewer.