Changeset 4648


Ignore:
Timestamp:
Nov 4, 2020 3:27:00 PM (12 months ago)
Author:
vondreele
Message:

replace _active with AnyActive? & GetActive? in GSASIItoolbar.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r4646 r4648  
    707707            wx.CallAfter(*self.updateActions)
    708708        Toolbar._update_view(self)
     709       
     710    def AnyActive(self):
     711        for Itool in range(self.GetToolsCount()):
     712            if self.GetToolState(self.GetToolByPos(Itool).GetId()):
     713                return True
     714        return False
     715   
     716    def GetActive(self):
     717        for Itool in range(self.GetToolsCount()):
     718            tool = self.GetToolByPos(Itool)
     719            if self.GetToolState(tool.GetId()):
     720                return tool.GetLabel()
     721        return None
    709722
    710723    def OnArrow(self,event):
     
    800813        or None if neither
    801814        """
    802         return self._active
     815        return self.GetActive()
    803816
    804817    def reset_zoompan(self):
     
    839852               
    840853def SetCursor(page):
    841     mode = page.toolbar._active
    842     if mode == 'PAN':
     854    mode = page.toolbar.GetActive()
     855    if mode == 'Pan':
    843856        if 'phoenix' in wx.version():
    844857            page.canvas.Cursor = wx.Cursor(wx.CURSOR_SIZING)
    845858        else:
    846859            page.canvas.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))
    847     elif mode == 'ZOOM':
     860    elif mode == 'Zoom':
    848861        if 'phoenix' in wx.version():
    849862            page.canvas.Cursor = wx.Cursor(wx.CURSOR_MAGNIFIER)
     
    23262339        PickId = G2frame.PickId                             # points to item in tree
    23272340        if G2frame.GPXtree.GetItemText(PickId) == 'Background' and event.xdata:
    2328             if Page.toolbar._active:    # prevent ops. if a toolbar zoom button pressed
     2341            if Page.toolbar.AnyActive():    # prevent ops. if a toolbar zoom button pressed
    23292342                # after any mouse release event (could be a zoom), redraw magnification lines
    23302343                if magLineList: wx.CallAfter(PlotPatterns,G2frame,plotType=plottype,extraKeys=extraKeys)
     
    50755088                   
    50765089    def OnPress(event):
    5077         if Page.toolbar._active:    # prevent ops. if a toolbar zoom button pressed
     5090        if Page.toolbar.AnyActive():    # prevent ops. if a toolbar zoom button pressed
    50785091            return
    50795092        xpos,ypos = event.xdata,event.ydata
     
    73907403                return
    73917404            Ypos = event.ydata
    7392             if Ypos and not Page.toolbar._active:         #make sure zoom/pan not selected
     7405            if Ypos and not Page.toolbar.AnyActive():         #make sure zoom/pan not selected
    73937406                if event.button == 1:
    73947407                    Xpix = Xpos*scalex
     
    74227435            # nothing being dragged, create a new mask
    74237436            Xpos,Ypos = [event.xdata,event.ydata]
    7424             if not Xpos or not Ypos or Page.toolbar._active:  #got point out of frame or zoom/pan selected
     7437            if not Xpos or not Ypos or Page.toolbar.AnyActive():  #got point out of frame or zoom/pan selected
    74257438                return
    74267439            if G2frame.MaskKey == 's':
     
    75257538        elif treeItem == 'Stress/Strain' and G2frame.StrainKey:
    75267539            Xpos,Ypos = [event.xdata,event.ydata]
    7527             if not Xpos or not Ypos or Page.toolbar._active:  #got point out of frame or zoom/pan selected
     7540            if not Xpos or not Ypos or Page.toolbar.AnyActive():  #got point out of frame or zoom/pan selected
    75287541                return
    75297542            dsp = G2img.GetDsp(Xpos,Ypos,Data)
     
    75407553        else:   # start here after dragging of integration range lines or a mask
    75417554            Xpos,Ypos = [event.xdata,event.ydata]
    7542             if not Xpos or not Ypos or Page.toolbar._active:  #got point out of frame or zoom/pan selected
     7555            if not Xpos or not Ypos or Page.toolbar.AnyActive():  #got point out of frame or zoom/pan selected
    75437556                return
    75447557            tth,azm,dsp = G2img.GetTthAzmDsp(Xpos,Ypos,Data)[:3]
Note: See TracChangeset for help on using the changeset viewer.