Changeset 21


Ignore:
Timestamp:
Jan 29, 2010 9:28:55 AM (12 years ago)
Author:
vondreel
Message:

fixes to image/powder pattern plot events

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r20 r21  
    254254        self.Img = 0
    255255        self.imageDefault = {}
     256        self.PDevent = []
     257        self.IMevent = []
    256258
    257259    def OnSize(self,event):
     
    13451347            self.pdplot.canvas.toolbar.set_history_buttons()
    13461348            self.pdplot.canvas.set_window_title('2D Powder Image')
     1349            if self.PDevent:
     1350                for i in range(len(self.PDevent)):
     1351                    self.pdplot.canvas.mpl_disconnect(self.PDevent[i])
     1352                self.PDevent = []
    13471353        except:
    13481354            self.pdplot = pylab.figure(facecolor='white')
    13491355            self.pdplot.clear()
    13501356            self.pdplot.canvas.set_window_title('2D Powder Image')
    1351             self.pdplot.canvas.mpl_connect('key_press_event', OnImPlotKeyPress)
    1352             self.pdplot.canvas.mpl_connect('motion_notify_event', OnImMotion)
    1353             self.pdplot.canvas.mpl_connect('pick_event', OnImPick)
    1354             self.pdplot.canvas.mpl_connect('button_release_event', OnImRelease)
    13551357            self.NewPlot = True                     #to make sure subsequent 1-D plot will be OK
    13561358            newPlot = True
     1359        if not self.IMevent:
     1360            self.IMevent.append(self.pdplot.canvas.mpl_connect('key_press_event', OnImPlotKeyPress))
     1361            self.IMevent.append(self.pdplot.canvas.mpl_connect('motion_notify_event', OnImMotion))
     1362            self.IMevent.append(self.pdplot.canvas.mpl_connect('pick_event', OnImPick))
     1363            self.IMevent.append(self.pdplot.canvas.mpl_connect('button_release_event', OnImRelease))           
    13571364        PickId = self.PickId
    13581365        ax = self.pdplot.add_subplot(111)
     
    15181525            self.pdplot.canvas.toolbar.set_history_buttons()
    15191526            self.pdplot.canvas.set_window_title('Powder Patterns')
     1527            if self.IMevent:
     1528                for i in range(len(self.IMevent)):
     1529                    self.pdplot.canvas.mpl_disconnect(self.IMevent[i])
     1530                self.IMevent = []
    15201531        except:
    15211532            self.pdplot = pylab.figure(facecolor='white')
    15221533            self.pdplot.clear()
    15231534            self.pdplot.canvas.set_window_title('Powder Patterns')
    1524             self.pdplot.canvas.mpl_connect('key_press_event', OnPlotKeyPress)
    1525             self.pdplot.canvas.mpl_connect('pick_event', OnPick)
    1526             self.pdplot.canvas.mpl_connect('button_release_event', OnRelease)
    1527             self.pdplot.canvas.mpl_connect('motion_notify_event', OnMotion)
    15281535            self.NewPlot = True
     1536        if not self.PDevent:
     1537            self.PDevent.append(self.pdplot.canvas.mpl_connect('key_press_event', OnPlotKeyPress))
     1538            self.PDevent.append(self.pdplot.canvas.mpl_connect('pick_event', OnPick))
     1539            self.PDevent.append(self.pdplot.canvas.mpl_connect('button_release_event', OnRelease))
     1540            self.PDevent.append(self.pdplot.canvas.mpl_connect('motion_notify_event', OnMotion))
    15291541        PickId = self.PickId
    15301542        PatternId = self.PatternId
  • trunk/GSASIIgrid.py

    r20 r21  
    14441444        self.PickId = item
    14451445        data = self.PatternTree.GetItemPyData(item)
    1446         UpdateImageControls(self,data)       
     1446        UpdateImageControls(self,data)
     1447        self.PlotImage()       
    14471448    elif self.PatternTree.GetItemText(item) == 'Peak List':
    14481449        self.PatternId = self.PatternTree.GetItemParent(item)
Note: See TracChangeset for help on using the changeset viewer.