Fix some warnings

This commit is contained in:
Kenneth Lyons 2020-07-13 21:09:31 -07:00
parent 7a154f74fa
commit b058d032d1
5 changed files with 11 additions and 7 deletions

View File

@ -158,4 +158,4 @@ class Point(QtCore.QPointF):
return Point(self)
def toQPoint(self):
return QtCore.QPoint(*self)
return QtCore.QPoint(int(self[0]), int(self[1]))

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from .Qt import QtCore, QtGui
class ThreadsafeTimer(QtCore.QObject):
@ -23,7 +24,7 @@ class ThreadsafeTimer(QtCore.QObject):
isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread()
if isGuiThread:
#print "start timer", self, "from gui thread"
self.timer.start(timeout)
self.timer.start(int(timeout))
else:
#print "start timer", self, "from remote thread"
self.sigTimerStartRequested.emit(timeout)
@ -38,4 +39,4 @@ class ThreadsafeTimer(QtCore.QObject):
self.sigTimerStopRequested.emit()
def timerFinished(self):
self.timeout.emit()
self.timeout.emit()

View File

@ -367,10 +367,10 @@ def intColor(index, hues=9, values=1, maxValue=255, minValue=150, maxHue=360, mi
indh = ind % hues
indv = ind // hues
if values > 1:
v = minValue + indv * ((maxValue-minValue) / (values-1))
v = minValue + indv * ((maxValue-minValue) // (values-1))
else:
v = maxValue
h = minHue + (indh * (maxHue-minHue)) / hues
h = minHue + (indh * (maxHue-minHue)) // hues
c = QtGui.QColor()
c.setHsv(h, sat, v)

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore, QtTest
from pyqtgraph.tests import mouseDrag, mouseMove
@ -50,10 +51,12 @@ def test_InfiniteLine():
def test_mouseInteraction():
# disable delay of mouse move events because events is called immediately in test
pg.setConfigOption('mouseRateLimit', -1)
plt = pg.plot()
plt.scene().minDragTime = 0 # let us simulate mouse drags very quickly.
vline = plt.addLine(x=0, movable=True)
plt.addItem(vline)
hline = plt.addLine(y=0, movable=True)
hline2 = plt.addLine(y=-1, movable=False)
plt.setXRange(-10, 10)

View File

@ -370,7 +370,7 @@ class GraphicsView(QtGui.QGraphicsView):
def mouseMoveEvent(self, ev):
if self.lastMousePos is None:
self.lastMousePos = Point(ev.pos())
delta = Point(ev.pos() - QtCore.QPoint(*self.lastMousePos))
delta = Point(ev.pos() - self.lastMousePos.toQPoint())
self.lastMousePos = Point(ev.pos())
QtGui.QGraphicsView.mouseMoveEvent(self, ev)