Exemple #1
0
 def _pick(self, p0, type):
     for plot in self._getPlotsForPoint(p0):
         (coord, _axes, _curve) = plot.pick(p0, self.dwidth, self.dheight)
         if coord:
             dcPoint = coord.getDC()
             QApplication.sendEvent(
                 self,
                 PickEvent(type, self.dwidth, self.dheight, dcPoint.x,
                           dcPoint.y, plot.viewport, coord.getWindow()))
Exemple #2
0
 def _pick(self, p0, type):
     for plot in self._getPlotsForPoint(p0):
         (coord, _axes, _curve) = plot.pick(p0, self.dwidth, self.dheight)
         if coord:
             dcPoint = coord.getDC()
             QApplication.sendEvent(self, PickEvent(type,
                                                          self.dwidth,
                                                          self.dheight,
                                                          dcPoint.x,
                                                          dcPoint.y,
                                                          plot.viewport,
                                                          coord.getWindow()))
Exemple #3
0
 def _roi(self, p0, type, buttons, modifiers):
     if self._roiEnabled:
         for plot in self._lstPlot:
             roi = plot.getROI(p0)
             if roi:
                 if roi.regionType == RegionOfInterest.LEGEND:
                     eventObj = LegendEvent
                 else:
                     eventObj = ROIEvent
                 coords = DeviceCoordConverter(self.dwidth, self.dheight)
                 coords.setNDC(p0.x, p0.y)
                 p0dc = coords.getDC()
                 QApplication.sendEvent(
                     self,
                     eventObj(type, self.dwidth, self.dheight, p0dc.x,
                              p0dc.y, buttons, modifiers, roi))
Exemple #4
0
 def _roi(self, p0, type, buttons, modifiers):
     if self._roiEnabled:
         for plot in self._lstPlot:
             roi = plot.getROI(p0)
             if roi:
                 if roi.regionType == RegionOfInterest.LEGEND:
                     eventObj = LegendEvent
                 else:
                     eventObj = ROIEvent
                 coords = DeviceCoordConverter(self.dwidth, self.dheight)
                 coords.setNDC(p0.x, p0.y)
                 p0dc = coords.getDC()
                 QApplication.sendEvent(self,
                                              eventObj(type,
                                                       self.dwidth,
                                                       self.dheight,
                                                       p0dc.x, p0dc.y,
                                                       buttons, modifiers,
                                                       roi))
Exemple #5
0
            # delta percent
            dpercent = event.getSteps() * .1
            self._zoom(dpercent, event.getNDC())

    def pickMove(self, event):
        self._pickEvent = event
        self.update()


if __name__ == "__main__":
    import sys
    from gr import pygr
    logging.basicConfig(level=logging.CRITICAL)
    for name in [__name__, pygr.base.__name__, pygr.__name__]:
        logging.getLogger(name).setLevel(logging.DEBUG)
    app = QApplication(sys.argv)
    grw = InteractiveGRWidget()
    grw.resize(QtCore.QSize(500, 500))
    viewport = [0.1, 0.45, 0.1, 0.88]
    vp2 = [.6, .95, .1, .88]

    x = [-3.3 + t * .1 for t in range(66)]
    y = [t ** 5 - 13 * t ** 3 + 36 * t for t in x]

    n = 100
    pi2_n = 2.*math.pi / n
    x2 = [i * pi2_n for i in range(0, n + 1)]
    y2 = map(lambda xi: math.sin(xi), x2)

    plot = Plot(viewport).addAxes(PlotAxes(viewport).plot(x, y),
                                  PlotAxes(viewport).plot(x2, y2))
Exemple #6
0
            # delta percent
            dpercent = event.getSteps() * .1
            self._zoom(dpercent, event.getNDC())

    def pickMove(self, event):
        self._pickEvent = event
        self.update()


if __name__ == "__main__":
    import sys
    from gr import pygr
    logging.basicConfig(level=logging.CRITICAL)
    for name in [__name__, pygr.base.__name__, pygr.__name__]:
        logging.getLogger(name).setLevel(logging.DEBUG)
    app = QApplication(sys.argv)
    grw = InteractiveGRWidget()
    grw.resize(QtCore.QSize(500, 500))
    viewport = [0.1, 0.45, 0.1, 0.88]
    vp2 = [.6, .95, .1, .88]

    x = [-3.3 + t * .1 for t in range(66)]
    y = [t ** 5 - 13 * t ** 3 + 36 * t for t in x]

    n = 100
    pi2_n = 2.*math.pi / n
    x2 = [i * pi2_n for i in range(0, n + 1)]
    y2 = map(lambda xi: math.sin(xi), x2)

    plot = Plot(viewport).addAxes(PlotAxes(viewport).plot(x, y),
                                  PlotAxes(viewport).plot(x2, y2))