From 6ed8a405feb25dba8511c1f281ae52e0be134f2a Mon Sep 17 00:00:00 2001 From: Ognyan Moore Date: Fri, 28 Feb 2020 14:27:10 -0800 Subject: [PATCH] Address FutureWarning about implicit float to int conversions --- pyqtgraph/graphicsItems/AxisItem.py | 4 ++-- pyqtgraph/graphicsItems/GradientEditorItem.py | 2 +- pyqtgraph/graphicsItems/GridItem.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyqtgraph/graphicsItems/AxisItem.py b/pyqtgraph/graphicsItems/AxisItem.py index da57403f..e97f66d3 100644 --- a/pyqtgraph/graphicsItems/AxisItem.py +++ b/pyqtgraph/graphicsItems/AxisItem.py @@ -921,7 +921,7 @@ class AxisItem(GraphicsWidget): p2[axis] += tickLength*tickDir tickPen = self.pen() color = tickPen.color() - color.setAlpha(lineAlpha) + color.setAlpha(int(lineAlpha)) tickPen.setColor(color) tickSpecs.append((tickPen, Point(p1), Point(p2))) profiler('compute ticks') @@ -1078,7 +1078,7 @@ class AxisItem(GraphicsWidget): p.setFont(self.tickFont) p.setPen(self.textPen()) for rect, flags, text in textSpecs: - p.drawText(rect, flags, text) + p.drawText(rect, flags.__int__(), text) profiler('draw text') diff --git a/pyqtgraph/graphicsItems/GradientEditorItem.py b/pyqtgraph/graphicsItems/GradientEditorItem.py index b360b2f7..1cb11d1c 100644 --- a/pyqtgraph/graphicsItems/GradientEditorItem.py +++ b/pyqtgraph/graphicsItems/GradientEditorItem.py @@ -654,7 +654,7 @@ class GradientEditorItem(TickSliderItem): s = s1 * (1.-f) + s2 * f v = v1 * (1.-f) + v2 * f c = QtGui.QColor() - c.setHsv(h,s,v) + c.setHsv(*map(int, [h,s,v])) if toQColor: return c else: diff --git a/pyqtgraph/graphicsItems/GridItem.py b/pyqtgraph/graphicsItems/GridItem.py index 0b1eb525..db64cbbf 100644 --- a/pyqtgraph/graphicsItems/GridItem.py +++ b/pyqtgraph/graphicsItems/GridItem.py @@ -153,7 +153,7 @@ class GridItem(UIGraphicsItem): continue ppl = dim[ax] / nl[ax] - c = np.clip(5.*(ppl-3), 0., 50.) + c = np.clip(5 * (ppl-3), 0., 50.).astype(int) linePen = self.opts['pen'] lineColor = self.opts['pen'].color()