Changeset 912


Ignore:
Timestamp:
May 16, 2013 3:40:25 PM (9 years ago)
Author:
toby
Message:

Change phase data window so that user resize is tracked and saved; reorder G2phsGUI code to be easier to follow; lots more sphinx documentation

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIddataGUI.py

    r906 r912  
    88# $Id: GSASIIddataGUI.py 844 2013-02-01 21:23:56Z vondreele $
    99########### SVN repository information ###################
     10'''
     11*GSASIIddataGUI: Phase Diffraction Data GUI*
     12============================================
     13Module to create the GUI for display of diffraction data * phase
     14information that is shown in the data display window
     15(when a phase is selected.)
     16
     17'''
    1018import wx
    1119import wx.grid as wg
     
    4856################################################################################
    4957##### DData routines
    50 ################################################################################
    51        
     58################################################################################       
    5259def 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    '''
    5370    G2frame.dataFrame.SetStatusText('')
    5471    UseList = data['Histograms']
     
    971988
    972989    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  
    88# $Id$
    99########### SVN repository information ###################
     10'''
     11*GSASIIgrid: Basic GUI routines*
     12================================
     13
     14'''
    1015import wx
    1116import wx.grid as wg
     
    133138       
    134139class SymOpDialog(wx.Dialog):
     140    '''Class to select a symmetry operator
     141    '''
    135142    def __init__(self,parent,SGData,New=True,ForceUnit=False):
    136143        wx.Dialog.__init__(self,parent,-1,'Select symmetry operator',
     
    235242
    236243class DisAglDialog(wx.Dialog):
    237    
     244    '''Distance Angle Controls dialog
     245    '''
    238246    def __default__(self,data,default):
    239247        if data:
     
    329337       
    330338class PickTwoDialog(wx.Dialog):
    331    
     339    '''This does not seem to be in use
     340    '''
    332341    def __init__(self,parent,title,prompt,names,choices):
    333342        wx.Dialog.__init__(self,parent,-1,title,
     
    394403       
    395404class SingleFloatDialog(wx.Dialog):
    396    
     405    'Dialog to obtain a single float value from user'
    397406    def __init__(self,parent,title,prompt,value,limits=[0.,1.],format='%.5g'):
    398407        wx.Dialog.__init__(self,parent,-1,title,
     
    453462       
    454463class 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    '''
    455467    def __init__(self,grid):
    456468        wg.PyGridCellEditor.__init__(self)
     
    535547
    536548class 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.
    538551    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
    540554      be opened
    541       About: opens an About dialog using OnHelpAbout. N.B. on the Mac this
     555    * About: opens an About dialog using OnHelpAbout. N.B. on the Mac this
    542556      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
    545565    '''
    546566    def __init__(self,frame,helpType=None,helpLbl=None,morehelpitems=[],title=''):
     
    686706class AddHelp(wx.Menu):
    687707    '''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
    690711    NOTE: the title when appending this menu should be '&Help' so the wx handles
    691     it correctly. BHT
     712    it correctly.
    692713    '''
    693714    def __init__(self,frame,helpType,helpLbl=None,title=''):
     
    720741        self.SetSizer(sizer)
    721742        sizer.Fit(frame)       
    722         self.Bind(wx.EVT_SIZE,self.OnSize)
    723     def OnSize(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!!
    724745        anchor = self.htmlwin.GetOpenedAnchor()
    725746        if anchor:           
     
    765786
    766787class 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).
    768791    '''
    769792    def Bind(self,*args,**kwargs):
    770         '''Override the Bind() function on the Mac the binding is to
     793        '''Override the Bind() function: on the Mac the binding is to
    771794        the main window, so that menus operate with any window on top.
    772         For other platforms, call the default class Bind()
     795        For other platforms, call the default wx.Frame Bind()
    773796        '''
    774797        if sys.platform == "darwin": # mac
     
    779802    def PrefillDataMenu(self,menu,helpType,helpLbl=None,empty=False):
    780803        '''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 the
     804        Windows nothing happens here. On Mac, this menu duplicates the
    782805        tree menu, but adds an extra help command for the data item and a separator.
    783806        '''
     
    789812            if not empty:
    790813                menu.Append(wx.Menu(title=''),title='|') # add a separator
    791         #    menu.Append(AddHelp(self.G2frame,helpType=helpType, helpLbl=helpLbl),
    792         #                title='&Help')
    793         #else: # other
    794         #    menu.Append(menu=MyHelp(self,helpType=helpType, helpLbl=helpLbl),
    795         #                title='&Help')
    796814       
    797815    def PostfillDataMenu(self,empty=False):
     
    813831
    814832    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
    819836        self.BlankMenu = wx.MenuBar()
    820837       
    821 # Controls
     838        # Controls
    822839        self.ControlsMenu = wx.MenuBar()
    823840        self.PrefillDataMenu(self.ControlsMenu,helpType='Controls',empty=True)
    824841        self.PostfillDataMenu(empty=True)
    825842       
    826 # Notebook
     843        # Notebook
    827844        self.DataNotebookMenu = wx.MenuBar()
    828845        self.PrefillDataMenu(self.DataNotebookMenu,helpType='Notebook',empty=True)
    829846        self.PostfillDataMenu(empty=True)
    830847       
    831 # Comments
     848        # Comments
    832849        self.DataCommentsMenu = wx.MenuBar()
    833850        self.PrefillDataMenu(self.DataCommentsMenu,helpType='Comments',empty=True)
    834851        self.PostfillDataMenu(empty=True)
    835852       
    836 # Constraints
     853        # Constraints
    837854        self.ConstraintMenu = wx.MenuBar()
    838855        self.PrefillDataMenu(self.ConstraintMenu,helpType='Constraints')
     
    849866        self.PostfillDataMenu()
    850867       
    851 # Rigid bodies
     868        # Rigid bodies
    852869        self.VectorRBEdit = wx.Menu(title='')
    853870        self.VectorRBEdit.Append(id=wxID_RIGIDBODYADD, kind=wx.ITEM_NORMAL,text='Add rigid body',
     
    866883        self.PostfillDataMenu()
    867884           
    868 # Restraints
     885        # Restraints
    869886        self.RestraintEdit = wx.Menu(title='')
    870887        self.RestraintEdit.Append(id=wxID_RESTSELPHASE, kind=wx.ITEM_NORMAL,text='Select phase',
     
    891908        self.PostfillDataMenu()
    892909           
    893 # Sequential results
     910        # Sequential results
    894911        self.SequentialMenu = wx.MenuBar()
    895912        self.PrefillDataMenu(self.SequentialMenu,helpType='Sequential',helpLbl='Sequential Refinement')
     
    900917        self.PostfillDataMenu()
    901918           
    902 # PDR
     919        # PDR
    903920        self.ErrorMenu = wx.MenuBar()
    904921        self.PrefillDataMenu(self.ErrorMenu,helpType='PWD Analysis',helpLbl='Powder Fit Error Analysis')
     
    909926        self.PostfillDataMenu()
    910927           
    911 # PDR / Limits
     928        # PDR / Limits
    912929        self.LimitMenu = wx.MenuBar()
    913930        self.PrefillDataMenu(self.LimitMenu,helpType='Limits')
     
    918935        self.PostfillDataMenu()
    919936           
    920 # PDR / Background
     937        # PDR / Background
    921938        self.BackMenu = wx.MenuBar()
    922939        self.PrefillDataMenu(self.BackMenu,helpType='Background')
     
    929946        self.PostfillDataMenu()
    930947           
    931 # PDR / Instrument Parameters
     948        # PDR / Instrument Parameters
    932949        self.InstMenu = wx.MenuBar()
    933950        self.PrefillDataMenu(self.InstMenu,helpType='Instrument Parameters')
     
    948965        self.PostfillDataMenu()
    949966       
    950 # PDR / Sample Parameters
     967        # PDR / Sample Parameters
    951968        self.SampleMenu = wx.MenuBar()
    952969        self.PrefillDataMenu(self.SampleMenu,helpType='Sample Parameters')
     
    963980        self.PostfillDataMenu()
    964981
    965 # PDR / Peak List
     982        # PDR / Peak List
    966983        self.PeakMenu = wx.MenuBar()
    967984        self.PrefillDataMenu(self.PeakMenu,helpType='Peak List')
     
    9851002        self.PFOneCycle.Enable(False)
    9861003       
    987 # PDR / Index Peak List
     1004        # PDR / Index Peak List
    9881005        self.IndPeaksMenu = wx.MenuBar()
    9891006        self.PrefillDataMenu(self.IndPeaksMenu,helpType='Index Peak List')
     
    9941011        self.PostfillDataMenu()
    9951012       
    996 # PDR / Unit Cells List
     1013        # PDR / Unit Cells List
    9971014        self.IndexMenu = wx.MenuBar()
    9981015        self.PrefillDataMenu(self.IndexMenu,helpType='Unit Cells List')
     
    10131030        self.MakeNewPhase.Enable(False)
    10141031       
    1015 # PDR / Reflection Lists
     1032        # PDR / Reflection Lists
    10161033        self.ReflMenu = wx.MenuBar()
    10171034        self.PrefillDataMenu(self.ReflMenu,helpType='Reflection List')
     
    10221039        self.PostfillDataMenu()
    10231040       
    1024 # IMG / Image Controls
     1041        # IMG / Image Controls
    10251042        self.ImageMenu = wx.MenuBar()
    10261043        self.PrefillDataMenu(self.ImageMenu,helpType='Image Controls')
     
    10451062        self.PostfillDataMenu()
    10461063           
    1047 # IMG / Masks
     1064        # IMG / Masks
    10481065        self.MaskMenu = wx.MenuBar()
    10491066        self.PrefillDataMenu(self.MaskMenu,helpType='Image Masks')
     
    10581075        self.PostfillDataMenu()
    10591076           
    1060 # IMG / Stress/Strain
    1061 
     1077        # IMG / Stress/Strain
    10621078        self.StrStaMenu = wx.MenuBar()
    10631079        self.PrefillDataMenu(self.StrStaMenu,helpType='Stress/Strain')
     
    10761092        self.PostfillDataMenu()
    10771093           
    1078 # PDF / PDF Controls
     1094        # PDF / PDF Controls
    10791095        self.PDFMenu = wx.MenuBar()
    10801096        self.PrefillDataMenu(self.PDFMenu,helpType='PDF Controls')
     
    10871103        self.PDFEdit.Append(help='Copy PDF controls', id=wxID_PDFCOPYCONTROLS, kind=wx.ITEM_NORMAL,
    10881104            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')
    10931109        self.PDFEdit.Append(help='Compute PDF', id=wxID_PDFCOMPUTE, kind=wx.ITEM_NORMAL,
    10941110            text='Compute PDF')
     
    10971113        self.PostfillDataMenu()
    10981114           
    1099 # Phase / General tab
    1100 
     1115        # Phase / General tab
    11011116        self.DataGeneral = wx.MenuBar()
    11021117        self.PrefillDataMenu(self.DataGeneral,helpType='General', helpLbl='Phase/General')
     
    11131128        self.PostfillDataMenu()
    11141129       
    1115 # Phase / Data tab
     1130        # Phase / Data tab
    11161131        self.DataMenu = wx.MenuBar()
    11171132        self.PrefillDataMenu(self.DataMenu,helpType='Data', helpLbl='Phase/Data')
     
    11261141        self.PostfillDataMenu()
    11271142           
    1128 # Phase / Atoms tab
     1143        # Phase / Atoms tab
    11291144        self.AtomsMenu = wx.MenuBar()
    11301145        self.PrefillDataMenu(self.AtomsMenu,helpType='Atoms')
     
    11761191        self.PostfillDataMenu()
    11771192                 
    1178 # Phase / Draw Options tab
     1193        # Phase / Draw Options tab
    11791194        self.DataDrawOptions = wx.MenuBar()
    11801195        self.PrefillDataMenu(self.DataDrawOptions,helpType='Draw Options', helpLbl='Phase/Draw Options',empty=True)
    11811196        self.PostfillDataMenu(empty=True)
    11821197       
    1183 # Phase / Draw Atoms tab
     1198        # Phase / Draw Atoms tab
    11841199        self.DrawAtomsMenu = wx.MenuBar()
    11851200        self.PrefillDataMenu(self.DrawAtomsMenu,helpType='Draw Atoms')
     
    12301245        self.PostfillDataMenu()
    12311246           
    1232 # Phase / Texture tab
     1247        # Phase / Texture tab
    12331248        self.TextureMenu = wx.MenuBar()
    12341249        self.PrefillDataMenu(self.TextureMenu,helpType='Texture')
     
    12411256        self.PostfillDataMenu()
    12421257           
    1243 # Phase / Pawley tab
     1258        # Phase / Pawley tab
    12441259        self.PawleyMenu = wx.MenuBar()
    12451260        self.PrefillDataMenu(self.PawleyMenu,helpType='Pawley')
     
    12561271        self.PostfillDataMenu()
    12571272           
    1258 # Phase / Map peaks tab
     1273        # Phase / Map peaks tab
    12591274        self.MapPeaksMenu = wx.MenuBar()
    12601275        self.PrefillDataMenu(self.MapPeaksMenu,helpType='Map peaks')
     
    12811296        self.PostfillDataMenu()
    12821297
    1283 # Phase / Rigid bodies tab
     1298        # Phase / Rigid bodies tab
    12841299        self.RigidBodiesMenu = wx.MenuBar()
    12851300        self.PrefillDataMenu(self.RigidBodiesMenu,helpType='Rigid bodies')
     
    12971312            help='Remove all rigid body assignment for atoms')
    12981313        self.PostfillDataMenu()
    1299            
    1300 # end of GSAS-II menu definitions
     1314    # end of GSAS-II menu definitions
    13011315       
    13021316    def _init_ctrls(self, parent,name=None,size=None,pos=None):
     
    13361350       
    13371351class GSNoteBook(wx.aui.AuiNotebook):
    1338     '''Notebook implemented with wx.aui extension'''
     1352    '''Notebook used in various locations; implemented with wx.aui extension
     1353    '''
    13391354    def __init__(self, parent, name='',size = None):
    13401355        wx.aui.AuiNotebook.__init__(self, parent, -1,
     
    13731388       
    13741389class GSGrid(wg.Grid):
     1390    '''Basic wx.Grid implementation
     1391    '''
    13751392    def __init__(self, parent, name=''):
    13761393        wg.Grid.__init__(self,parent,-1,name=name)                   
     
    13951412       
    13961413class Table(wg.PyGridTableBase):
     1414    '''Basic data table for use with GSgrid
     1415    '''
    13971416    def __init__(self, data=[], rowLabels=None, colLabels=None, types = None):
    13981417        wg.PyGridTableBase.__init__(self)
     
    15651584       
    15661585def 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    '''
    15681589    def OnNoteBook(event):
    15691590        data = G2frame.dataDisplay.GetValue()
     
    15871608       
    15881609def UpdateControls(G2frame,data):
     1610    '''Edit overall GSAS-II controls in main Controls data tree entry
     1611    '''
    15891612    #patch
    15901613    if 'deriv type' not in data:
     
    17641787       
    17651788def 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'
    17791808    """
    17801809    if not data:
     
    19141943       
    19151944def UpdatePWHKPlot(G2frame,kind,item):
     1945    '''Not sure what this does
     1946    '''
    19161947
    19171948    def OnErrorAnalysis(event):
     
    19581989       
    19591990def UpdateHKLControls(G2frame,data):
     1991    '''Not sure what this does
     1992    '''
    19601993   
    19611994    def OnScaleSlider(event):
     
    20512084       
    20522085def GetPatternTreeDataNames(G2frame,dataTypes):
     2086    '''Not sure what this does
     2087    '''
    20532088    names = []
    20542089    item, cookie = G2frame.PatternTree.GetFirstChild(G2frame.root)       
     
    20612096                         
    20622097def GetPatternTreeItemId(G2frame, parentId, itemText):
     2098    '''Not sure what this does
     2099    '''
    20632100    item, cookie = G2frame.PatternTree.GetFirstChild(parentId)
    20642101    while item:
     
    20692106
    20702107def MovePatternTreeToGrid(G2frame,item):
     2108    '''Not sure what this does
     2109    '''
    20712110   
    20722111#    print G2frame.PatternTree.GetItemText(item)
    20732112   
    2074     oldPage = 0 # will be set later if already on a Phase item
     2113    oldPage = None # will be set later if already on a Phase item
    20752114    if G2frame.dataFrame:
    20762115        SetDataMenuBar(G2frame)
     
    20992138        #create the frame for the data item window
    21002139        G2frame.dataFrame = DataFrame(parent=G2frame.mainPanel,frame=G2frame)
    2101 
     2140        G2frame.dataFrame.PhaseUserSize = None
     2141       
    21022142    G2frame.dataFrame.Raise()           
    21032143    G2frame.PickId = 0
  • trunk/GSASIIphsGUI.py

    r906 r912  
    1313Module to create the GUI for display of phase information
    1414in 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,
     16such as GSASIIddata.)
    1617
    1718'''
     
    5657acosd = lambda x: 180.*np.arccos(x)/np.pi
    5758
     59
    5860def UpdatePhaseData(G2frame,Item,data,oldPage):
    5961    '''Create the data display window contents when a phase is clicked on
     
    7173    :param int oldPage: This sets a tab to select when moving
    7274      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.
    7478
    7579    '''
     
    162166
    163167    def UpdateGeneral():
     168        '''Draw the controls for the General phase data subpage
     169        '''
    164170       
    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)
    166173        'General':{
    167174            'Name':PhaseName
     
    175182        'Atoms':[]
    176183        'Drawing':{}
    177         '''
    178        
     184        """       
     185        # UpdateGeneral execution starts here
    179186        phaseTypes = ['nuclear','modulated','magnetic','macromolecular']
    180187        SetupGeneral()
     
    184191        MCSA = generalData['MCSA controls'] 
    185192        PWDR = any(['PWDR' in item for item in data['Histograms'].keys()])
     193        # UpdateGeneral execution continues below
    186194       
    187         def NameSizer():
    188                    
     195        def NameSizer():                   
    189196            def OnPhaseName(event):
    190197                oldName = generalData['Name']
     
    728735            mcsaSizer.Add(line3Sizer)           
    729736            return mcsaSizer
    730                
     737
     738        # UpdateGeneral execution continues here
    731739        General.DestroyChildren()
    732740        dataDisplay = wx.Panel(General)
     
    759767
    760768        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())
    764776        G2frame.dataFrame.SetStatusText('')
    765         G2frame.dataFrame.setSizePosLeft(Size)
    766777
    767778################################################################################
     
    770781
    771782    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        '''
    821785        def RefreshAtomGrid(event):
    822786
     
    11531117            Atoms.AutoSizeColumns(False)
    11541118
     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 += []
    11551167        SGData = data['General']['SGData']
    11561168        G2frame.dataFrame.SetStatusText('')
     
    11631175        Atoms.Bind(wg.EVT_GRID_LABEL_RIGHT_CLICK, ChangeSelection)
    11641176        Atoms.SetMargins(0,0)
     1177        if G2frame.dataFrame.PhaseUserSize is None:
     1178            G2frame.dataFrame.setSizePosLeft([700,300])
     1179        else:
     1180            G2frame.dataFrame.Update()
    11651181        Paint()
    11661182
     
    17091725           
    17101726    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] = atomStyle
    1720         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'] + colLabels
    1728             Types = 3*[wg.GRID_VALUE_STRING,]+Types
    1729             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 
    17371727        def RefreshAtomGrid(event):
    1738 
    17391728            def SetChoice(name,c,n=0):
    17401729                choice = []
     
    18691858            drawingData['selectedAtoms'] = drawAtoms.GetSelectedRows()
    18701859            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 += []
    18721887        table = []
    18731888        rowLabels = []
     
    19031918           if colLabels[c] not in ['Style','Label','Color']:
    19041919                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()
    19061924       
    19071925        FindBondsDraw()
     
    24322450        import copy
    24332451        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():           
    24452453            def OnCameraPos(event):
    24462454                drawingData['cameraPos'] = cameraPos.GetValue()
     
    27332741            return radSizer
    27342742
     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
    27352753        G2frame.dataFrame.SetStatusText('')
    27362754        drawOptions.DestroyChildren()
     
    27472765
    27482766        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())
    27532774
    27542775################################################################################
     
    27562777################################################################################
    27572778       
    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():       
    27812780        def SetSHCoef():
    27822781            cofNames = G2lat.GenSHCoeff(SGData['SGLaue'],SamSym[textureData['Model']],textureData['Order'])
     
    28732872            G2plt.PlotTexture(G2frame,data)
    28742873
     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']
    28752896        if Texture.GetSizer():
    28762897            Texture.GetSizer().Clear(True)
     
    29742995        mainSizer.Add(angSizer,0,wx.ALIGN_CENTER_VERTICAL)
    29752996        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()
    29853011################################################################################
    29863012##### DData routines - GUI stuff in GSASIIddataGUI.py
     
    30973123
    30983124    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        '''
    31123128        def OnThermSel(event):       #needs to be seen by VecRbSizer!
    31133129            Obj = event.GetEventObject()
     
    33653381            return vecrbSizer               
    33663382       
     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'
    33673396        G2frame.dataFrame.SetStatusText('')
    33683397        mainSizer = wx.BoxSizer(wx.VERTICAL)
     
    33853414
    33863415        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
    33963431    def OnRBCopyParms(event):
    33973432        RBObjs = []
     
    38663901
    38673902    def FillPawleyReflectionsGrid():
    3868         G2frame.dataFrame.SetStatusText('')
    3869                        
    38703903        def KeyEditPawleyGrid(event):
    38713904            colList = G2frame.PawleyRefl.GetSelectedCols()
     
    38883921                        FillPawleyReflectionsGrid()
    38893922           
     3923        # FillPawleyReflectionsGrid executable starts here
     3924        G2frame.dataFrame.SetStatusText('')                       
    38903925        if 'Pawley ref' in data:
    38913926            PawleyPeaks = data['Pawley ref']                       
     
    39063941            G2frame.PawleyRefl.SetMargins(0,0)
    39073942            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()
    39093947                   
    39103948    def OnPawleyLoad(event):
     
    40534091            G2plt.PlotStructure(G2frame,data)                   
    40544092           
    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()
    40564097        G2frame.dataFrame.SetStatusText('')
    40574098        if 'Map Peaks' in data:
     
    43284369        event.Skip()
    43294370
     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
    43304376    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
    43314381        page = event.GetSelection()
    43324382        text = G2frame.dataDisplay.GetPageText(page)
     
    44264476        else:
    44274477            G2gd.SetDataMenuBar(G2frame)
     4478        wx.Frame.Bind(G2frame.dataFrame,wx.EVT_SIZE,OnDataResize) # capture user resize events again
    44284479        event.Skip()
    44294480       
     4481    wx.Frame.Unbind(G2frame.dataFrame,wx.EVT_SIZE) # ignore size events during this routine
    44304482    General = wx.Window(G2frame.dataDisplay)
     4483    # General = wx.ScrolledWindow(G2frame.dataDisplay) # would like to change to this
    44314484    G2frame.dataDisplay.AddPage(General,'General')
    44324485    DData = wx.ScrolledWindow(G2frame.dataDisplay)
     
    44544507
    44554508    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   
    44574512    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:
    44594520        G2frame.dataDisplay.SetSelection(oldPage)
    44604521    else:
    44614522        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.