Changeset 3136 for trunk/GSASIIconstrGUI.py
- Timestamp:
- Oct 23, 2017 11:39:16 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r3079 r3136 15 15 16 16 ''' 17 from __future__ import division, print_function 17 18 import sys 18 19 import wx … … 158 159 j += 1 159 160 if j: 160 print str(key) + ': '+str(j)+' variable(s) as strings converted to objects'161 print (str(key) + ': '+str(j)+' variable(s) as strings converted to objects') 161 162 ################################################################################## 162 163 rigidbodyDict = G2frame.GPXtree.GetItemPyData( … … 165 166 rbVary,rbDict = G2stIO.GetRigidBodyModels(rigidbodyDict,Print=False) 166 167 badPhaseParms = ['Ax','Ay','Az','Amul','AI/A','Atype','SHorder','mV0','mV1','mV2','waveType','Vol','isMag',] 167 globalList = rbDict.keys()168 globalList = list(rbDict.keys()) 168 169 globalList.sort() 169 170 try: … … 385 386 pass 386 387 else: 387 raise Exception , 'Unknown constraint page '+ page[1]388 raise Exception('Unknown constraint page '+ page[1]) 388 389 if len(choices): 389 390 l1 = l2 = 1 … … 487 488 return [constr+[1.0,None,'c']] 488 489 else: 489 raise Exception ,'Unknown constraint type: '+str(constType)490 raise Exception('Unknown constraint type: '+str(constType)) 490 491 else: 491 492 dlg = wx.MessageDialog( … … 537 538 errmsg,warnmsg = CheckConstraints(allcons1) 538 539 if errmsg: 539 print errmsg540 print G2mv.VarRemapShow([],True)540 print (errmsg) 541 print (G2mv.VarRemapShow([],True)) 541 542 return False 542 543 elif warnmsg: 543 print 'Unexpected contraint warning:\n',warnmsg544 print ('Unexpected contraint warning:\n'+warnmsg) 544 545 return True 545 546 … … 566 567 errmsg,warnmsg = CheckConstraints(allcons1) 567 568 if errmsg: 568 print errmsg569 print G2mv.VarRemapShow([],True)569 print (errmsg) 570 print (G2mv.VarRemapShow([],True)) 570 571 return False 571 572 elif warnmsg: 572 print 'Unexpected contraint warning:\n',warnmsg573 print ('Unexpected contraint warning:\n'+warnmsg) 573 574 return True 574 575 … … 594 595 return None,None,None 595 596 else: 596 raise Exception ,'Should not happen!'597 raise Exception('Should not happen!') 597 598 return vartype,varList,constrDictEnt 598 599 … … 771 772 if atName in Atoms: 772 773 Atoms[atName].append(item) 773 AtNames = Atoms.keys()774 AtNames = list(Atoms.keys()) 774 775 AtNames.sort() 775 776 dlg = G2G.G2SingleChoiceDialog(G2frame,'Select 1st atom:', … … 788 789 dlg.Destroy() 789 790 if FrstAtom == '': 790 print 'no atom selected'791 print ('no atom selected') 791 792 return 792 793 dlg = G2G.G2MultiChoiceDialog( … … 797 798 Selections = dlg.GetSelections()[:] 798 799 else: 799 print 'no target atom selected'800 print ('no target atom selected') 800 801 dlg.Destroy() 801 802 return … … 949 950 typeString = 'EQUIV' 950 951 else: 951 print 'Unexpected constraint',item952 print ('Unexpected constraint'+item) 952 953 953 954 else: 954 print 'Removing old-style constraints'955 print ('Removing old-style constraints') 955 956 data[name] = [] 956 957 return constSizer … … 1046 1047 except: 1047 1048 import traceback 1048 print traceback.format_exc()1049 print (traceback.format_exc()) 1049 1050 finally: 1050 1051 dlg.Destroy() … … 1092 1093 if 'DELETED' in str(PhaseConstr): #seems to be no other way to do this (wx bug) 1093 1094 if GSASIIpath.GetConfigValue('debug'): 1094 print 'wx error: PhaseConstr not cleanly deleted after Refine'1095 print ('wx error: PhaseConstr not cleanly deleted after Refine') 1095 1096 return 1096 1097 UpdateConstraintPanel(PhaseConstr,'Phase') … … 1167 1168 'Error in constraints:\n'+errmsg+'\nCheck console output for more information', 1168 1169 parent=G2frame) 1169 print errmsg1170 print G2mv.VarRemapShow([],True)1170 print (errmsg) 1171 print (G2mv.VarRemapShow([],True)) 1171 1172 elif warnmsg: 1172 print 'Unexpected contraint warning:\n',warnmsg1173 print ('Unexpected contraint warning:\n'+warnmsg) 1173 1174 1174 1175 ################################################################################ … … 1352 1353 dlg = wx.FileDialog(G2frame,message='Choose '+macName+' rigid body macro file', 1353 1354 defaultDir=defDir,defaultFile="",wildcard="GSAS-II macro file (*.mac)|*.mac", 1354 style=wx. OPEN | wx.CHANGE_DIR)1355 style=wx.FD_OPEN | wx.CHANGE_DIR) 1355 1356 try: 1356 1357 if dlg.ShowModal() == wx.ID_OK: … … 1359 1360 head = macro.readline() 1360 1361 if macName not in head: 1361 print head1362 print '**** ERROR - wrong restraint macro file selected, try again ****'1362 print (head) 1363 print ('**** ERROR - wrong restraint macro file selected, try again ****') 1363 1364 macro = [] 1364 1365 else: # cancel was pressed … … 1372 1373 "GSAS-II text file (*.txt)|*.txt|XYZ file (*.xyz)|*.xyz|" 1373 1374 "Sybyl mol2 file (*.mol2)|*.mol2|PDB file (*.pdb;*.ent)|*.pdb;*.ent", 1374 wx. OPEN | wx.CHANGE_DIR)1375 wx.FD_OPEN | wx.CHANGE_DIR) 1375 1376 try: 1376 1377 if dlg.ShowModal() == wx.ID_OK: … … 1399 1400 if dlg.ShowModal() == wx.ID_OK: 1400 1401 nAtoms,nTrans = dlg.GetValues() 1401 rbId = ran.randint(0,sys.max int)1402 rbId = ran.randint(0,sys.maxsize) 1402 1403 vecMag = [1.0 for i in range(nTrans)] 1403 1404 vecRef = [False for i in range(nTrans)] … … 1421 1422 items = macStr.split() 1422 1423 if 'I' == items[0]: 1423 rbId = ran.randint(0,sys.max int)1424 rbId = ran.randint(0,sys.maxsize) 1424 1425 rbName = items[1] 1425 1426 rbTypes = [] … … 1454 1455 'SelSeq':[0,0],'useCount':0} 1455 1456 data['RBIds']['Residue'].append(rbId) 1456 print 'Rigid body '+rbName+' added'1457 print ('Rigid body '+rbName+' added') 1457 1458 macStr = macro.readline() 1458 1459 macro.close() … … 1464 1465 if not text: 1465 1466 return 1466 rbId = ran.randint(0,sys.max int)1467 rbId = ran.randint(0,sys.maxsize) 1467 1468 rbTypes = [] 1468 1469 rbXYZ = [] … … 1523 1524 'atNames':atNames,'rbRef':[0,1,2,False],'rbSeq':[],'SelSeq':[0,0],'useCount':0} 1524 1525 data['RBIds']['Residue'].append(rbId) 1525 print 'Rigid body UNKRB added'1526 print ('Rigid body UNKRB added') 1526 1527 text.close() 1527 1528 UpdateResidueRB() … … 1565 1566 1566 1567 def OnDefineTorsSeq(event): 1567 rbKeys = data['Residue'].keys()1568 rbKeys = list(data['Residue'].keys()) 1568 1569 rbKeys.remove('AtInfo') 1569 1570 rbNames = [data['Residue'][k]['RBname'] for k in rbKeys] … … 1572 1573 rbId = 0 1573 1574 if len(rbNames) == 0: 1574 print 'There are no rigid bodies defined'1575 print ('There are no rigid bodies defined') 1575 1576 G2frame.ErrorDialog('No rigid bodies','There are no rigid bodies defined', 1576 1577 parent=G2frame) … … 1617 1618 if 'DELETED' in str(G2frame.GetStatusBar()): #seems to be no other way to do this (wx bug) 1618 1619 if GSASIIpath.GetConfigValue('debug'): 1619 print 'wx error: Rigid Body/Status not cleanly deleted after Refine'1620 print ('wx error: Rigid Body/Status not cleanly deleted after Refine') 1620 1621 return 1621 1622 SetStatusLine(' You may use e.g. "c60" or "s60" for a vector entry') … … 1770 1771 vecGrid = G2G.GSGrid(VectorRBDisplay) 1771 1772 vecGrid.SetTable(vecTable, True) 1772 vecGrid.Bind(wg.EVT_GRID_CELL_CHANGE, ChangeCell) 1773 if 'phoenix' in wx.version(): 1774 vecGrid.Bind(wg.EVT_GRID_CELL_CHANGED, ChangeCell) 1775 else: 1776 vecGrid.Bind(wg.EVT_GRID_CELL_CHANGE, ChangeCell) 1773 1777 if not imag: 1774 1778 vecGrid.Bind(wg.EVT_GRID_CELL_LEFT_DCLICK, TypeSelect) … … 1968 1972 resList.append(vecGrid) 1969 1973 vecGrid.SetTable(vecTable, True) 1970 vecGrid.Bind(wg.EVT_GRID_CELL_CHANGE, ChangeCell) 1974 if 'phoenix' in wx.version(): 1975 vecGrid.Bind(wg.EVT_GRID_CELL_CHANGED, ChangeCell) 1976 else: 1977 vecGrid.Bind(wg.EVT_GRID_CELL_CHANGE, ChangeCell) 1971 1978 vecGrid.Bind(wg.EVT_GRID_CELL_LEFT_DCLICK, TypeSelect) 1972 1979 vecGrid.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK, RowSelect)
Note: See TracChangeset
for help on using the changeset viewer.