Changeset 2246


Ignore:
Timestamp:
May 10, 2016 9:51:51 AM (6 years ago)
Author:
vondreele
Message:

trap another Id=0 problem after Refine finishes (G2.py)
rearrange routines in G2plot; refactor OnPageChanged? to allow (currently commented out) diagnostic prints. "fix" flashing problem by commenting out self.skipPageChange = False line.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2244 r2246  
    36803680                        Id = G2gd.GetPatternTreeItemId(self, Id, txt)
    36813681                    self.PickIdText = None  #force reload of page
    3682                     self.PickId = Id
    3683                     self.PatternTree.SelectItem(Id)
    3684                     G2gd.MovePatternTreeToGrid(self,Id) # reload current tree item, should update current plot
     3682                    if Id:
     3683                        self.PickId = Id
     3684                        self.PatternTree.SelectItem(Id)
     3685                        G2gd.MovePatternTreeToGrid(self,Id) # reload current tree item, should update current plot
    36853686            finally:
    36863687                dlg2.Destroy()
  • trunk/GSASIIplot.py

    r2242 r2246  
    190190            self.treeItem[plotLabel][1] = self.G2frame.dataDisplayPhaseText
    191191               
    192     def RaisePageNoRefresh(self,Page):
    193         'Raises a plot tab without triggering a refresh via OnPageChanged'
    194         self.skipPageChange = True
    195         Page.SetFocus()
    196         self.skipPageChange = False
    197        
    198     def SetSelectionNoRefresh(self,plotNum):
    199         'Raises a plot tab without triggering a refresh via OnPageChanged'
    200         self.skipPageChange = True
    201         self.nb.SetSelection(plotNum) # raises plot tab
    202         Page = self.G2frame.G2plotNB.nb.GetPage(plotNum)
    203         Page.SetFocus()
    204         self.skipPageChange = False
    205                                  
    206192    def addMpl(self,name=""):
    207193        'Add a tabbed page with a matplotlib plot'
     
    252238            return     
    253239       
     240    def RaisePageNoRefresh(self,Page):
     241        'Raises a plot tab without triggering a refresh via OnPageChanged'
     242#        print 'Raise',str(self).split('0x')[1]
     243        self.skipPageChange = True
     244        Page.SetFocus()
     245        self.skipPageChange = False
     246       
     247    def SetSelectionNoRefresh(self,plotNum):
     248        'Raises a plot tab without triggering a refresh via OnPageChanged'
     249#        print 'Select',str(self).split('0x')[1]
     250        self.skipPageChange = True
     251        self.nb.SetSelection(plotNum) # raises plot tab
     252        Page = self.G2frame.G2plotNB.nb.GetPage(plotNum)
     253        Page.SetFocus()
     254        self.skipPageChange = False
     255                                 
    254256    def OnPageChanged(self,event):
    255257        '''respond to someone pressing a tab on the plot window.
     
    259261        repeated replotting.
    260262        '''
     263        tabLabel = event.GetEventObject().GetPageText(event.GetSelection())
     264#        print 'PageChanged, self=',str(self).split('0x')[1],tabLabel,self.skipPageChange
     265#        print 'event type=',event.GetEventType()
    261266        self.status.DestroyChildren()    #get rid of special stuff on status bar
    262267        self.status.SetFields(['',''])  # clear old status message
    263268        self.status.SetStatusWidths([150,-1])
    264269        if self.skipPageChange:
    265             self.skipPageChange = False
     270#            self.skipPageChange = False
     271#            if tabLabel in self.treeItem:
     272#                del self.treeItem[tabLabel]
    266273            return
    267274        page = self.panelList[self.nb.GetSelection()]   #GetCurrentPage() not in wx 2.7
    268         tabLabel = event.GetEventObject().GetPageText(event.GetSelection())
    269275        if tabLabel in self.treeItem:
    270276            treeItems, tabname = self.treeItem[tabLabel]
    271             id = self.G2frame.root
     277            pid = self.G2frame.root
    272278            for item in treeItems:
    273                 id = G2gd.GetPatternTreeItemId(self.G2frame, id, item)
    274             wx.CallLater(100,self.InvokeTreeItem,id)
     279                pid = G2gd.GetPatternTreeItemId(self.G2frame, pid, item)
     280            wx.CallLater(100,self.InvokeTreeItem,pid)
    275281        else:
    276282            print 'OnPageChanged: not found:',tabLabel
    277283           
    278     def InvokeTreeItem(self,id):
     284    def InvokeTreeItem(self,pid):
    279285        '''This is called to select an item from the tree using the self.allowZoomReset
    280286        flag to prevent a reset to the zoom of the plot (where implemented)
    281287        '''
    282288        self.allowZoomReset = False
    283         if id: self.G2frame.PatternTree.SelectItem(id)
    284         self.allowZoomReset = True
     289        if pid: self.G2frame.PatternTree.SelectItem(pid)
     290        self.allowZoomReset = True
     291 #       print 'invoke',str(self).split('0x')[1]
    285292           
    286293class GSASIItoolbar(Toolbar):
Note: See TracChangeset for help on using the changeset viewer.