Skip to content

Commit

Permalink
QwtPainter: removed unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Oct 30, 2023
1 parent 973f276 commit a1406d2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 42 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ and [ImagePlotDemo.py](qwt/tests/ImagePlotDemo.py)
implemented (fitting, rounding, weeding out points, clipping, etc.)
- Added `QwtScaleDraw.setLabelAutoSize`/`labelAutoSize` methods to set the new
auto size option (see [documentation](http://pythonhosted.org/PythonQwt/))
- `QwtPainter`: removed unused methods `drawRoundFrame`, `drawImage` and `drawPixmap`

## Version 0.4.0

Expand Down
40 changes: 0 additions & 40 deletions qwt/painter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ def qwtFillRect(widget, painter, rect, brush):
class QwtPainterClass(object):
"""A collection of `QPainter` workarounds"""

def drawImage(self, painter, rect, image):
painter.drawImage(rect, image)

def drawPixmap(self, painter, rect, pixmap):
painter.drawPixmap(rect, pixmap)

def drawFocusRect(self, *args):
if len(args) == 2:
painter, widget = args
Expand All @@ -91,40 +85,6 @@ def drawFocusRect(self, *args):
"(s) (%s given)" % len(args)
)

def drawRoundFrame(self, painter, rect, palette, lineWidth, frameStyle):
"""
Draw a round frame
:param QPainter painter: Painter
:param QRectF rect: Target rectangle
:param QPalette palette: `QPalette.WindowText` is used for plain borders, `QPalette.Dark` and `QPalette.Light` for raised or sunken borders
:param int lineWidth: Line width
:param int frameStyle: bitwise OR´ed value of `QFrame.Shape` and `QFrame.Shadow`
"""
Plain, Sunken, Raised = list(range(3))
style = Plain
if (frameStyle & QFrame.Sunken) == QFrame.Sunken:
style = Sunken
elif (frameStyle & QFrame.Raised) == QFrame.Raised:
style = Raised
lw2 = 0.5 * lineWidth
r = rect.adjusted(lw2, lw2, -lw2, -lw2)
if style != Plain:
c1 = palette.color(QPalette.Light)
c2 = palette.color(QPalette.Dark)
if style == Sunken:
c1, c2 = c2, c1
gradient = QLinearGradient(r.topLeft(), r.bottomRight())
gradient.setColorAt(0.0, c1)
gradient.setColorAt(1.0, c2)
brush = QBrush(gradient)
else:
brush = palette.brush(QPalette.WindowText)
painter.save()
painter.setPen(QPen(brush, lineWidth))
painter.drawEllipse(r)
painter.restore()

def drawFrame(
self,
painter,
Expand Down
3 changes: 1 addition & 2 deletions qwt/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from qtpy.QtSvg import QSvgRenderer

from qwt.graphic import QwtGraphic
from qwt.painter import QwtPainter


class QwtTriangle(object):
Expand Down Expand Up @@ -78,7 +77,7 @@ def qwtDrawPixmapSymbols(painter, points, symbol):
painter.resetTransform()
for pos in points:
pos = QPointF(transform.map(pos)) - pinPoint
QwtPainter.drawPixmap(painter, QRect(pos.toPoint(), pm.size()), pm)
painter.drawPixmap(QRect(pos.toPoint(), pm.size()), pm)


def qwtDrawSvgSymbols(painter, points, renderer, symbol):
Expand Down

0 comments on commit a1406d2

Please sign in to comment.