Changeset 2502


Ignore:
Timestamp:
Oct 23, 2016 8:05:59 PM (5 years ago)
Author:
toby
Message:

prevent double-draw of data window after refinements

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2498 r2502  
    24132413        self.LastExportDir = None  # the last directory used for exports, if any.
    24142414        self.dataDisplayPhaseText = ''
     2415        self.lastTreeSetting = []
    24152416       
    24162417        arg = sys.argv
     
    38143815        #GSASIIpath.IPyBreak()
    38153816       
    3816     def ReloadTreeSetting(self):
    3817         'Reload the last tree setting, triggering the routine to redraw the data window and possibly a plot'
     3817    def TestResetPlot(self,event):
     3818        '''Debug code to test cleaning up plots after a refinement'''
     3819        #for i in range(self.G2plotNB.nb.GetPageCount()):
     3820        #    [self.G2plotNB.nb.GetPageText(i)
     3821        # save current tree item and (if needed) atoms tab
     3822        self.SaveTreeSetting()
     3823        self.ResetPlots()
     3824       
     3825    def ResetPlots(self):
     3826        '''This reloads the current tree item, often drawing a plot. It refreshes any plots
     3827        that have registered a refresh routine (see G2plotNB.RegisterRedrawRoutine)
     3828        and deletes all plots that have not been refreshed and
     3829        require one (see G2plotNB.SetNoDelete).
     3830        '''
     3831        lastRaisedPlotTab = self.G2plotNB.lastRaisedPlotTab # save the last page saved
     3832        #print 'lastRaisedPlotTab=',lastRaisedPlotTab
     3833        self.G2plotNB.lastRaisedPlotTab = None
     3834        # mark displayed plots as invalid
     3835        for lbl,frame in zip(self.G2plotNB.plotList,self.G2plotNB.panelList):
     3836            frame.plotInvalid = True
     3837        # reload current tree item, triggering the routine to redraw the data window and possibly a plot
    38183838        #oldPath,tabId = self.lastTreeSetting
    38193839        oldPath = self.lastTreeSetting
     
    38253845            self.PickId = Id
    38263846            self.PatternTree.SelectItem(Id)
    3827             G2gd.MovePatternTreeToGrid(self,Id) # reload current tree item
    3828            
    3829     def TestResetPlot(self,event):
    3830         '''Debug code to test cleaning up plots after a refinement'''
    3831         #for i in range(self.G2plotNB.nb.GetPageCount()):
    3832         #    [self.G2plotNB.nb.GetPageText(i)
    3833         # save current tree item and (if needed) atoms tab
    3834         self.SaveTreeSetting()
    3835         self.ResetPlots()
    3836        
    3837     def ResetPlots(self):
    3838         '''This reloads the current tree item, often drawing a plot. It refreshes any plots
    3839         that have registered a refresh routine (see G2plotNB.RegisterRedrawRoutine)
    3840         and deletes all plots that have not been refreshed and
    3841         require one (see G2plotNB.SetNoDelete).
    3842         '''
    3843         lastRaisedPlotTab = self.G2plotNB.lastRaisedPlotTab # save the last page saved
    3844         #print 'lastRaisedPlotTab=',lastRaisedPlotTab
    3845         self.G2plotNB.lastRaisedPlotTab = None
    3846         # mark displayed plots as invalid
    3847         for lbl,frame in zip(self.G2plotNB.plotList,self.G2plotNB.panelList):
    3848             frame.plotInvalid = True
    3849         # reload current tree item
    3850         self.ReloadTreeSetting()
    3851         treeItemPlot = self.G2plotNB.lastRaisedPlotTab
     3847            #G2gd.MovePatternTreeToGrid(self,Id) # fails on Mac -- SelectItem already calls MovePatternTreeToGrid; double call fails to complete properly
    38523848        # update other self-updating plots
    38533849        for lbl,frame in zip(self.G2plotNB.plotList,self.G2plotNB.panelList):
     
    38583854            if frame.plotInvalid and frame.plotRequiresRedraw:
    38593855                self.G2plotNB.Delete(lbl)
    3860             #     print('deleting '+lbl) # debug code
    3861             # elif not frame.plotInvalid: # debug code
    3862             #     print(lbl+ ' was redrawn') # debug code
    38633856        # put the previously last-raised tab on top, if present. If not, use the one corresponding to
    38643857        # the last tree item to be selected
    3865         wx.CallAfter(self.G2plotNB.RaiseLastPage,lastRaisedPlotTab,treeItemPlot)
     3858        wx.CallAfter(self.G2plotNB.RaiseLastPage,lastRaisedPlotTab,self.G2plotNB.lastRaisedPlotTab)
    38663859       
    38673860    def OnSeqRefine(self,event):
     
    39143907                    Id = G2gd.GetPatternTreeItemId(self,self.root,'Sequential results')
    39153908                    self.PatternTree.SelectItem(Id)
    3916                     G2gd.MovePatternTreeToGrid(self,Id) # reload current tree item, should update current plot
     3909                    #G2gd.MovePatternTreeToGrid(self,Id) # fails on Mac -- SelectItem already calls MovePatternTreeToGrid; double call fails to complete properly
    39173910            finally:
    39183911                dlg.Destroy()
  • trunk/GSASIIgrid.py

    r2500 r2502  
    42484248
    42494249def MovePatternTreeToGrid(G2frame,item):
    4250     '''Called from GSASII.OnPatternTreeSelChanged when a item is selected on the tree
     4250    '''Called from :meth:`GSASII.GSASII.OnPatternTreeSelChanged` when a item is selected on the tree.
     4251    Also called from GSASII.OnPatternTreeEndDrag, OnAddPhase -- might be better to select item, triggering
     4252    the the bind to MovePatternTreeToGrid
     4253
     4254    Also Called in GSASIIphsGUI.UpdatePhaseData by OnTransform callback.
    42514255    '''
    42524256    pickName = G2frame.PatternTree.GetItemText(item)
Note: See TracChangeset for help on using the changeset viewer.