Skip to content

Commit e2bad35

Browse files
committed
Fixed remaining PySide2-related blocking issues
1 parent f50cde2 commit e2bad35

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

qwt/null_paintdevice.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"""
1515

1616
from qtpy.QtGui import QPaintEngine, QPainterPath, QPaintDevice
17+
from qtpy import PYSIDE2
1718

1819

1920
class QwtNullPaintDevice_PrivateData(object):
@@ -58,7 +59,7 @@ def drawLines(self, lines, lineCount=None):
5859
device = self.nullDevice()
5960
if device is None:
6061
return
61-
if device.mode() != QwtNullPaintDevice.NormalMode:
62+
if device.mode() != QwtNullPaintDevice.NormalMode and not PYSIDE2:
6263
try:
6364
QPaintEngine.drawLines(lines, lineCount)
6465
except TypeError:

qwt/plot_curve.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,21 @@ def series_to_polyline(xMap, yMap, series, from_, to):
6060
"""
6161
Convert series data to QPolygon(F) polyline
6262
"""
63+
xData = xMap.transform(series.xData()[from_ : to + 1])
64+
yData = yMap.transform(series.yData()[from_ : to + 1])
6365
size = to - from_ + 1
64-
polyline = QPolygonF(size)
65-
if not PYSIDE2:
66+
if PYSIDE2:
67+
polyline = QPolygonF()
68+
for index in range(size):
69+
polyline.append(QPointF(xData[index], yData[index]))
70+
else:
71+
polyline = QPolygonF(size)
6672
pointer = polyline.data()
6773
dtype, tinfo = np.float, np.finfo # integers: = np.int, np.iinfo
6874
pointer.setsize(2 * polyline.size() * tinfo(dtype).dtype.itemsize)
6975
memory = np.frombuffer(pointer, dtype)
70-
memory[: (to - from_) * 2 + 1 : 2] = xMap.transform(
71-
series.xData()[from_ : to + 1]
72-
)
73-
memory[1 : (to - from_) * 2 + 2 : 2] = yMap.transform(
74-
series.yData()[from_ : to + 1]
75-
)
76-
else:
77-
polyline.clear()
78-
for index in range(size):
79-
polyline.append(
80-
QPointF(
81-
xMap.transform(series.xData()[index]),
82-
yMap.transform(series.yData()[index]),
83-
)
84-
)
76+
memory[: (to - from_) * 2 + 1 : 2] = xData
77+
memory[1 : (to - from_) * 2 + 2 : 2] = yData
8578
return polyline
8679

8780

0 commit comments

Comments
 (0)