예제 #1
0
파일: PlotView.py 프로젝트: emcnany/deap
    def mouseMotion(self, evt, x, y):
        """
        Completely overrides base class functionality.
        """
        view = self.getView()

        if self.selectedAxes is None:
            axes, xdata, ydata = wxmpl.find_axes(view, x, y)
        else:
            axes = self.selectedAxes
            xdata, ydata = get_data(axes, x, y)

        if self.leftButtonPoint is not None:
            self.selectionMouseMotion(evt, x, y, axes, xdata, ydata)
        else:
            if axes is None:
                self.canvasMouseMotion(evt, x, y)
            elif wxmpl.is_polar(axes):
                self.polarAxesMouseMotion(evt, x, y, axes, xdata, ydata)
            else:
                self.axesMouseMotion(evt, x, y, axes, xdata, ydata)

        if self.IsPanMode() and \
           self.leftButtonPoint and \
           self.getActiveSubplot() is not None:
               self.panTool.pan(x, y, self.getActiveSubplot())
예제 #2
0
파일: PlotView.py 프로젝트: emcnany/deap
    def rightButtonUp(self, evt, x, y):
        """
        Completely overrides base class functionality.
        """
        view = self.getView()

        if self.selectedAxes is None:
            axes, xdata, ydata = wxmpl.find_axes(view, x, y)
        else:
            axes = self.selectedAxes
            xdata, ydata = get_data(axes, x, y)

        self.setActiveSubplot(axes)

        if (axes is not None and self.zoomEnabled and self.rightClickUnzoom
        and self.limits.restore(axes)):
            view.crosshairs.clear()
            view.draw()
            view.crosshairs.set(x, y)

        if self.IsInfoMode() and axes is not None:
            self.DisplayAllSubplots()
            FigureCanvasWxAgg.draw(view)

        if self.IsPanMode() and axes is not None:
            self.panTool.end_pan(x, y, axes)
예제 #3
0
파일: PlotView.py 프로젝트: emcnany/deap
    def leftButtonUp(self, evt, x, y):
        """
        Completely overrides base class functionality.
        """
        if self.leftButtonPoint is None:
            return

        view = self.getView()

        if self.selectedAxes is None:
            axes, xdata, ydata = wxmpl.find_axes(view, x, y)
        else:
            axes = self.selectedAxes
            xdata, ydata = get_data(axes, x, y)

        self.setActiveSubplot(axes)
        self.end_x         = x
        self.end_y         = y

        if self.IsInfoMode() and axes is not None:
            self.SelectAxes(axes)

        x0, y0 = self.leftButtonPoint
        self.leftButtonPoint = None
        view.rubberband.clear()

        if x0 == x:
            if y0 == y and axes is not None:
                view.notify_point(axes, x, y)
                view.crosshairs.set(x, y)
            return
        elif y0 == y:
            return

        xdata = ydata = None
        xrange, yrange = get_selected_data(axes, x0, y0, x, y)

        if axes is not None:
            xdata, ydata = axes.transData.inverse_xy_tup((x, y))
            if self.zoomEnabled:
                if self.limits.set(axes, xrange, yrange):
                    FigureCanvasWxAgg.draw(view)
            else:
                self.getView().notify_selection(axes, x0, y0, x, y)

        if axes is None:
            view.cursor.setNormal()
        elif wxmpl.is_polar(axes):
            view.cursor.setNormal()
            view.location.set(wxmpl.format_coord(axes, xdata, ydata))
        else:
            view.crosshairs.set(x, y)
            view.location.set(wxmpl.format_coord(axes, xdata, ydata))
예제 #4
0
파일: canvasT.py 프로젝트: vpaeder/terapy
 def OnLeftDblClick(self, event):
     """
     
         Actions triggered after double-click on left mouse button on canvas.
         
         Parameters:
             event    -    wx.Event
     
     """
     event.StopPropagation()
     # this implements the goto-cursor-position functionality of the scan stage
     x, y = event.GetPositionTuple() 
     wh = self.GetSize()
     axes = wxmpl.find_axes(self, x, wh[1] - y)    # mirror y coordinates to get proper orientation
     # send position further
     pub.sendMessage("plot.move_axis", data=axes[1]) 
예제 #5
0
파일: PlotView.py 프로젝트: emcnany/deap
    def leftButtonDown(self, evt, x, y):
        """
        Completely overrides base class functionality.
        """
        self.leftButtonPoint = (x, y)

        view = self.getView()

        if self.selectedAxes is None:
            axes, xdata, ydata = wxmpl.find_axes(view, x, y)
        else:
            axes = self.selectedAxes
            xdata, ydata = get_data(axes, x, y)

        self.setActiveSubplot(axes)

        self.panTool.setX(x)
        self.panTool.setY(y)

        if self.selectionEnabled and not wxmpl.is_polar(axes):
            view.cursor.setCross()
            view.crosshairs.clear()