コード例 #1
0
ファイル: plot_curve.py プロジェクト: petebachant/python-qwt
    def legendIcon(self, index, size):
        if size.isEmpty():
            return QwtGraphic()
        graphic = QwtGraphic()
        graphic.setDefaultSize(size)
        graphic.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
        painter = QPainter(graphic)
        painter.setRenderHint(QPainter.Antialiasing,
                          self.testRenderHint(QwtPlotItem.RenderAntialiased))
        if self.__data.legendAttributes == 0 or\
           (self.__data.legendAttributes & QwtPlotCurve.LegendShowBrush):
            brush = self.__data.brush
            if brush.style() == Qt.NoBrush and self.__data.legendAttributes == 0:
                if self.style() != QwtPlotCurve.NoCurve:
                    brush = QBrush(self.pen().color())
                elif self.__data.symbol and\
                     self.__data.symbol.style() != QwtSymbol.NoSymbol:
                    brush = QBrush(self.__data.symbol.pen().color())
            if brush.style() != Qt.NoBrush:
                r = QRectF(0, 0, size.width(), size.height())
                painter.fillRect(r, brush)
        if self.__data.legendAttributes & QwtPlotCurve.LegendShowLine:
            if self.pen() != Qt.NoPen:
                pn = self.pen()
#                pn.setCapStyle(Qt.FlatCap)
                painter.setPen(pn)
                y = .5*size.height()
                QwtPainter.drawLine(painter, 0., y, size.width(), y)
        if self.__data.legendAttributes & QwtPlotCurve.LegendShowSymbol:
            if self.__data.symbol:
                r = QRectF(0, 0, size.width(), size.height())
                self.__data.symbol.drawSymbol(painter, r)
        return graphic    
コード例 #2
0
ファイル: plot_marker.py プロジェクト: berrosse/PythonQwt
 def legendIcon(self, index, size):
     """
     :param int index: Index of the legend entry (ignored as there is only one)
     :param QSizeF size: Icon size
     :return: Icon representing the marker on the legend
     
     .. seealso::
     
         :py:meth:`qwt.plot.QwtPlotItem.setLegendIconSize()`,
         :py:meth:`qwt.plot.QwtPlotItem.legendData()`
     """
     if size.isEmpty():
         return QwtGraphic()
     icon = QwtGraphic()
     icon.setDefaultSize(size)
     icon.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
     painter = QPainter(icon)
     painter.setRenderHint(QPainter.Antialiasing,
                       self.testRenderHint(QwtPlotItem.RenderAntialiased))
     if self.__data.style != QwtPlotMarker.NoLine:
         painter.setPen(self.__data.pen)
         if self.__data.style in (QwtPlotMarker.HLine, QwtPlotMarker.Cross):
             y = .5*size.height()
             painter.drawLine(0., y, size.width(), y)
         if self.__data.style in (QwtPlotMarker.VLine, QwtPlotMarker.Cross):
             x = .5*size.width()
             painter.drawLine(x, 0., x, size.height())
     if self.__data.symbol:
         r = QRect(0, 0, size.width(), size.height())
         self.__data.symbol.drawSymbol(painter, r)
     return icon
コード例 #3
0
 def defaultIcon(brush, size):
     icon = QwtGraphic()
     if not size.isEmpty():
         icon.setDefaultSize(size)
         r = QRectF(0, 0, size.width(), size.height())
         painter = QPainter(icon)
         painter.fillRect(r, brush)
     return icon
コード例 #4
0
ファイル: symbol.py プロジェクト: gyenney/Tools
def qwtPathGraphic(path, pen, brush):
    graphic = QwtGraphic()
    graphic.setRenderHint(QwtGraphic.RenderPensUnscaled)
    painter = QPainter(graphic)
    painter.setPen(pen)
    painter.setBrush(brush)
    painter.drawPath(path)
    painter.end()
    return graphic
コード例 #5
0
ファイル: symbol.py プロジェクト: gyenney/Tools
def qwtPathGraphic(path, pen, brush):
    graphic = QwtGraphic()
    graphic.setRenderHint(QwtGraphic.RenderPensUnscaled)
    painter = QPainter(graphic)
    painter.setPen(pen)
    painter.setBrush(brush)
    painter.drawPath(path)
    painter.end()
    return graphic
コード例 #6
0
 def legendIcon(self, index, size):
     """
     :param int index: Index of the legend entry (ignored as there is only one)
     :param QSizeF size: Icon size
     :return: Icon representing the marker on the legend
     
     .. seealso::
     
         :py:meth:`qwt.plot.QwtPlotItem.setLegendIconSize()`,
         :py:meth:`qwt.plot.QwtPlotItem.legendData()`
     """
     if size.isEmpty():
         return QwtGraphic()
     icon = QwtGraphic()
     icon.setDefaultSize(size)
     icon.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
     painter = QPainter(icon)
     painter.setRenderHint(
         QPainter.Antialiasing,
         self.testRenderHint(QwtPlotItem.RenderAntialiased))
     if self.__data.style != QwtPlotMarker.NoLine:
         painter.setPen(self.__data.pen)
         if self.__data.style in (QwtPlotMarker.HLine, QwtPlotMarker.Cross):
             y = 0.5 * size.height()
             painter.drawLine(0.0, y, size.width(), y)
         if self.__data.style in (QwtPlotMarker.VLine, QwtPlotMarker.Cross):
             x = 0.5 * size.width()
             painter.drawLine(x, 0.0, x, size.height())
     if self.__data.symbol:
         r = QRect(0, 0, size.width(), size.height())
         self.__data.symbol.drawSymbol(painter, r)
     return icon
コード例 #7
0
 def legendIcon(self, index, size):
     if size.isEmpty():
         return QwtGraphic()
     graphic = QwtGraphic()
     graphic.setDefaultSize(size)
     graphic.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
     painter = QPainter(graphic)
     painter.setRenderHint(
         QPainter.Antialiasing,
         self.testRenderHint(QwtPlotItem.RenderAntialiased))
     if self.__data.legendAttributes == 0 or\
        (self.__data.legendAttributes & QwtPlotCurve.LegendShowBrush):
         brush = self.__data.brush
         if brush.style(
         ) == Qt.NoBrush and self.__data.legendAttributes == 0:
             if self.style() != QwtPlotCurve.NoCurve:
                 brush = QBrush(self.pen().color())
             elif self.__data.symbol and\
                  self.__data.symbol.style() != QwtSymbol.NoSymbol:
                 brush = QBrush(self.__data.symbol.pen().color())
         if brush.style() != Qt.NoBrush:
             r = QRectF(0, 0, size.width(), size.height())
             painter.fillRect(r, brush)
     if self.__data.legendAttributes & QwtPlotCurve.LegendShowLine:
         if self.pen() != Qt.NoPen:
             pn = self.pen()
             #                pn.setCapStyle(Qt.FlatCap)
             painter.setPen(pn)
             y = .5 * size.height()
             QwtPainter.drawLine(painter, 0., y, size.width(), y)
     if self.__data.legendAttributes & QwtPlotCurve.LegendShowSymbol:
         if self.__data.symbol:
             r = QRectF(0, 0, size.width(), size.height())
             self.__data.symbol.drawSymbol(painter, r)
     return graphic
コード例 #8
0
ファイル: plot_curve.py プロジェクト: berrosse/PythonQwt
    def legendIcon(self, index, size):
        """
        :param int index: Index of the legend entry (ignored as there is only one)
        :param QSizeF size: Icon size
        :return: Icon representing the curve on the legend
        
        .. seealso::
        
            :py:meth:`qwt.plot.QwtPlotItem.setLegendIconSize()`,
            :py:meth:`qwt.plot.QwtPlotItem.legendData()`
        """
        if size.isEmpty():
            return QwtGraphic()
        graphic = QwtGraphic()
        graphic.setDefaultSize(size)
        graphic.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
        painter = QPainter(graphic)
        painter.setRenderHint(QPainter.Antialiasing,
                          self.testRenderHint(QwtPlotItem.RenderAntialiased))
        if self.__data.legendAttributes == 0 or\
           (self.__data.legendAttributes & QwtPlotCurve.LegendShowBrush):
            brush = self.__data.brush
            if brush.style() == Qt.NoBrush and self.__data.legendAttributes == 0:
                if self.style() != QwtPlotCurve.NoCurve:
                    brush = QBrush(self.pen().color())
                elif self.__data.symbol and\
                     self.__data.symbol.style() != QwtSymbol.NoSymbol:
                    brush = QBrush(self.__data.symbol.pen().color())
            if brush.style() != Qt.NoBrush:
                r = QRectF(0, 0, size.width(), size.height())
                painter.fillRect(r, brush)
        if self.__data.legendAttributes & QwtPlotCurve.LegendShowLine:
            if self.pen() != Qt.NoPen:
                pn = self.pen()
#                pn.setCapStyle(Qt.FlatCap)
                painter.setPen(pn)
                y = .5*size.height()
                painter.drawLine(0., y, size.width(), y)
        if self.__data.legendAttributes & QwtPlotCurve.LegendShowSymbol:
            if self.__data.symbol:
                r = QRectF(0, 0, size.width(), size.height())
                self.__data.symbol.drawSymbol(painter, r)
        return graphic    
コード例 #9
0
ファイル: plot_marker.py プロジェクト: petebachant/python-qwt
 def legendIcon(self, index, size):
     if size.isEmpty():
         return QwtGraphic()
     icon = QwtGraphic()
     icon.setDefaultSize(size)
     icon.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
     painter = QPainter(icon)
     painter.setRenderHint(QPainter.Antialiasing,
                       self.testRenderHint(QwtPlotItem.RenderAntialiased))
     if self.__data.style != QwtPlotMarker.NoLine:
         painter.setPen(self.__data.pen)
         if self.__data.style in (QwtPlotMarker.HLine, QwtPlotMarker.Cross):
             y = .5*size.height()
             QwtPainter.drawLine(painter, 0., y, size.width(), y)
         if self.__data.style in (QwtPlotMarker.VLine, QwtPlotMarker.Cross):
             x = .5*size.width()
             QwtPainter.drawLine(painter, x, 0., x, size.height())
     if self.__data.symbol:
         r = QRect(0, 0, size.width(), size.height())
         self.__data.symbol.drawSymbol(painter, r)
     return icon
コード例 #10
0
ファイル: plot_curve.py プロジェクト: igrekus/PythonQwt
 def legendIcon(self, index, size):
     """
     :param int index: Index of the legend entry (ignored as there is only one)
     :param QSizeF size: Icon size
     :return: Icon representing the curve on the legend
     
     .. seealso::
     
         :py:meth:`qwt.plot.QwtPlotItem.setLegendIconSize()`,
         :py:meth:`qwt.plot.QwtPlotItem.legendData()`
     """
     if size.isEmpty():
         return QwtGraphic()
     graphic = QwtGraphic()
     graphic.setDefaultSize(size)
     graphic.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
     painter = QPainter(graphic)
     painter.setRenderHint(
         QPainter.Antialiasing,
         self.testRenderHint(QwtPlotItem.RenderAntialiased))
     if self.__data.legendAttributes == 0 or (
             self.__data.legendAttributes & QwtPlotCurve.LegendShowBrush):
         brush = self.__data.brush
         if brush.style(
         ) == Qt.NoBrush and self.__data.legendAttributes == 0:
             if self.style() != QwtPlotCurve.NoCurve:
                 brush = QBrush(self.pen().color())
             elif (self.__data.symbol
                   and self.__data.symbol.style() != QwtSymbol.NoSymbol):
                 brush = QBrush(self.__data.symbol.pen().color())
         if brush.style() != Qt.NoBrush:
             r = QRectF(0, 0, size.width(), size.height())
             painter.fillRect(r, brush)
     if self.__data.legendAttributes & QwtPlotCurve.LegendShowLine:
         if self.pen() != Qt.NoPen:
             pn = self.pen()
             #                pn.setCapStyle(Qt.FlatCap)
             painter.setPen(pn)
             y = 0.5 * size.height()
             painter.drawLine(0.0, y, size.width(), y)
     if self.__data.legendAttributes & QwtPlotCurve.LegendShowSymbol:
         if self.__data.symbol:
             r = QRectF(0, 0, size.width(), size.height())
             self.__data.symbol.drawSymbol(painter, r)
     return graphic
コード例 #11
0
ファイル: plot_marker.py プロジェクト: petebachant/python-qwt
 def legendIcon(self, index, size):
     if size.isEmpty():
         return QwtGraphic()
     icon = QwtGraphic()
     icon.setDefaultSize(size)
     icon.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
     painter = QPainter(icon)
     painter.setRenderHint(
         QPainter.Antialiasing,
         self.testRenderHint(QwtPlotItem.RenderAntialiased))
     if self.__data.style != QwtPlotMarker.NoLine:
         painter.setPen(self.__data.pen)
         if self.__data.style in (QwtPlotMarker.HLine, QwtPlotMarker.Cross):
             y = .5 * size.height()
             QwtPainter.drawLine(painter, 0., y, size.width(), y)
         if self.__data.style in (QwtPlotMarker.VLine, QwtPlotMarker.Cross):
             x = .5 * size.width()
             QwtPainter.drawLine(painter, x, 0., x, size.height())
     if self.__data.symbol:
         r = QRect(0, 0, size.width(), size.height())
         self.__data.symbol.drawSymbol(painter, r)
     return icon
コード例 #12
0
ファイル: symbol.py プロジェクト: gyenney/Tools
 def __init__(self):
     self.graphic = QwtGraphic()
コード例 #13
0
ファイル: symbol.py プロジェクト: gyenney/Tools
 def __init__(self):
     self.path = QPainterPath()
     self.graphic = QwtGraphic()
コード例 #14
0
 def legendIcon(self, index, size):
     return QwtGraphic()