Changeset 3000 for trunk/GSASIIconstrGUI.py
- Timestamp:
- Aug 11, 2017 5:34:54 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:mergeinfo
set to
/branch/2frame merged eligible
-
Property
svn:mergeinfo
set to
-
trunk/GSASIIconstrGUI.py
r2753 r3000 31 31 import GSASIImath as G2mth 32 32 import GSASIIlattice as G2lat 33 import GSASII gridas G2gd34 import GSASIIctrl sas G2G33 import GSASIIdataGUI as G2gd 34 import GSASIIctrlGUI as G2G 35 35 import GSASIIplot as G2plt 36 36 import GSASIIobj as G2obj … … 224 224 print str(key) + ': '+str(j)+' variable(s) as strings converted to objects' 225 225 ################################################################################## 226 rigidbodyDict = G2frame. PatternTree.GetItemPyData(227 G2gd.Get PatternTreeItemId(G2frame,G2frame.root,'Rigid bodies'))226 rigidbodyDict = G2frame.GPXtree.GetItemPyData( 227 G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Rigid bodies')) 228 228 rbIds = rigidbodyDict.get('RBIds',{'Vector':[],'Residue':[]}) 229 229 rbVary,rbDict = G2stIO.GetRigidBodyModels(rigidbodyDict,Print=False) … … 458 458 atchoice = [fmt.format(*i1) for i1 in choices] 459 459 dlg = G2G.G2MultiChoiceDialog( 460 G2frame .dataFrame,legend,460 G2frame,legend, 461 461 'Constrain '+str(FrstVarb)+' with...',atchoice, 462 462 toggle=False,size=(625,400),monoFont=True) … … 468 468 if len(Selections) == 0: 469 469 dlg = wx.MessageDialog( 470 G2frame .dataFrame,470 G2frame, 471 471 'No variables were selected to include with '+str(FrstVarb), 472 472 'No variables') … … 477 477 else: 478 478 dlg = wx.MessageDialog( 479 G2frame .dataFrame,479 G2frame, 480 480 'There are no appropriate variables to include with '+str(FrstVarb), 481 481 'No variables') … … 554 554 else: 555 555 dlg = wx.MessageDialog( 556 G2frame .dataFrame,556 G2frame, 557 557 'There are no selected variables to include with '+str(FrstVarb), 558 558 'No variables') … … 584 584 res = G2frame.ErrorDialog('Constraint Error', 585 585 'Error with newly added constraint:\n'+errmsg+ 586 '\n\nDiscard newly added constraint?',parent=G2frame .dataFrame,586 '\n\nDiscard newly added constraint?',parent=G2frame, 587 587 wtype=wx.YES_NO) 588 588 return res != wx.ID_YES … … 611 611 res = G2frame.ErrorDialog('Constraint Error', 612 612 'Error after editing constraint:\n'+errmsg+ 613 '\n\nDiscard last constraint edit?',parent=G2frame .dataFrame,613 '\n\nDiscard last constraint edit?',parent=G2frame, 614 614 wtype=wx.YES_NO) 615 615 return res != wx.ID_YES … … 651 651 if not varList: 652 652 G2frame.ErrorDialog('No variables','There are no variables of type '+vartype, 653 parent=G2frame .dataFrame)653 parent=G2frame) 654 654 return 655 655 l2 = l1 = 1 … … 662 662 #varListlbl = ["("+i+") "+G2obj.fmtVarDescr(i) for i in varList] 663 663 legend = "Select variables to hold (Will not be varied, even if vary flag is set)" 664 dlg = G2G.G2MultiChoiceDialog( 665 G2frame.dataFrame, 664 dlg = G2G.G2MultiChoiceDialog(G2frame, 666 665 legend,title1,varListlbl,toggle=False,size=(625,400),monoFont=True) 667 666 dlg.CenterOnParent() … … 684 683 if not varList: 685 684 G2frame.ErrorDialog('No variables','There are no variables of type '+vartype, 686 parent=G2frame .dataFrame)685 parent=G2frame) 687 686 return 688 687 # legend = "Select variables to make equivalent (only one of the variables will be varied when all are set to be varied)" … … 697 696 if not varList: 698 697 G2frame.ErrorDialog('No variables','There are no variables of type '+vartype, 699 parent=G2frame .dataFrame)698 parent=G2frame) 700 699 return 701 700 # legend = "Select atoms to make equivalent (only one of the atom variables will be varied when all are set to be varied)" … … 710 709 if not varList: 711 710 G2frame.ErrorDialog('No variables','There are no variables of type '+vartype, 712 parent=G2frame .dataFrame)711 parent=G2frame) 713 712 return 714 713 # legend = "Select atoms to ride (only one of the atom variables will be varied when all are set to be varied)" … … 723 722 if not varList: 724 723 G2frame.ErrorDialog('No variables','There are no variables of type '+vartype, 725 parent=G2frame .dataFrame)724 parent=G2frame) 726 725 return 727 726 # legend = "Select variables to include in a new variable (the new variable will be varied when all included variables are varied)" … … 736 735 if not varList: 737 736 G2frame.ErrorDialog('No variables','There are no variables of type '+vartype, 738 parent=G2frame .dataFrame)737 parent=G2frame) 739 738 return 740 739 # legend = "Select variables to include in a constraint equation (the values will be constrainted to equal a specified constant)" … … 753 752 fmt = "{:"+str(l1)+"s} {:"+str(l2)+"s} {:s}" 754 753 varListlbl = [fmt.format(i,*G2obj.VarDescr(i)) for i in varList] 755 dlg = G2G.G2SingleChoiceDialog(G2frame .dataFrame,'Select 1st variable:',754 dlg = G2G.G2SingleChoiceDialog(G2frame,'Select 1st variable:', 756 755 title1,varListlbl,monoFont=True,size=(625,400)) 757 756 dlg.CenterOnParent() … … 802 801 AtNames = Atoms.keys() 803 802 AtNames.sort() 804 dlg = G2G.G2SingleChoiceDialog(G2frame .dataFrame,'Select 1st atom:',803 dlg = G2G.G2SingleChoiceDialog(G2frame,'Select 1st atom:', 805 804 title1,AtNames,monoFont=True,size=(625,400)) 806 805 dlg.CenterOnParent() … … 820 819 return 821 820 dlg = G2G.G2MultiChoiceDialog( 822 G2frame .dataFrame,title2+FrstAtom,821 G2frame,title2+FrstAtom, 823 822 'Constrain '+str(FrstAtom)+' with...',AtNames, 824 823 toggle=False,size=(625,400),monoFont=True) … … 1013 1012 varname = "" 1014 1013 lbl = 'Enter value for each term in constraint; sum = new variable' 1015 dlg = ConstraintDialog(G2frame .dataFrame,constType,lbl,items,1014 dlg = ConstraintDialog(G2frame,constType,lbl,items, 1016 1015 varname=varname,varyflag=data[name][Id][-2]) 1017 1016 elif data[name][Id][-1] == 'c': … … 1020 1019 constType = 'Constraint' 1021 1020 lbl = 'Edit value for each term in constant constraint sum' 1022 dlg = ConstraintDialog(G2frame .dataFrame,constType,lbl,items)1021 dlg = ConstraintDialog(G2frame,constType,lbl,items) 1023 1022 elif data[name][Id][-1] == 'e': 1024 1023 items = data[name][Id][:-3] 1025 1024 constType = 'Equivalence' 1026 1025 lbl = 'The following terms are set to be equal:' 1027 dlg = ConstraintDialog(G2frame .dataFrame,constType,lbl,items,'/')1026 dlg = ConstraintDialog(G2frame,constType,lbl,items,'/') 1028 1027 else: 1029 1028 return … … 1062 1061 notebook tab. Called in :func:`OnPageChanged` 1063 1062 ''' 1064 if panel.GetSizer(): panel.GetSizer().Clear(True) # N.B. don't use panel.DestroyChildren() 1065 # because it deletes scrollbars on Mac 1063 if panel.GetSizer(): panel.GetSizer().Clear(True) 1066 1064 Siz = wx.BoxSizer(wx.VERTICAL) 1067 1065 Siz.Add((5,5),0) 1068 Siz.Add(MakeConstraintsSizer(typ,panel) )1066 Siz.Add(MakeConstraintsSizer(typ,panel),1,wx.EXPAND) 1069 1067 panel.SetSizer(Siz,True) 1070 1068 Size = Siz.GetMinSize() … … 1073 1071 panel.SetSize(Size) 1074 1072 panel.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 1075 Size[1] = min(500,Size[1]) 1076 G2frame.dataFrame.setSizePosLeft(Size) 1073 panel.Show() 1077 1074 1078 1075 def OnPageChanged(event): … … 1083 1080 page = event.GetSelection() 1084 1081 else: # called directly, get current page 1085 page = G2frame.dataDisplay.GetSelection() 1086 G2frame.dataDisplay.ChangeSelection(page) 1087 text = G2frame.dataDisplay.GetPageText(page) 1088 G2frame.dataFrame.ConstraintEdit.Enable(G2gd.wxID_EQUIVALANCEATOMS,False) 1089 # G2frame.dataFrame.ConstraintEdit.Enable(G2gd.wxID_ADDRIDING,False) 1082 page = G2frame.constr.GetSelection() 1083 #G2frame.constr.SetSize(G2frame.dataWindow.GetClientSize()) #TODO -almost right 1084 G2frame.constr.ChangeSelection(page) 1085 text = G2frame.constr.GetPageText(page) 1086 G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_EQUIVALANCEATOMS,False) 1087 # G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_ADDRIDING,False) 1090 1088 if text == 'Histogram/Phase': 1091 1089 G2frame.Page = [page,'hap'] … … 1096 1094 elif text == 'Phase': 1097 1095 G2frame.Page = [page,'phs'] 1098 G2frame.data Frame.ConstraintEdit.Enable(G2gd.wxID_EQUIVALANCEATOMS,True)1099 # G2frame.data Frame.ConstraintEdit.Enable(G2gd.wxID_ADDRIDING,True)1096 G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_EQUIVALANCEATOMS,True) 1097 # G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_ADDRIDING,True) 1100 1098 if 'DELETED' in str(PhaseConstr): #seems to be no other way to do this (wx bug) 1101 1099 if GSASIIpath.GetConfigValue('debug'): … … 1110 1108 'Respond to a "select tab" menu button' 1111 1109 try: 1112 i = (G2 gd.wxID_CONSPHASE,1113 G2 gd.wxID_CONSHAP,1114 G2 gd.wxID_CONSHIST,1115 G2 gd.wxID_CONSGLOBAL).index(event.GetId())1116 G2frame. dataDisplay.SetSelection(i)1110 i = (G2G.wxID_CONSPHASE, 1111 G2G.wxID_CONSHAP, 1112 G2G.wxID_CONSHIST, 1113 G2G.wxID_CONSGLOBAL).index(event.GetId()) 1114 G2frame.constr.SetSelection(i) 1117 1115 wx.CallAfter(OnPageChanged,None) 1118 1116 except ValueError: … … 1120 1118 1121 1119 def SetStatusLine(text): 1122 Status.SetStatusText(text) 1123 1124 if G2frame.dataDisplay: 1125 G2frame.dataDisplay.Destroy() 1126 G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.ConstraintMenu) 1127 G2frame.dataFrame.SetLabel('Constraints') 1128 if not G2frame.dataFrame.GetStatusBar(): 1129 Status = G2frame.dataFrame.CreateStatusBar() 1120 G2frame.GetStatusBar().SetStatusText(text,1) 1121 1122 G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.ConstraintMenu) 1123 #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Constraints') 1124 G2frame.SetTitle('Constraints') 1130 1125 SetStatusLine('') 1131 1126 1132 G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.ConstraintMenu) 1133 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddConstraint, id=G2gd.wxID_CONSTRAINTADD) 1134 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddFunction, id=G2gd.wxID_FUNCTADD) 1135 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddEquivalence, id=G2gd.wxID_EQUIVADD) 1136 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddHold, id=G2gd.wxID_HOLDADD) 1137 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddAtomEquiv, id=G2gd.wxID_EQUIVALANCEATOMS) 1138 # G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddRiding, id=G2gd.wxID_ADDRIDING) 1127 G2frame.Bind(wx.EVT_MENU, OnAddConstraint, id=G2G.wxID_CONSTRAINTADD) 1128 G2frame.Bind(wx.EVT_MENU, OnAddFunction, id=G2G.wxID_FUNCTADD) 1129 G2frame.Bind(wx.EVT_MENU, OnAddEquivalence, id=G2G.wxID_EQUIVADD) 1130 G2frame.Bind(wx.EVT_MENU, OnAddHold, id=G2G.wxID_HOLDADD) 1131 G2frame.Bind(wx.EVT_MENU, OnAddAtomEquiv, id=G2G.wxID_EQUIVALANCEATOMS) 1132 # G2frame.Bind(wx.EVT_MENU, OnAddRiding, id=G2G.wxID_ADDRIDING) 1139 1133 # tab commands 1140 for id in (G2gd.wxID_CONSPHASE, 1141 G2gd.wxID_CONSHAP, 1142 G2gd.wxID_CONSHIST, 1143 G2gd.wxID_CONSGLOBAL): 1144 G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=id) 1145 1146 G2frame.dataDisplay = G2G.GSNoteBook(parent=G2frame.dataFrame) 1134 for id in (G2G.wxID_CONSPHASE, 1135 G2G.wxID_CONSHAP, 1136 G2G.wxID_CONSHIST, 1137 G2G.wxID_CONSGLOBAL): 1138 G2frame.Bind(wx.EVT_MENU, RaisePage,id=id) 1139 1140 #G2frame.constr = G2G.GSNoteBook(parent=G2frame.dataWindow,size=G2frame.dataWindow.GetClientSize()) 1141 G2frame.constr = G2G.GSNoteBook(parent=G2frame.dataWindow) 1142 G2frame.dataWindow.GetSizer().Add(G2frame.constr,1,wx.ALL|wx.EXPAND) 1147 1143 # note that order of pages is hard-coded in RaisePage 1148 PhaseConstr = wx.ScrolledWindow(G2frame. dataDisplay)1149 G2frame. dataDisplay.AddPage(PhaseConstr,'Phase')1150 HAPConstr = wx.ScrolledWindow(G2frame. dataDisplay)1151 G2frame. dataDisplay.AddPage(HAPConstr,'Histogram/Phase')1152 HistConstr = wx.ScrolledWindow(G2frame. dataDisplay)1153 G2frame. dataDisplay.AddPage(HistConstr,'Histogram')1154 GlobalConstr = wx.ScrolledWindow(G2frame. dataDisplay)1155 G2frame. dataDisplay.AddPage(GlobalConstr,'Global')1144 PhaseConstr = wx.ScrolledWindow(G2frame.constr) 1145 G2frame.constr.AddPage(PhaseConstr,'Phase') 1146 HAPConstr = wx.ScrolledWindow(G2frame.constr) 1147 G2frame.constr.AddPage(HAPConstr,'Histogram/Phase') 1148 HistConstr = wx.ScrolledWindow(G2frame.constr) 1149 G2frame.constr.AddPage(HistConstr,'Histogram') 1150 GlobalConstr = wx.ScrolledWindow(G2frame.constr) 1151 G2frame.constr.AddPage(GlobalConstr,'Global') 1156 1152 wx.CallAfter(OnPageChanged,None) 1157 G2frame. dataDisplay.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, OnPageChanged)1153 G2frame.constr.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, OnPageChanged) 1158 1154 # validate all the constrants -- should not see any errors here normally 1159 1155 allcons = [] … … 1167 1163 if errmsg: 1168 1164 G2frame.ErrorDialog('Constraint Error','Error in constraints:\n'+errmsg, 1169 parent=G2frame .dataFrame)1165 parent=G2frame) 1170 1166 elif warnmsg: 1171 1167 print 'Unexpected contraint warning:\n',warnmsg … … 1212 1208 oAcof = G2lat.cell2A(oldPhase['General']['Cell'][1:7]) 1213 1209 nAcof = G2lat.cell2A(newPhase['General']['Cell'][1:7]) 1214 item = G2gd.Get PatternTreeItemId(G2frame,G2frame.root,'Constraints')1215 constraints = G2frame. PatternTree.GetItemPyData(item)1210 item = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Constraints') 1211 constraints = G2frame.GPXtree.GetItemPyData(item) 1216 1212 # GSASIIpath.IPyBreak() 1217 1213 parmDict = {} … … 1314 1310 resList = [] 1315 1311 plotDefaults = {'oldxy':[0.,0.],'Quaternion':[0.,0.,0.,1.],'cameraPos':30.,'viewDir':[0,0,1],} 1312 1313 G2frame.rbBook = G2G.GSNoteBook(parent=G2frame.dataWindow) 1314 G2frame.dataWindow.GetSizer().Add(G2frame.rbBook,1,wx.ALL|wx.EXPAND) 1315 VectorRB = wx.ScrolledWindow(G2frame.rbBook) 1316 VectorRBDisplay = wx.Panel(VectorRB) 1317 G2frame.rbBook.AddPage(VectorRB,'Vector rigid bodies') 1318 ResidueRB = wx.ScrolledWindow(G2frame.rbBook) 1319 ResidueRBDisplay = wx.Panel(ResidueRB) 1320 G2frame.rbBook.AddPage(ResidueRB,'Residue rigid bodies') 1316 1321 1317 1322 def OnPageChanged(event): … … 1321 1326 page = event.GetSelection() 1322 1327 else: 1323 page = G2frame.dataDisplay.GetSelection() 1324 G2frame.dataDisplay.ChangeSelection(page) 1325 text = G2frame.dataDisplay.GetPageText(page) 1328 page = G2frame.rbBook.GetSelection() 1329 #G2frame.rbBook.SetSize(G2frame.dataWindow.GetClientSize()) #TODO -almost right 1330 G2frame.rbBook.ChangeSelection(page) 1331 text = G2frame.rbBook.GetPageText(page) 1326 1332 if text == 'Vector rigid bodies': 1327 G2gd.SetDataMenuBar(G2frame,G2frame.data Frame.VectorBodyMenu)1328 G2frame. dataFrame.Bind(wx.EVT_MENU, AddVectorRB, id=G2gd.wxID_VECTORBODYADD)1333 G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.VectorBodyMenu) 1334 G2frame.Bind(wx.EVT_MENU, AddVectorRB, id=G2G.wxID_VECTORBODYADD) 1329 1335 G2frame.Page = [page,'vrb'] 1330 1336 UpdateVectorRB() 1331 1337 elif text == 'Residue rigid bodies': 1332 G2gd.SetDataMenuBar(G2frame,G2frame.data Frame.RigidBodyMenu)1333 G2frame. dataFrame.Bind(wx.EVT_MENU, AddResidueRB, id=G2gd.wxID_RIGIDBODYADD)1334 G2frame. dataFrame.Bind(wx.EVT_MENU, OnImportRigidBody, id=G2gd.wxID_RIGIDBODYIMPORT)1335 G2frame. dataFrame.Bind(wx.EVT_MENU, OnDefineTorsSeq, id=G2gd.wxID_RESIDUETORSSEQ) #enable only if residue RBs exist?1338 G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RigidBodyMenu) 1339 G2frame.Bind(wx.EVT_MENU, AddResidueRB, id=G2G.wxID_RIGIDBODYADD) 1340 G2frame.Bind(wx.EVT_MENU, OnImportRigidBody, id=G2G.wxID_RIGIDBODYIMPORT) 1341 G2frame.Bind(wx.EVT_MENU, OnDefineTorsSeq, id=G2G.wxID_RESIDUETORSSEQ) #enable only if residue RBs exist? 1336 1342 G2frame.Page = [page,'rrb'] 1337 1343 UpdateResidueRB() … … 1377 1383 1378 1384 def OnImportRigidBody(event): 1379 page = G2frame. dataDisplay.GetSelection()1380 if 'Vector' in G2frame. dataDisplay.GetPageText(page):1385 page = G2frame.rbBook.GetSelection() 1386 if 'Vector' in G2frame.rbBook.GetPageText(page): 1381 1387 pass 1382 elif 'Residue' in G2frame. dataDisplay.GetPageText(page):1388 elif 'Residue' in G2frame.rbBook.GetPageText(page): 1383 1389 ImportResidueRB() 1384 1390 1385 1391 def AddVectorRB(event): 1386 1392 AtInfo = data['Vector']['AtInfo'] 1387 dlg = MultiIntegerDialog(G2frame .dataDisplay,'New Rigid Body',['No. atoms','No. translations'],[1,1])1393 dlg = MultiIntegerDialog(G2frame,'New Rigid Body',['No. atoms','No. translations'],[1,1]) 1388 1394 if dlg.ShowModal() == wx.ID_OK: 1389 1395 nAtoms,nTrans = dlg.GetValues() … … 1554 1560 print 'There are no rigid bodies defined' 1555 1561 G2frame.ErrorDialog('No rigid bodies','There are no rigid bodies defined', 1556 parent=G2frame .dataFrame)1562 parent=G2frame) 1557 1563 return 1558 1564 elif len(rbNames) > 1: … … 1595 1601 AtInfo = data['Vector']['AtInfo'] 1596 1602 refChoice = {} 1597 if 'DELETED' in str( Status): #seems to be no other way to do this (wx bug)1603 if 'DELETED' in str(G2frame.GetStatusBar()): #seems to be no other way to do this (wx bug) 1598 1604 if GSASIIpath.GetConfigValue('debug'): 1599 1605 print 'wx error: Rigid Body/Status not cleanly deleted after Refine' … … 1762 1768 for col in [4,5,6]: 1763 1769 vecGrid.SetCellStyle(row,col,VERY_LIGHT_GREY,True) 1764 vecGrid.SetMargins(0,0)1770 # vecGrid.SetScrollRate(0,0) 1765 1771 vecGrid.AutoSizeColumns(False) 1766 1772 vecSizer.Add(vecGrid) … … 1778 1784 refChoice[rbId][i].sort() 1779 1785 1780 #VectorRB.DestroyChildren() # bad, deletes scrollbars on Mac! 1781 if VectorRB.GetSizer(): 1782 VectorRB.GetSizer().Clear(True) 1783 VectorRBDisplay = wx.Panel(VectorRB) 1786 if VectorRB.GetSizer(): VectorRB.GetSizer().Clear(True) 1784 1787 VectorRBSizer = wx.BoxSizer(wx.VERTICAL) 1785 1788 for rbId in data['RBIds']['Vector']: … … 1804 1807 VectorRB.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 1805 1808 VectorRB.Scroll(0,Scroll) 1806 Size[1] = min(Size[1],500)1807 G2frame.dataFrame.setSizePosLeft(Size)1808 1809 1809 1810 def UpdateResidueRB(): … … 1929 1930 for col in range(5): 1930 1931 vecGrid.SetCellStyle(row,col,VERY_LIGHT_GREY,True) 1931 vecGrid.SetMargins(0,0)1932 # vecGrid.SetScrollRate(0,0) 1932 1933 vecGrid.AutoSizeColumns(False) 1933 1934 vecSizer = wx.BoxSizer() … … 2058 2059 refChoice[rbId][i].sort() 2059 2060 2060 #ResidueRB.DestroyChildren() # bad, deletes scrollbars on Mac! 2061 if ResidueRB.GetSizer(): 2062 # ResidueRB.DestroyChildren() 2063 ResidueRB.GetSizer().Clear(True) 2064 2065 ResidueRBDisplay = wx.Panel(ResidueRB) 2061 ResidueRBDisplay.DestroyChildren() 2066 2062 ResidueRBSizer = wx.BoxSizer(wx.VERTICAL) 2067 2063 for rbId in data['RBIds']['Residue']: … … 2081 2077 if rbData['rbSeq']: 2082 2078 ResidueRBSizer.Add(slideSizer,) 2083 ResidueRBSizer.Add(wx.StaticText(ResidueRBDisplay,-1, 100*'-'))2079 ResidueRBSizer.Add(wx.StaticText(ResidueRBDisplay,-1,70*'-')) 2084 2080 2085 2081 ResidueRBSizer.Add((5,25),) … … 2091 2087 ResidueRBDisplay.SetSize(Size) 2092 2088 ResidueRB.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 2093 Size[1] = min(500,Size[1])2094 G2frame.dataFrame.setSizePosLeft(Size)2095 2089 2096 2090 def SetStatusLine(text): 2097 Status.SetStatusText(text) 2098 2099 if G2frame.dataDisplay: 2100 G2frame.dataDisplay.Destroy() 2101 G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.RigidBodyMenu) 2102 G2frame.dataFrame.SetLabel('Rigid bodies') 2103 if not G2frame.dataFrame.GetStatusBar(): 2104 Status = G2frame.dataFrame.CreateStatusBar() 2091 G2frame.GetStatusBar().SetStatusText(text,1) 2092 2093 G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RigidBodyMenu) 2094 G2frame.SetTitle('Rigid bodies') 2105 2095 SetStatusLine('') 2106 2107 G2frame.dataDisplay = G2G.GSNoteBook(parent=G2frame.dataFrame,size=G2frame.dataFrame.GetClientSize())2108 2109 VectorRB = wx.ScrolledWindow(G2frame.dataDisplay)2110 G2frame.dataDisplay.AddPage(VectorRB,'Vector rigid bodies')2111 ResidueRB = wx.ScrolledWindow(G2frame.dataDisplay)2112 G2frame.dataDisplay.AddPage(ResidueRB,'Residue rigid bodies')2113 2096 UpdateVectorRB() 2114 G2frame. dataDisplay.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, OnPageChanged)2097 G2frame.rbBook.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, OnPageChanged) 2115 2098 wx.CallAfter(OnPageChanged,None)
Note: See TracChangeset
for help on using the changeset viewer.