Changeset 2107 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Dec 24, 2015 2:15:40 PM (7 years ago)
Author:
toby
Message:

Bug fix: 6. After changing mask input plot is redrawn reseting limits and sometimes with two scale bars.; zoom is fixed, reason for two scale bars is unclear, but I am taking a guess that recursive calls to PlotImage? could be the problem, wx.CallAfter? added to these.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r2106 r2107  
    35673567
    35683568    :param wx.Frame G2frame: The main GSAS-II tree "window"
    3569     :param str eventkey: a single letter ('f' or 'p') that
     3569    :param str eventkey: a single letter ('f' or 'p', etc.) that
    35703570      determines what type of mask is created.   
    35713571    '''
     
    36003600    '''Plot of 2D detector images as contoured plot. Also plot calibration ellipses,
    36013601    masks, etc.
     3602
     3603    :param wx.Frame G2frame: main GSAS-II frame
     3604    :param bool newPlot: if newPlot is True, the plot is reset (zoomed out, etc.)
     3605    :param event: matplotlib mouse event (or None)
     3606    :param bool newImage: If True, the Figure is cleared and redrawn
    36023607    '''
    36033608    from matplotlib.patches import Ellipse,Arc,Circle,Polygon
     
    36703675                G2frame.MaskKey = event.key
    36713676                OnStartMask(G2frame)
    3672                 PlotImage(G2frame,newPlot=False)
     3677                wx.CallAfter(PlotImage,G2frame,newImage=False)
    36733678               
    36743679        elif PickName == 'Stress/Strain':
     
    36763681                G2frame.StrainKey = event.key
    36773682                StrSta = OnStartNewDzero(G2frame)
    3678                 PlotImage(G2frame,newPlot=False)
     3683                wx.CallAfter(PlotImage,G2frame,newImage=False)
    36793684               
    36803685        elif PickName == 'Image Controls':
     
    36913696                        Data['center'] = [Xpos,Ypos]
    36923697                        G2imG.UpdateImageControls(G2frame,Data,Masks)
    3693                         PlotImage(G2frame,newPlot=False)
     3698                        wx.CallAfter(PlotImage,G2frame,newPlot=False)
    36943699                finally:
    36953700                    dlg.Destroy()
     
    37013706            elif event.key in ['y',]:
    37023707                Data['invert_y'] = not Data['invert_y']
    3703             PlotImage(G2frame,newPlot=True)
     3708            wx.CallAfter(PlotImage,G2frame,newPlot=True)
    37043709           
    37053710    def OnKeyBox(event):
     
    37583763                    G2imG.UpdateImageControls(G2frame,Data,Masks)
    37593764                    return
    3760                 PlotImage(G2frame,newImage=False)
     3765                wx.CallAfter(PlotImage,G2frame,newImage=False)
    37613766            return
    37623767        elif G2frame.MaskKey and PickName == 'Masks':
     
    37973802                    frame.append([Xpos,Ypos])
    37983803            G2imG.UpdateMasks(G2frame,Masks)
    3799             PlotImage(G2frame,newImage=False)
     3804            wx.CallAfter(PlotImage,G2frame,newImage=False)
    38003805        elif PickName == 'Stress/Strain' and G2frame.StrainKey:
    38013806            Xpos,Ypos = [event.xdata,event.ydata]
     
    38133818            G2imG.UpdateStressStrain(G2frame,StrSta)
    38143819            PlotStrain(G2frame,StrSta)
    3815             PlotImage(G2frame,newPlot=False)           
     3820            wx.CallAfter(PlotImage,G2frame,newPlot=False)           
    38163821        else:
    38173822            Xpos,Ypos = [event.xdata,event.ydata]
     
    39073912#                else:                  #keep for future debugging
    39083913#                    print str(G2frame.itemPicked),event.xdata,event.ydata,event.button
    3909             PlotImage(G2frame,newImage=True)
     3914            wx.CallAfter(PlotImage,G2frame,newImage=True)
    39103915            G2frame.itemPicked = None
    39113916           
     
    39994004    wx.BeginBusyCursor()
    40004005    try:
    4001            
    40024006        if newImage:                   
    40034007            Imin,Imax = Data['range'][1]
Note: See TracChangeset for help on using the changeset viewer.