Changeset 912
- Timestamp:
- May 16, 2013 3:40:25 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIddataGUI.py
r906 r912 8 8 # $Id: GSASIIddataGUI.py 844 2013-02-01 21:23:56Z vondreele $ 9 9 ########### SVN repository information ################### 10 ''' 11 *GSASIIddataGUI: Phase Diffraction Data GUI* 12 ============================================ 13 Module to create the GUI for display of diffraction data * phase 14 information that is shown in the data display window 15 (when a phase is selected.) 16 17 ''' 10 18 import wx 11 19 import wx.grid as wg … … 48 56 ################################################################################ 49 57 ##### DData routines 50 ################################################################################ 51 58 ################################################################################ 52 59 def UpdateDData(G2frame,DData,data): 60 '''Display the Diffraction Data associated with a phase 61 (items where there is a value for each histogram and phase) 62 63 :param wx.frame G2frame: the main GSAS-II frame object 64 65 :param wx.ScrolledWindow DData: notebook page to be used for the display 66 67 :param dict data: all the information on the phase in a dictionary 68 69 ''' 53 70 G2frame.dataFrame.SetStatusText('') 54 71 UseList = data['Histograms'] … … 971 988 972 989 DData.SetSizer(mainSizer,True) 973 mainSizer.FitInside(G2frame.dataFrame) 974 Size = mainSizer.GetMinSize() 975 Size[0] += 40 976 Size[1] = max(Size[1],290) + 35 977 DData.SetSize(Size) 978 DData.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 979 Size[1] = min(Size[1],450) 980 G2frame.dataFrame.setSizePosLeft(Size) 981 990 if G2frame.dataFrame.PhaseUserSize is None: 991 Size = mainSizer.GetMinSize() 992 Size[0] += 40 993 Size[1] = max(Size[1],290) + 35 994 DData.SetSize(Size) 995 DData.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 996 Size[1] = min(Size[1],450) 997 G2frame.dataFrame.setSizePosLeft(Size) 998 else: 999 Size = G2frame.dataFrame.PhaseUserSize 1000 DData.SetSize(G2frame.dataFrame.GetClientSize()) 1001 DData.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 1002 G2frame.dataFrame.Update() -
trunk/GSASIIgrid.py
r906 r912 8 8 # $Id$ 9 9 ########### SVN repository information ################### 10 ''' 11 *GSASIIgrid: Basic GUI routines* 12 ================================ 13 14 ''' 10 15 import wx 11 16 import wx.grid as wg … … 133 138 134 139 class SymOpDialog(wx.Dialog): 140 '''Class to select a symmetry operator 141 ''' 135 142 def __init__(self,parent,SGData,New=True,ForceUnit=False): 136 143 wx.Dialog.__init__(self,parent,-1,'Select symmetry operator', … … 235 242 236 243 class DisAglDialog(wx.Dialog): 237 244 '''Distance Angle Controls dialog 245 ''' 238 246 def __default__(self,data,default): 239 247 if data: … … 329 337 330 338 class PickTwoDialog(wx.Dialog): 331 339 '''This does not seem to be in use 340 ''' 332 341 def __init__(self,parent,title,prompt,names,choices): 333 342 wx.Dialog.__init__(self,parent,-1,title, … … 394 403 395 404 class SingleFloatDialog(wx.Dialog): 396 405 'Dialog to obtain a single float value from user' 397 406 def __init__(self,parent,title,prompt,value,limits=[0.,1.],format='%.5g'): 398 407 wx.Dialog.__init__(self,parent,-1,title, … … 453 462 454 463 class GridFractionEditor(wg.PyGridCellEditor): 464 '''A grid cell editor class that allows entry of values as fractions as well 465 as sine and cosine values [as s() and c()] 466 ''' 455 467 def __init__(self,grid): 456 468 wg.PyGridCellEditor.__init__(self) … … 535 547 536 548 class MyHelp(wx.Menu): 537 '''This class creates the contents of a help menu. 549 ''' 550 A class that creates the contents of a help menu. 538 551 The menu will start with two entries: 539 'Help on <helpType>': where helpType is a reference to an HTML page to 552 553 * 'Help on <helpType>': where helpType is a reference to an HTML page to 540 554 be opened 541 555 * About: opens an About dialog using OnHelpAbout. N.B. on the Mac this 542 556 gets moved to the App menu to be consistent with Apple style. 543 NOTE: the title when appending this menu should be '&Help' so the wx handles 544 it correctly. BHT 557 558 NOTE: for this to work properly with respect to system menus, the title 559 for the menu must be &Help, or it will not be processed properly: 560 561 :: 562 563 menu.Append(menu=MyHelp(self,...),title="&Help") 564 545 565 ''' 546 566 def __init__(self,frame,helpType=None,helpLbl=None,morehelpitems=[],title=''): … … 686 706 class AddHelp(wx.Menu): 687 707 '''This class a single entry for the help menu (used on the Mac only): 688 'Help on <helpType>': where helpType is a reference to an HTML page to 689 be opened 708 'Help on <helpType>': where helpType is a reference to an HTML page to 709 be opened 710 690 711 NOTE: the title when appending this menu should be '&Help' so the wx handles 691 it correctly. BHT712 it correctly. 692 713 ''' 693 714 def __init__(self,frame,helpType,helpLbl=None,title=''): … … 720 741 self.SetSizer(sizer) 721 742 sizer.Fit(frame) 722 self.Bind(wx.EVT_SIZE,self.On Size)723 def On Size(self,event): #does the job but weirdly!!743 self.Bind(wx.EVT_SIZE,self.OnHelpSize) 744 def OnHelpSize(self,event): #does the job but weirdly!! 724 745 anchor = self.htmlwin.GetOpenedAnchor() 725 746 if anchor: … … 765 786 766 787 class DataFrame(wx.Frame): 767 '''Create the dataframe window and its menus 788 '''Create the dataframe window and all the entries in menus. 789 The binding is for the menus is not done here, but rather is done 790 where the functions can be accessed (in various GSASII*GUI modules). 768 791 ''' 769 792 def Bind(self,*args,**kwargs): 770 '''Override the Bind() function on the Mac the binding is to793 '''Override the Bind() function: on the Mac the binding is to 771 794 the main window, so that menus operate with any window on top. 772 For other platforms, call the default classBind()795 For other platforms, call the default wx.Frame Bind() 773 796 ''' 774 797 if sys.platform == "darwin": # mac … … 779 802 def PrefillDataMenu(self,menu,helpType,helpLbl=None,empty=False): 780 803 '''Create the "standard" part of data frame menus. Note that on Linux and 781 Windows , this is the standard help Menu. On Mac, this menu duplicates the804 Windows nothing happens here. On Mac, this menu duplicates the 782 805 tree menu, but adds an extra help command for the data item and a separator. 783 806 ''' … … 789 812 if not empty: 790 813 menu.Append(wx.Menu(title=''),title='|') # add a separator 791 # menu.Append(AddHelp(self.G2frame,helpType=helpType, helpLbl=helpLbl),792 # title='&Help')793 #else: # other794 # menu.Append(menu=MyHelp(self,helpType=helpType, helpLbl=helpLbl),795 # title='&Help')796 814 797 815 def PostfillDataMenu(self,empty=False): … … 813 831 814 832 def _init_menus(self): 815 816 # define all GSAS-II data frame menus 817 818 # for use where no menu or data frame help is provided 833 'define all GSAS-II data frame menus' 834 835 # for use where no menu or data frame help is provided 819 836 self.BlankMenu = wx.MenuBar() 820 837 821 # Controls838 # Controls 822 839 self.ControlsMenu = wx.MenuBar() 823 840 self.PrefillDataMenu(self.ControlsMenu,helpType='Controls',empty=True) 824 841 self.PostfillDataMenu(empty=True) 825 842 826 # Notebook843 # Notebook 827 844 self.DataNotebookMenu = wx.MenuBar() 828 845 self.PrefillDataMenu(self.DataNotebookMenu,helpType='Notebook',empty=True) 829 846 self.PostfillDataMenu(empty=True) 830 847 831 # Comments848 # Comments 832 849 self.DataCommentsMenu = wx.MenuBar() 833 850 self.PrefillDataMenu(self.DataCommentsMenu,helpType='Comments',empty=True) 834 851 self.PostfillDataMenu(empty=True) 835 852 836 # Constraints853 # Constraints 837 854 self.ConstraintMenu = wx.MenuBar() 838 855 self.PrefillDataMenu(self.ConstraintMenu,helpType='Constraints') … … 849 866 self.PostfillDataMenu() 850 867 851 # Rigid bodies868 # Rigid bodies 852 869 self.VectorRBEdit = wx.Menu(title='') 853 870 self.VectorRBEdit.Append(id=wxID_RIGIDBODYADD, kind=wx.ITEM_NORMAL,text='Add rigid body', … … 866 883 self.PostfillDataMenu() 867 884 868 # Restraints885 # Restraints 869 886 self.RestraintEdit = wx.Menu(title='') 870 887 self.RestraintEdit.Append(id=wxID_RESTSELPHASE, kind=wx.ITEM_NORMAL,text='Select phase', … … 891 908 self.PostfillDataMenu() 892 909 893 # Sequential results910 # Sequential results 894 911 self.SequentialMenu = wx.MenuBar() 895 912 self.PrefillDataMenu(self.SequentialMenu,helpType='Sequential',helpLbl='Sequential Refinement') … … 900 917 self.PostfillDataMenu() 901 918 902 # PDR919 # PDR 903 920 self.ErrorMenu = wx.MenuBar() 904 921 self.PrefillDataMenu(self.ErrorMenu,helpType='PWD Analysis',helpLbl='Powder Fit Error Analysis') … … 909 926 self.PostfillDataMenu() 910 927 911 # PDR / Limits928 # PDR / Limits 912 929 self.LimitMenu = wx.MenuBar() 913 930 self.PrefillDataMenu(self.LimitMenu,helpType='Limits') … … 918 935 self.PostfillDataMenu() 919 936 920 # PDR / Background937 # PDR / Background 921 938 self.BackMenu = wx.MenuBar() 922 939 self.PrefillDataMenu(self.BackMenu,helpType='Background') … … 929 946 self.PostfillDataMenu() 930 947 931 # PDR / Instrument Parameters948 # PDR / Instrument Parameters 932 949 self.InstMenu = wx.MenuBar() 933 950 self.PrefillDataMenu(self.InstMenu,helpType='Instrument Parameters') … … 948 965 self.PostfillDataMenu() 949 966 950 # PDR / Sample Parameters967 # PDR / Sample Parameters 951 968 self.SampleMenu = wx.MenuBar() 952 969 self.PrefillDataMenu(self.SampleMenu,helpType='Sample Parameters') … … 963 980 self.PostfillDataMenu() 964 981 965 # PDR / Peak List982 # PDR / Peak List 966 983 self.PeakMenu = wx.MenuBar() 967 984 self.PrefillDataMenu(self.PeakMenu,helpType='Peak List') … … 985 1002 self.PFOneCycle.Enable(False) 986 1003 987 # PDR / Index Peak List1004 # PDR / Index Peak List 988 1005 self.IndPeaksMenu = wx.MenuBar() 989 1006 self.PrefillDataMenu(self.IndPeaksMenu,helpType='Index Peak List') … … 994 1011 self.PostfillDataMenu() 995 1012 996 # PDR / Unit Cells List1013 # PDR / Unit Cells List 997 1014 self.IndexMenu = wx.MenuBar() 998 1015 self.PrefillDataMenu(self.IndexMenu,helpType='Unit Cells List') … … 1013 1030 self.MakeNewPhase.Enable(False) 1014 1031 1015 # PDR / Reflection Lists1032 # PDR / Reflection Lists 1016 1033 self.ReflMenu = wx.MenuBar() 1017 1034 self.PrefillDataMenu(self.ReflMenu,helpType='Reflection List') … … 1022 1039 self.PostfillDataMenu() 1023 1040 1024 # IMG / Image Controls1041 # IMG / Image Controls 1025 1042 self.ImageMenu = wx.MenuBar() 1026 1043 self.PrefillDataMenu(self.ImageMenu,helpType='Image Controls') … … 1045 1062 self.PostfillDataMenu() 1046 1063 1047 # IMG / Masks1064 # IMG / Masks 1048 1065 self.MaskMenu = wx.MenuBar() 1049 1066 self.PrefillDataMenu(self.MaskMenu,helpType='Image Masks') … … 1058 1075 self.PostfillDataMenu() 1059 1076 1060 # IMG / Stress/Strain 1061 1077 # IMG / Stress/Strain 1062 1078 self.StrStaMenu = wx.MenuBar() 1063 1079 self.PrefillDataMenu(self.StrStaMenu,helpType='Stress/Strain') … … 1076 1092 self.PostfillDataMenu() 1077 1093 1078 # PDF / PDF Controls1094 # PDF / PDF Controls 1079 1095 self.PDFMenu = wx.MenuBar() 1080 1096 self.PrefillDataMenu(self.PDFMenu,helpType='PDF Controls') … … 1087 1103 self.PDFEdit.Append(help='Copy PDF controls', id=wxID_PDFCOPYCONTROLS, kind=wx.ITEM_NORMAL, 1088 1104 text='Copy controls') 1089 # self.PDFEdit.Append(help='Load PDF controls from file',id=wxID_PDFLOADCONTROLS, kind=wx.ITEM_NORMAL,1090 # text='Load Controls')1091 # self.PDFEdit.Append(help='Save PDF controls to file', id=wxID_PDFSAVECONTROLS, kind=wx.ITEM_NORMAL,1092 # text='Save controls')1105 # self.PDFEdit.Append(help='Load PDF controls from file',id=wxID_PDFLOADCONTROLS, kind=wx.ITEM_NORMAL, 1106 # text='Load Controls') 1107 # self.PDFEdit.Append(help='Save PDF controls to file', id=wxID_PDFSAVECONTROLS, kind=wx.ITEM_NORMAL, 1108 # text='Save controls') 1093 1109 self.PDFEdit.Append(help='Compute PDF', id=wxID_PDFCOMPUTE, kind=wx.ITEM_NORMAL, 1094 1110 text='Compute PDF') … … 1097 1113 self.PostfillDataMenu() 1098 1114 1099 # Phase / General tab 1100 1115 # Phase / General tab 1101 1116 self.DataGeneral = wx.MenuBar() 1102 1117 self.PrefillDataMenu(self.DataGeneral,helpType='General', helpLbl='Phase/General') … … 1113 1128 self.PostfillDataMenu() 1114 1129 1115 # Phase / Data tab1130 # Phase / Data tab 1116 1131 self.DataMenu = wx.MenuBar() 1117 1132 self.PrefillDataMenu(self.DataMenu,helpType='Data', helpLbl='Phase/Data') … … 1126 1141 self.PostfillDataMenu() 1127 1142 1128 # Phase / Atoms tab1143 # Phase / Atoms tab 1129 1144 self.AtomsMenu = wx.MenuBar() 1130 1145 self.PrefillDataMenu(self.AtomsMenu,helpType='Atoms') … … 1176 1191 self.PostfillDataMenu() 1177 1192 1178 # Phase / Draw Options tab1193 # Phase / Draw Options tab 1179 1194 self.DataDrawOptions = wx.MenuBar() 1180 1195 self.PrefillDataMenu(self.DataDrawOptions,helpType='Draw Options', helpLbl='Phase/Draw Options',empty=True) 1181 1196 self.PostfillDataMenu(empty=True) 1182 1197 1183 # Phase / Draw Atoms tab1198 # Phase / Draw Atoms tab 1184 1199 self.DrawAtomsMenu = wx.MenuBar() 1185 1200 self.PrefillDataMenu(self.DrawAtomsMenu,helpType='Draw Atoms') … … 1230 1245 self.PostfillDataMenu() 1231 1246 1232 # Phase / Texture tab1247 # Phase / Texture tab 1233 1248 self.TextureMenu = wx.MenuBar() 1234 1249 self.PrefillDataMenu(self.TextureMenu,helpType='Texture') … … 1241 1256 self.PostfillDataMenu() 1242 1257 1243 # Phase / Pawley tab1258 # Phase / Pawley tab 1244 1259 self.PawleyMenu = wx.MenuBar() 1245 1260 self.PrefillDataMenu(self.PawleyMenu,helpType='Pawley') … … 1256 1271 self.PostfillDataMenu() 1257 1272 1258 # Phase / Map peaks tab1273 # Phase / Map peaks tab 1259 1274 self.MapPeaksMenu = wx.MenuBar() 1260 1275 self.PrefillDataMenu(self.MapPeaksMenu,helpType='Map peaks') … … 1281 1296 self.PostfillDataMenu() 1282 1297 1283 # Phase / Rigid bodies tab1298 # Phase / Rigid bodies tab 1284 1299 self.RigidBodiesMenu = wx.MenuBar() 1285 1300 self.PrefillDataMenu(self.RigidBodiesMenu,helpType='Rigid bodies') … … 1297 1312 help='Remove all rigid body assignment for atoms') 1298 1313 self.PostfillDataMenu() 1299 1300 # end of GSAS-II menu definitions 1314 # end of GSAS-II menu definitions 1301 1315 1302 1316 def _init_ctrls(self, parent,name=None,size=None,pos=None): … … 1336 1350 1337 1351 class GSNoteBook(wx.aui.AuiNotebook): 1338 '''Notebook implemented with wx.aui extension''' 1352 '''Notebook used in various locations; implemented with wx.aui extension 1353 ''' 1339 1354 def __init__(self, parent, name='',size = None): 1340 1355 wx.aui.AuiNotebook.__init__(self, parent, -1, … … 1373 1388 1374 1389 class GSGrid(wg.Grid): 1390 '''Basic wx.Grid implementation 1391 ''' 1375 1392 def __init__(self, parent, name=''): 1376 1393 wg.Grid.__init__(self,parent,-1,name=name) … … 1395 1412 1396 1413 class Table(wg.PyGridTableBase): 1414 '''Basic data table for use with GSgrid 1415 ''' 1397 1416 def __init__(self, data=[], rowLabels=None, colLabels=None, types = None): 1398 1417 wg.PyGridTableBase.__init__(self) … … 1565 1584 1566 1585 def UpdateNotebook(G2frame,data): 1567 1586 '''Called when the data tree notebook entry is selected. Allows for 1587 editing of the text in that tree entry 1588 ''' 1568 1589 def OnNoteBook(event): 1569 1590 data = G2frame.dataDisplay.GetValue() … … 1587 1608 1588 1609 def UpdateControls(G2frame,data): 1610 '''Edit overall GSAS-II controls in main Controls data tree entry 1611 ''' 1589 1612 #patch 1590 1613 if 'deriv type' not in data: … … 1764 1787 1765 1788 def UpdateSeqResults(G2frame,data): 1766 """ 1767 input: 1768 data - dictionary 1769 'histNames' - list of histogram names in order as processed by Sequential Refinement 1770 'varyList' - list of variables - identical over all refinements in sequence 1771 'histName' - dictionaries for all data sets processed: 1772 'variables'- result[0] from leastsq call 1773 'varyList' - list of variables; same as above 1774 'sig' - esds for variables 1775 'covMatrix' - covariance matrix from individual refinement 1776 'title' - histogram name; same as dict item name 1777 'newAtomDict' - new atom parameters after shifts applied 1778 'newCellDict' - new cell parameters after shifts to A0-A5 applied' 1789 """ 1790 Called when the Sequential Results data tree entry is selected 1791 to show results from a sequential refinement. 1792 1793 :param wx.Frame G2frame: main GSAS-II data tree windows 1794 1795 :param dict data: a dictionary containing the following items: 1796 1797 * 'histNames' - list of histogram names in order as processed by Sequential Refinement 1798 * 'varyList' - list of variables - identical over all refinements in sequence 1799 * 'histName' - dictionaries for all data sets processed, which contains: 1800 1801 * 'variables'- result[0] from leastsq call 1802 * 'varyList' - list of variables; same as above 1803 * 'sig' - esds for variables 1804 * 'covMatrix' - covariance matrix from individual refinement 1805 * 'title' - histogram name; same as dict item name 1806 * 'newAtomDict' - new atom parameters after shifts applied 1807 * 'newCellDict' - new cell parameters after shifts to A0-A5 applied' 1779 1808 """ 1780 1809 if not data: … … 1914 1943 1915 1944 def UpdatePWHKPlot(G2frame,kind,item): 1945 '''Not sure what this does 1946 ''' 1916 1947 1917 1948 def OnErrorAnalysis(event): … … 1958 1989 1959 1990 def UpdateHKLControls(G2frame,data): 1991 '''Not sure what this does 1992 ''' 1960 1993 1961 1994 def OnScaleSlider(event): … … 2051 2084 2052 2085 def GetPatternTreeDataNames(G2frame,dataTypes): 2086 '''Not sure what this does 2087 ''' 2053 2088 names = [] 2054 2089 item, cookie = G2frame.PatternTree.GetFirstChild(G2frame.root) … … 2061 2096 2062 2097 def GetPatternTreeItemId(G2frame, parentId, itemText): 2098 '''Not sure what this does 2099 ''' 2063 2100 item, cookie = G2frame.PatternTree.GetFirstChild(parentId) 2064 2101 while item: … … 2069 2106 2070 2107 def MovePatternTreeToGrid(G2frame,item): 2108 '''Not sure what this does 2109 ''' 2071 2110 2072 2111 # print G2frame.PatternTree.GetItemText(item) 2073 2112 2074 oldPage = 0# will be set later if already on a Phase item2113 oldPage = None # will be set later if already on a Phase item 2075 2114 if G2frame.dataFrame: 2076 2115 SetDataMenuBar(G2frame) … … 2099 2138 #create the frame for the data item window 2100 2139 G2frame.dataFrame = DataFrame(parent=G2frame.mainPanel,frame=G2frame) 2101 2140 G2frame.dataFrame.PhaseUserSize = None 2141 2102 2142 G2frame.dataFrame.Raise() 2103 2143 G2frame.PickId = 0 -
trunk/GSASIIphsGUI.py
r906 r912 13 13 Module to create the GUI for display of phase information 14 14 in the data display window when a phase is selected. 15 (Items displayed by some tabs is found in other modules.) 15 (pages displayed in response to some phase tabs are done in other modules, 16 such as GSASIIddata.) 16 17 17 18 ''' … … 56 57 acosd = lambda x: 180.*np.arccos(x)/np.pi 57 58 59 58 60 def UpdatePhaseData(G2frame,Item,data,oldPage): 59 61 '''Create the data display window contents when a phase is clicked on … … 71 73 :param int oldPage: This sets a tab to select when moving 72 74 from one phase to another, in which case the same tab is selected 73 to display first. The default is 0, which brings up the General tab. 75 to display first. This is set only when the previous data tree 76 selection is a phase, if not the value is None. The default action 77 is to bring up the General tab. 74 78 75 79 ''' … … 162 166 163 167 def UpdateGeneral(): 168 '''Draw the controls for the General phase data subpage 169 ''' 164 170 165 ''' default dictionary structure for phase data: (taken from GSASII.py) 171 """ This is the default dictionary structure for phase data 172 (taken from GSASII.py) 166 173 'General':{ 167 174 'Name':PhaseName … … 175 182 'Atoms':[] 176 183 'Drawing':{} 177 '''178 184 """ 185 # UpdateGeneral execution starts here 179 186 phaseTypes = ['nuclear','modulated','magnetic','macromolecular'] 180 187 SetupGeneral() … … 184 191 MCSA = generalData['MCSA controls'] 185 192 PWDR = any(['PWDR' in item for item in data['Histograms'].keys()]) 193 # UpdateGeneral execution continues below 186 194 187 def NameSizer(): 188 195 def NameSizer(): 189 196 def OnPhaseName(event): 190 197 oldName = generalData['Name'] … … 728 735 mcsaSizer.Add(line3Sizer) 729 736 return mcsaSizer 730 737 738 # UpdateGeneral execution continues here 731 739 General.DestroyChildren() 732 740 dataDisplay = wx.Panel(General) … … 759 767 760 768 dataDisplay.SetSizer(mainSizer) 761 Size = mainSizer.Fit(G2frame.dataFrame) 762 Size[1] += 35 #compensate for status bar 763 dataDisplay.SetSize(Size) 769 if G2frame.dataFrame.PhaseUserSize is None: 770 Size = mainSizer.ComputeFittingWindowSize(G2frame.dataFrame) # get size needed by window 771 Size[1] += 35 #compensate for status bar 772 G2frame.dataFrame.setSizePosLeft(Size) 773 else: 774 G2frame.dataFrame.Update() 775 dataDisplay.SetSize(G2frame.dataFrame.GetClientSize()) 764 776 G2frame.dataFrame.SetStatusText('') 765 G2frame.dataFrame.setSizePosLeft(Size)766 777 767 778 ################################################################################ … … 770 781 771 782 def FillAtomsGrid(Atoms): 772 G2frame.dataFrame.setSizePosLeft([700,300]) 773 generalData = data['General'] 774 atomData = data['Atoms'] 775 DData = data['Drawing'] 776 resRBData = data['RBModels'].get('Residue',[]) 777 vecRBData = data['RBModels'].get('Vector',[]) 778 rbAtmDict = {} 779 for rbObj in resRBData+vecRBData: 780 exclList = ['X' for i in range(len(rbObj['Ids']))] 781 rbAtmDict.update(dict(zip(rbObj['Ids'],exclList))) 782 if rbObj['ThermalMotion'][0] != 'None': 783 for id in rbObj['Ids']: 784 rbAtmDict[id] += 'U' 785 # exclList will be 'x' or 'xu' if TLS used in RB 786 Items = [G2gd.wxID_ATOMSEDITINSERT,G2gd.wxID_ATOMSEDITDELETE,G2gd.wxID_ATOMSREFINE, 787 G2gd.wxID_ATOMSMODIFY,G2gd.wxID_ATOMSTRANSFORM,G2gd.wxID_ATOMVIEWINSERT,G2gd.wxID_ATOMMOVE] 788 if atomData: 789 for item in Items: 790 G2frame.dataFrame.AtomsMenu.Enable(item,True) 791 else: 792 for item in Items: 793 G2frame.dataFrame.AtomsMenu.Enable(item,False) 794 Items = [G2gd.wxID_ATOMVIEWINSERT, G2gd.wxID_ATOMSVIEWADD,G2gd.wxID_ATOMMOVE] 795 if 'showABC' in data['Drawing']: 796 for item in Items: 797 G2frame.dataFrame.AtomsMenu.Enable(item,True) 798 else: 799 for item in Items: 800 G2frame.dataFrame.AtomsMenu.Enable(item,False) 801 802 AAchoice = ": ,ALA,ARG,ASN,ASP,CYS,GLN,GLU,GLY,HIS,ILE,LEU,LYS,MET,PHE,PRO,SER,THR,TRP,TYR,VAL,MSE,HOH,UNK" 803 Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,wg.GRID_VALUE_CHOICE+": ,X,XU,U,F,FX,FXU,FU",]+ \ 804 3*[wg.GRID_VALUE_FLOAT+':10,5',]+[wg.GRID_VALUE_FLOAT+':10,4', #x,y,z,frac 805 wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,wg.GRID_VALUE_CHOICE+":I,A",] 806 Types += 7*[wg.GRID_VALUE_FLOAT+':10,5',] 807 colLabels = ['Name','Type','refine','x','y','z','frac','site sym','mult','I/A','Uiso','U11','U22','U33','U12','U13','U23'] 808 if generalData['Type'] == 'magnetic': 809 colLabels += ['Mx','My','Mz'] 810 Types[2] = wg.GRID_VALUE_CHOICE+": ,X,XU,U,M,MX,MXU,MU,F,FX,FXU,FU,FM,FMX,FMU," 811 Types += 3*[wg.GRID_VALUE_FLOAT+':10,4',] 812 elif generalData['Type'] == 'macromolecular': 813 colLabels = ['res no','residue','chain'] + colLabels 814 Types = [wg.GRID_VALUE_STRING, 815 wg.GRID_VALUE_CHOICE+AAchoice, 816 wg.GRID_VALUE_STRING] + Types 817 elif generalData['Type'] == 'modulated': 818 Types += [] 819 colLabels += [] 820 783 '''Display the contents of the Atoms tab 784 ''' 821 785 def RefreshAtomGrid(event): 822 786 … … 1153 1117 Atoms.AutoSizeColumns(False) 1154 1118 1119 # FillAtomsGrid executable code starts here 1120 generalData = data['General'] 1121 atomData = data['Atoms'] 1122 DData = data['Drawing'] 1123 resRBData = data['RBModels'].get('Residue',[]) 1124 vecRBData = data['RBModels'].get('Vector',[]) 1125 rbAtmDict = {} 1126 for rbObj in resRBData+vecRBData: 1127 exclList = ['X' for i in range(len(rbObj['Ids']))] 1128 rbAtmDict.update(dict(zip(rbObj['Ids'],exclList))) 1129 if rbObj['ThermalMotion'][0] != 'None': 1130 for id in rbObj['Ids']: 1131 rbAtmDict[id] += 'U' 1132 # exclList will be 'x' or 'xu' if TLS used in RB 1133 Items = [G2gd.wxID_ATOMSEDITINSERT,G2gd.wxID_ATOMSEDITDELETE,G2gd.wxID_ATOMSREFINE, 1134 G2gd.wxID_ATOMSMODIFY,G2gd.wxID_ATOMSTRANSFORM,G2gd.wxID_ATOMVIEWINSERT,G2gd.wxID_ATOMMOVE] 1135 if atomData: 1136 for item in Items: 1137 G2frame.dataFrame.AtomsMenu.Enable(item,True) 1138 else: 1139 for item in Items: 1140 G2frame.dataFrame.AtomsMenu.Enable(item,False) 1141 Items = [G2gd.wxID_ATOMVIEWINSERT, G2gd.wxID_ATOMSVIEWADD,G2gd.wxID_ATOMMOVE] 1142 if 'showABC' in data['Drawing']: 1143 for item in Items: 1144 G2frame.dataFrame.AtomsMenu.Enable(item,True) 1145 else: 1146 for item in Items: 1147 G2frame.dataFrame.AtomsMenu.Enable(item,False) 1148 1149 AAchoice = ": ,ALA,ARG,ASN,ASP,CYS,GLN,GLU,GLY,HIS,ILE,LEU,LYS,MET,PHE,PRO,SER,THR,TRP,TYR,VAL,MSE,HOH,UNK" 1150 Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,wg.GRID_VALUE_CHOICE+": ,X,XU,U,F,FX,FXU,FU",]+ \ 1151 3*[wg.GRID_VALUE_FLOAT+':10,5',]+[wg.GRID_VALUE_FLOAT+':10,4', #x,y,z,frac 1152 wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,wg.GRID_VALUE_CHOICE+":I,A",] 1153 Types += 7*[wg.GRID_VALUE_FLOAT+':10,5',] 1154 colLabels = ['Name','Type','refine','x','y','z','frac','site sym','mult','I/A','Uiso','U11','U22','U33','U12','U13','U23'] 1155 if generalData['Type'] == 'magnetic': 1156 colLabels += ['Mx','My','Mz'] 1157 Types[2] = wg.GRID_VALUE_CHOICE+": ,X,XU,U,M,MX,MXU,MU,F,FX,FXU,FU,FM,FMX,FMU," 1158 Types += 3*[wg.GRID_VALUE_FLOAT+':10,4',] 1159 elif generalData['Type'] == 'macromolecular': 1160 colLabels = ['res no','residue','chain'] + colLabels 1161 Types = [wg.GRID_VALUE_STRING, 1162 wg.GRID_VALUE_CHOICE+AAchoice, 1163 wg.GRID_VALUE_STRING] + Types 1164 elif generalData['Type'] == 'modulated': 1165 Types += [] 1166 colLabels += [] 1155 1167 SGData = data['General']['SGData'] 1156 1168 G2frame.dataFrame.SetStatusText('') … … 1163 1175 Atoms.Bind(wg.EVT_GRID_LABEL_RIGHT_CLICK, ChangeSelection) 1164 1176 Atoms.SetMargins(0,0) 1177 if G2frame.dataFrame.PhaseUserSize is None: 1178 G2frame.dataFrame.setSizePosLeft([700,300]) 1179 else: 1180 G2frame.dataFrame.Update() 1165 1181 Paint() 1166 1182 … … 1709 1725 1710 1726 def UpdateDrawAtoms(atomStyle=''): 1711 G2frame.dataFrame.SetStatusText('')1712 generalData = data['General']1713 SetupDrawingData()1714 drawingData = data['Drawing']1715 cx,ct,cs,ci = drawingData['atomPtrs']1716 atomData = drawingData['Atoms']1717 if atomStyle:1718 for atom in atomData:1719 atom[cs] = atomStyle1720 Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,]+3*[wg.GRID_VALUE_FLOAT+':10,5',]+ \1721 [wg.GRID_VALUE_STRING,wg.GRID_VALUE_CHOICE+": ,lines,vdW balls,sticks,balls & sticks,ellipsoids,polyhedra",1722 wg.GRID_VALUE_CHOICE+": ,type,name,number",wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,]1723 styleChoice = [' ','lines','vdW balls','sticks','balls & sticks','ellipsoids','polyhedra']1724 labelChoice = [' ','type','name','number']1725 colLabels = ['Name','Type','x','y','z','Sym Op','Style','Label','Color','I/A']1726 if generalData['Type'] == 'macromolecular':1727 colLabels = ['Residue','1-letter','Chain'] + colLabels1728 Types = 3*[wg.GRID_VALUE_STRING,]+Types1729 Types[8] = wg.GRID_VALUE_CHOICE+": ,lines,vdW balls,sticks,balls & sticks,ellipsoids,backbone,ribbons,schematic"1730 styleChoice = [' ','lines','vdW balls','sticks','balls & sticks','ellipsoids','backbone','ribbons','schematic']1731 labelChoice = [' ','type','name','number','residue','1-letter','chain']1732 Types[9] = wg.GRID_VALUE_CHOICE+": ,type,name,number,residue,1-letter,chain"1733 # elif generalData['Type'] == 'modulated':1734 # Types += []1735 # colLabels += []1736 1737 1727 def RefreshAtomGrid(event): 1738 1739 1728 def SetChoice(name,c,n=0): 1740 1729 choice = [] … … 1869 1858 drawingData['selectedAtoms'] = drawAtoms.GetSelectedRows() 1870 1859 G2plt.PlotStructure(G2frame,data) 1871 1860 1861 # UpdateDrawAtoms executable code starts here 1862 G2frame.dataFrame.SetStatusText('') 1863 generalData = data['General'] 1864 SetupDrawingData() 1865 drawingData = data['Drawing'] 1866 cx,ct,cs,ci = drawingData['atomPtrs'] 1867 atomData = drawingData['Atoms'] 1868 if atomStyle: 1869 for atom in atomData: 1870 atom[cs] = atomStyle 1871 Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,]+3*[wg.GRID_VALUE_FLOAT+':10,5',]+ \ 1872 [wg.GRID_VALUE_STRING,wg.GRID_VALUE_CHOICE+": ,lines,vdW balls,sticks,balls & sticks,ellipsoids,polyhedra", 1873 wg.GRID_VALUE_CHOICE+": ,type,name,number",wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,] 1874 styleChoice = [' ','lines','vdW balls','sticks','balls & sticks','ellipsoids','polyhedra'] 1875 labelChoice = [' ','type','name','number'] 1876 colLabels = ['Name','Type','x','y','z','Sym Op','Style','Label','Color','I/A'] 1877 if generalData['Type'] == 'macromolecular': 1878 colLabels = ['Residue','1-letter','Chain'] + colLabels 1879 Types = 3*[wg.GRID_VALUE_STRING,]+Types 1880 Types[8] = wg.GRID_VALUE_CHOICE+": ,lines,vdW balls,sticks,balls & sticks,ellipsoids,backbone,ribbons,schematic" 1881 styleChoice = [' ','lines','vdW balls','sticks','balls & sticks','ellipsoids','backbone','ribbons','schematic'] 1882 labelChoice = [' ','type','name','number','residue','1-letter','chain'] 1883 Types[9] = wg.GRID_VALUE_CHOICE+": ,type,name,number,residue,1-letter,chain" 1884 # elif generalData['Type'] == 'modulated': 1885 # Types += [] 1886 # colLabels += [] 1872 1887 table = [] 1873 1888 rowLabels = [] … … 1903 1918 if colLabels[c] not in ['Style','Label','Color']: 1904 1919 drawAtoms.SetColAttr(c,attr) 1905 G2frame.dataFrame.setSizePosLeft([600,300]) 1920 if G2frame.dataFrame.PhaseUserSize is None: 1921 G2frame.dataFrame.setSizePosLeft([600,300]) 1922 else: 1923 G2frame.dataFrame.Update() 1906 1924 1907 1925 FindBondsDraw() … … 2432 2450 import copy 2433 2451 import wx.lib.colourselect as wcs 2434 generalData = data['General'] 2435 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 2436 SetupDrawingData() 2437 drawingData = data['Drawing'] 2438 if generalData['Type'] == 'nuclear': 2439 pickChoice = ['Atoms','Bonds','Torsions','Planes'] 2440 elif generalData['Type'] == 'macromolecular': 2441 pickChoice = ['Atoms','Residues','Chains','Bonds','Torsions','Planes','phi/psi'] 2442 2443 def SlopSizer(): 2444 2452 def SlopSizer(): 2445 2453 def OnCameraPos(event): 2446 2454 drawingData['cameraPos'] = cameraPos.GetValue() … … 2733 2741 return radSizer 2734 2742 2743 # UpdateDrawOptions exectable code starts here 2744 generalData = data['General'] 2745 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 2746 SetupDrawingData() 2747 drawingData = data['Drawing'] 2748 if generalData['Type'] == 'nuclear': 2749 pickChoice = ['Atoms','Bonds','Torsions','Planes'] 2750 elif generalData['Type'] == 'macromolecular': 2751 pickChoice = ['Atoms','Residues','Chains','Bonds','Torsions','Planes','phi/psi'] 2752 2735 2753 G2frame.dataFrame.SetStatusText('') 2736 2754 drawOptions.DestroyChildren() … … 2747 2765 2748 2766 dataDisplay.SetSizer(mainSizer) 2749 Size = mainSizer.Fit(G2frame.dataFrame) 2750 Size[1] += 35 #compensate for status bar 2751 dataDisplay.SetSize(Size) 2752 G2frame.dataFrame.setSizePosLeft(Size) 2767 if G2frame.dataFrame.PhaseUserSize is None: 2768 Size = mainSizer.Fit(G2frame.dataFrame) 2769 Size[1] += 35 #compensate for status bar 2770 G2frame.dataFrame.setSizePosLeft(Size) 2771 else: 2772 G2frame.dataFrame.Update() 2773 dataDisplay.SetSize(G2frame.dataFrame.GetClientSize()) 2753 2774 2754 2775 ################################################################################ … … 2756 2777 ################################################################################ 2757 2778 2758 def UpdateTexture(): 2759 G2frame.dataFrame.SetStatusText('') 2760 generalData = data['General'] 2761 SGData = generalData['SGData'] 2762 try: 2763 textureData = generalData['SH Texture'] 2764 except KeyError: #fix old files! 2765 textureData = generalData['SH Texture'] = {'Order':0,'Model':'cylindrical', 2766 'Sample omega':[False,0.0],'Sample chi':[False,0.0],'Sample phi':[False,0.0], 2767 'SH Coeff':[False,{}],'SHShow':False,'PFhkl':[0,0,1], 2768 'PFxyz':[0,0,1.],'PlotType':'Pole figure'} 2769 if 'SHShow' not in textureData: #another fix 2770 textureData.update({'SHShow':False,'PFhkl':[0,0,1],'PFxyz':[0,0,1.],'PlotType':'Pole figure'}) 2771 try: #another fix! 2772 x = textureData['PlotType'] 2773 except KeyError: 2774 textureData.update({'PFxyz':[0,0,1.],'PlotType':'Pole figure'}) 2775 shModels = ['cylindrical','none','shear - 2/m','rolling - mmm'] 2776 SamSym = dict(zip(shModels,['0','-1','2/m','mmm'])) 2777 if generalData['doPawley'] and G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Sequental results'): 2778 G2frame.dataFrame.RefineTexture.Enable(True) 2779 shAngles = ['omega','chi','phi'] 2780 2779 def UpdateTexture(): 2781 2780 def SetSHCoef(): 2782 2781 cofNames = G2lat.GenSHCoeff(SGData['SGLaue'],SamSym[textureData['Model']],textureData['Order']) … … 2873 2872 G2plt.PlotTexture(G2frame,data) 2874 2873 2874 # UpdateTexture executable starts here 2875 G2frame.dataFrame.SetStatusText('') 2876 generalData = data['General'] 2877 SGData = generalData['SGData'] 2878 try: 2879 textureData = generalData['SH Texture'] 2880 except KeyError: #fix old files! 2881 textureData = generalData['SH Texture'] = {'Order':0,'Model':'cylindrical', 2882 'Sample omega':[False,0.0],'Sample chi':[False,0.0],'Sample phi':[False,0.0], 2883 'SH Coeff':[False,{}],'SHShow':False,'PFhkl':[0,0,1], 2884 'PFxyz':[0,0,1.],'PlotType':'Pole figure'} 2885 if 'SHShow' not in textureData: #another fix 2886 textureData.update({'SHShow':False,'PFhkl':[0,0,1],'PFxyz':[0,0,1.],'PlotType':'Pole figure'}) 2887 try: #another fix! 2888 x = textureData['PlotType'] 2889 except KeyError: 2890 textureData.update({'PFxyz':[0,0,1.],'PlotType':'Pole figure'}) 2891 shModels = ['cylindrical','none','shear - 2/m','rolling - mmm'] 2892 SamSym = dict(zip(shModels,['0','-1','2/m','mmm'])) 2893 if generalData['doPawley'] and G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Sequental results'): 2894 G2frame.dataFrame.RefineTexture.Enable(True) 2895 shAngles = ['omega','chi','phi'] 2875 2896 if Texture.GetSizer(): 2876 2897 Texture.GetSizer().Clear(True) … … 2974 2995 mainSizer.Add(angSizer,0,wx.ALIGN_CENTER_VERTICAL) 2975 2996 Texture.SetSizer(mainSizer,True) 2976 mainSizer.Fit(G2frame.dataFrame) 2977 Size = mainSizer.GetMinSize() 2978 Size[0] += 40 2979 Size[1] = max(Size[1],250) + 35 2980 Texture.SetSize(Size) 2981 Texture.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 2982 Size[1] = min(Size[1],450) 2983 G2frame.dataFrame.setSizePosLeft(Size) 2984 2997 if G2frame.dataFrame.PhaseUserSize is None: 2998 mainSizer.Fit(G2frame.dataFrame) 2999 Size = mainSizer.GetMinSize() 3000 Size[0] += 40 3001 Size[1] = max(Size[1],250) + 35 3002 Texture.SetSize(Size) 3003 Texture.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 3004 Size[1] = min(Size[1],450) 3005 G2frame.dataFrame.setSizePosLeft(Size) 3006 else: 3007 Size = G2frame.dataFrame.PhaseUserSize 3008 Texture.SetSize(G2frame.dataFrame.GetClientSize()) 3009 Texture.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 3010 G2frame.dataFrame.Update() 2985 3011 ################################################################################ 2986 3012 ##### DData routines - GUI stuff in GSASIIddataGUI.py … … 3097 3123 3098 3124 def FillRigidBodyGrid(refresh=True): 3099 if refresh: 3100 RigidBodies.DestroyChildren() 3101 AtLookUp = G2mth.FillAtomLookUp(data['Atoms']) 3102 general = data['General'] 3103 cx = general['AtomPtrs'][0] 3104 Amat,Bmat = G2lat.cell2AB(general['Cell'][1:7]) 3105 RBData = G2frame.PatternTree.GetItemPyData( 3106 G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Rigid bodies')) 3107 Indx = {} 3108 atomStyle = 'balls & sticks' 3109 if 'macro' in general['Type']: 3110 atomStyle = 'sticks' 3111 3125 '''Fill the Rigid Body Phase information tab page. 3126 Note that the page is a ScrolledWindow, not a Grid 3127 ''' 3112 3128 def OnThermSel(event): #needs to be seen by VecRbSizer! 3113 3129 Obj = event.GetEventObject() … … 3365 3381 return vecrbSizer 3366 3382 3383 # FillRigidBodyGrid executable code starts here 3384 if refresh: 3385 RigidBodies.DestroyChildren() 3386 AtLookUp = G2mth.FillAtomLookUp(data['Atoms']) 3387 general = data['General'] 3388 cx = general['AtomPtrs'][0] 3389 Amat,Bmat = G2lat.cell2AB(general['Cell'][1:7]) 3390 RBData = G2frame.PatternTree.GetItemPyData( 3391 G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Rigid bodies')) 3392 Indx = {} 3393 atomStyle = 'balls & sticks' 3394 if 'macro' in general['Type']: 3395 atomStyle = 'sticks' 3367 3396 G2frame.dataFrame.SetStatusText('') 3368 3397 mainSizer = wx.BoxSizer(wx.VERTICAL) … … 3385 3414 3386 3415 RigidBodies.SetSizer(mainSizer) 3387 mainSizer.FitInside(G2frame.dataFrame) 3388 Size = mainSizer.GetMinSize() 3389 Size[0] += 40 3390 Size[1] = max(Size[1],290) + 35 3391 RigidBodies.SetSize(Size) 3392 RigidBodies.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 3393 Size[1] = min(Size[1],450) 3394 G2frame.dataFrame.setSizePosLeft(Size) 3395 3416 if G2frame.dataFrame.PhaseUserSize is None: 3417 mainSizer.FitInside(G2frame.dataFrame) 3418 Size = mainSizer.GetMinSize() 3419 Size[0] += 40 3420 Size[1] = max(Size[1],290) + 35 3421 RigidBodies.SetSize(Size) 3422 RigidBodies.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 3423 Size[1] = min(Size[1],450) 3424 G2frame.dataFrame.setSizePosLeft(Size) 3425 else: 3426 Size = G2frame.dataFrame.PhaseUserSize 3427 RigidBodies.SetSize(Size) 3428 RigidBodies.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1) 3429 G2frame.dataFrame.Update() 3430 3396 3431 def OnRBCopyParms(event): 3397 3432 RBObjs = [] … … 3866 3901 3867 3902 def FillPawleyReflectionsGrid(): 3868 G2frame.dataFrame.SetStatusText('')3869 3870 3903 def KeyEditPawleyGrid(event): 3871 3904 colList = G2frame.PawleyRefl.GetSelectedCols() … … 3888 3921 FillPawleyReflectionsGrid() 3889 3922 3923 # FillPawleyReflectionsGrid executable starts here 3924 G2frame.dataFrame.SetStatusText('') 3890 3925 if 'Pawley ref' in data: 3891 3926 PawleyPeaks = data['Pawley ref'] … … 3906 3941 G2frame.PawleyRefl.SetMargins(0,0) 3907 3942 G2frame.PawleyRefl.AutoSizeColumns(False) 3908 G2frame.dataFrame.setSizePosLeft([500,300]) 3943 if G2frame.dataFrame.PhaseUserSize is None: 3944 G2frame.dataFrame.setSizePosLeft([500,300]) 3945 else: 3946 G2frame.dataFrame.Update() 3909 3947 3910 3948 def OnPawleyLoad(event): … … 4053 4091 G2plt.PlotStructure(G2frame,data) 4054 4092 4055 G2frame.dataFrame.setSizePosLeft([450,300]) 4093 if G2frame.dataFrame.PhaseUserSize is None: 4094 G2frame.dataFrame.setSizePosLeft([450,300]) 4095 else: 4096 G2frame.dataFrame.Update() 4056 4097 G2frame.dataFrame.SetStatusText('') 4057 4098 if 'Map Peaks' in data: … … 4328 4369 event.Skip() 4329 4370 4371 def OnDataResize(event): 4372 'Called when the data item window is resized by the user.' 4373 G2frame.dataFrame.PhaseUserSize = G2frame.dataFrame.GetSize() 4374 event.Skip() 4375 4330 4376 def OnPageChanged(event): 4377 '''This is called every time that a Notebook tab button is pressed 4378 on a Phase data item window 4379 ''' 4380 wx.Frame.Unbind(G2frame.dataFrame,wx.EVT_SIZE) # ignore size events during this routine 4331 4381 page = event.GetSelection() 4332 4382 text = G2frame.dataDisplay.GetPageText(page) … … 4426 4476 else: 4427 4477 G2gd.SetDataMenuBar(G2frame) 4478 wx.Frame.Bind(G2frame.dataFrame,wx.EVT_SIZE,OnDataResize) # capture user resize events again 4428 4479 event.Skip() 4429 4480 4481 wx.Frame.Unbind(G2frame.dataFrame,wx.EVT_SIZE) # ignore size events during this routine 4430 4482 General = wx.Window(G2frame.dataDisplay) 4483 # General = wx.ScrolledWindow(G2frame.dataDisplay) # would like to change to this 4431 4484 G2frame.dataDisplay.AddPage(General,'General') 4432 4485 DData = wx.ScrolledWindow(G2frame.dataDisplay) … … 4454 4507 4455 4508 G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.DataGeneral) 4456 SetupGeneral() 4509 SetupGeneral() # this is done all over the place (including in 4510 # UpdateGeneral). Why here too? 4511 4457 4512 GeneralData = data['General'] 4458 if oldPage: 4513 4514 if oldPage is None: 4515 # when entering a Phase data item from any other item, 4516 # reset a saved size, if any. 4517 G2frame.dataFrame.PhaseUserSize = None 4518 UpdateGeneral() 4519 elif oldPage: 4459 4520 G2frame.dataDisplay.SetSelection(oldPage) 4460 4521 else: 4461 4522 UpdateGeneral() 4462 4463 4523 wx.Frame.Bind(G2frame.dataFrame,wx.EVT_SIZE,OnDataResize) # capture user resizing
Note: See TracChangeset
for help on using the changeset viewer.