Changeset 5525


Ignore:
Timestamp:
Mar 28, 2023 12:43:23 PM (6 months ago)
Author:
toby
Message:

properly delete phase tab contents before refilling, but keeping Grids that will be reused

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r5523 r5525  
    35653565                Atoms.SetReadOnly(row,colSS+1,True)                       #Mult
    35663566            oldSizer = AtomList.GetSizer()
    3567             if oldSizer: oldSizer.Clear()  # get rid of the old sizer, if repeated call
     3567            if oldSizer:  # 2nd+ use, clear out old entries
     3568                for i in oldSizer.GetChildren(): # look for grids in sizer
     3569                    if type(i.GetWindow()) is G2G.GSGrid:
     3570                        oldSizer.Detach(i.GetWindow())  # don't delete them
     3571                oldSizer.Clear(True)
    35683572            Atoms.AutoSizeColumns(False)
    35693573            mainSizer = wx.BoxSizer(wx.VERTICAL)
     
    91669170        G2frame.GetStatusBar().SetStatusText('',1)
    91679171        oldSizer = drawAtomsList.GetSizer()
    9168         if oldSizer:
    9169             oldSizer.Clear()  # get rid of the old sizer, if repeated call
     9172        if oldSizer: # 2nd+ use, clear out old entries
     9173            for i in oldSizer.GetChildren(): # look for grids in sizer
     9174                if type(i.GetWindow()) is G2G.GSGrid:
     9175                    oldSizer.Detach(i.GetWindow())  # don't delete them
     9176            oldSizer.Clear(True)
    91709177        generalData = data['General']
    91719178        SetupDrawingData()
     
    1421214219        G2frame.GetStatusBar().SetStatusText('',1)
    1421314220        oldSizer = MapPeakList.GetSizer()
    14214         if oldSizer: oldSizer.Clear()
     14221        if oldSizer: # 2nd+ use, clear out old entries
     14222            for i in oldSizer.GetChildren(): # look for grids in sizer
     14223                if type(i.GetWindow()) is G2G.GSGrid:
     14224                    oldSizer.Detach(i.GetWindow())  # don't delete them
     14225            oldSizer.Clear(True)
    1421514226        mainSizer = wx.BoxSizer(wx.VERTICAL)
    1421614227        topSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    1471814729       
    1471914730    def ChangePage(page):
    14720         for p in G2frame.phaseDisplay.gridList: # clear out all grids, forcing edits in progress to complete
    14721             p.ClearGrid()
     14731        newlist = []
     14732        # force edits in open grids to complete
     14733        for p in G2frame.phaseDisplay.gridList:
     14734            if not p: continue   # skip deleted grids
     14735            try:
     14736                p.ClearGrid()
     14737                newlist.append(p)
     14738            except:
     14739                pass
     14740        G2frame.phaseDisplay.gridList = newlist  # remove deleted grids from list
    1472214741        text = G2frame.phaseDisplay.GetPageText(page)
    1472314742        G2frame.lastSelectedPhaseTab = text
     
    1506315082       
    1506415083    MapPeakList = wx.ScrolledWindow(G2frame.phaseDisplay)   
     15084    G2frame.phaseDisplay.AddPage(MapPeakList,'Map peaks')
     15085    # create the grid once; N.B. need to reference at this scope
    1506515086    MapPeaks = G2G.GSGrid(MapPeakList)
    1506615087    G2frame.phaseDisplay.gridList.append(MapPeaks)   
    15067     G2frame.phaseDisplay.AddPage(MapPeakList,'Map peaks')
    1506815088   
    1506915089    if data['General']['doDysnomia']:
Note: See TracChangeset for help on using the changeset viewer.