Example #1
0
    def paintEvent(self, event):
        super(InteractiveGRWidget, self).paintEvent(event)
        self._painter.begin(self)
        if self.getMouseSelectionEnabled() and self._tselect:
            p0, p1 = self._tselect
            coords = DeviceCoordConverter(self.dwidth, self.dheight)
            coords.setNDC(p0.x, p0.y)
            p0dc = coords.getDC()
            coords.setNDC(p1.x, p1.y)
            p1dc = coords.getDC()
            if self._getPlotsForPoint(p0):
                rect = QtCore.QRect(QtCore.QPoint(p0dc.x, p0dc.y),
                                    QtCore.QPoint(p1dc.x, p1dc.y)).normalized()
                self._painter.setOpacity(.75)
                self._painter.drawRect(rect)
                self._painter.setOpacity(1.)

        self._painter.end()
Example #2
0
    def paintEvent(self, event):
        super(InteractiveGRWidget, self).paintEvent(event)
        self._painter.begin(self)
        if self.getMouseSelectionEnabled() and self._tselect:
            p0, p1 = self._tselect
            coords = DeviceCoordConverter(self.dwidth, self.dheight)
            coords.setNDC(p0.x, p0.y)
            p0dc = coords.getDC()
            coords.setNDC(p1.x, p1.y)
            p1dc = coords.getDC()
            if self._getPlotsForPoint(p0):
                rect = QtCore.QRect(QtCore.QPoint(p0dc.x, p0dc.y),
                                    QtCore.QPoint(p1dc.x, p1dc.y)).normalized()
                self._painter.setOpacity(.75)
                self._painter.drawRect(rect)
                self._painter.setOpacity(1.)

        self._painter.end()
Example #3
0
 def _roi(self, p0, type, buttons, modifiers):
     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()
             QtGui.QApplication.sendEvent(
                 self,
                 eventObj(type, self.dwidth, self.dheight, p0dc.x, p0dc.y,
                          buttons, modifiers, roi))
Example #4
0
File: base.py Project: j-fu/gr
class MouseLocationEventMeta(EventMeta):

    def __init__(self, type, width, height, x, y, window=None):
        super(MouseLocationEventMeta, self).__init__(type)
        self._coords = DeviceCoordConverter(width, height, window=window)
        self._coords.setDC(x, y)

    def getWindow(self):
        return self._coords.getWindow()

    def getWC(self, viewport):
        return self._coords.getWC(viewport)

    def getNDC(self):
        return self._coords.getNDC()

    def getDC(self):
        return self._coords.getDC()
Example #5
0
File: base.py Project: faroit/gr
class MouseLocationEventMeta(EventMeta):

    def __init__(self, type, width, height, x, y, window=None):
        super(MouseLocationEventMeta, self).__init__(type)
        self._coords = DeviceCoordConverter(width, height, window=window)
        self._coords.setDC(x, y)

    def getWindow(self):
        return self._coords.getWindow()

    def getWC(self, viewport):
        return self._coords.getWC(viewport)

    def getNDC(self):
        return self._coords.getNDC()

    def getDC(self):
        return self._coords.getDC()
Example #6
0
 def _roi(self, p0, type, buttons, modifiers):
     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()
             QtGui.QApplication.sendEvent(self,
                                          eventObj(type,
                                                   self.dwidth,
                                                   self.dheight,
                                                   p0dc.x, p0dc.y,
                                                   buttons, modifiers,
                                                   roi))