Fix some warnings
This commit is contained in:
parent
7a154f74fa
commit
b058d032d1
@ -158,4 +158,4 @@ class Point(QtCore.QPointF):
|
|||||||
return Point(self)
|
return Point(self)
|
||||||
|
|
||||||
def toQPoint(self):
|
def toQPoint(self):
|
||||||
return QtCore.QPoint(*self)
|
return QtCore.QPoint(int(self[0]), int(self[1]))
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
from .Qt import QtCore, QtGui
|
from .Qt import QtCore, QtGui
|
||||||
|
|
||||||
class ThreadsafeTimer(QtCore.QObject):
|
class ThreadsafeTimer(QtCore.QObject):
|
||||||
@ -23,7 +24,7 @@ class ThreadsafeTimer(QtCore.QObject):
|
|||||||
isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread()
|
isGuiThread = QtCore.QThread.currentThread() == QtCore.QCoreApplication.instance().thread()
|
||||||
if isGuiThread:
|
if isGuiThread:
|
||||||
#print "start timer", self, "from gui thread"
|
#print "start timer", self, "from gui thread"
|
||||||
self.timer.start(timeout)
|
self.timer.start(int(timeout))
|
||||||
else:
|
else:
|
||||||
#print "start timer", self, "from remote thread"
|
#print "start timer", self, "from remote thread"
|
||||||
self.sigTimerStartRequested.emit(timeout)
|
self.sigTimerStartRequested.emit(timeout)
|
||||||
@ -38,4 +39,4 @@ class ThreadsafeTimer(QtCore.QObject):
|
|||||||
self.sigTimerStopRequested.emit()
|
self.sigTimerStopRequested.emit()
|
||||||
|
|
||||||
def timerFinished(self):
|
def timerFinished(self):
|
||||||
self.timeout.emit()
|
self.timeout.emit()
|
||||||
|
@ -367,10 +367,10 @@ def intColor(index, hues=9, values=1, maxValue=255, minValue=150, maxHue=360, mi
|
|||||||
indh = ind % hues
|
indh = ind % hues
|
||||||
indv = ind // hues
|
indv = ind // hues
|
||||||
if values > 1:
|
if values > 1:
|
||||||
v = minValue + indv * ((maxValue-minValue) / (values-1))
|
v = minValue + indv * ((maxValue-minValue) // (values-1))
|
||||||
else:
|
else:
|
||||||
v = maxValue
|
v = maxValue
|
||||||
h = minHue + (indh * (maxHue-minHue)) / hues
|
h = minHue + (indh * (maxHue-minHue)) // hues
|
||||||
|
|
||||||
c = QtGui.QColor()
|
c = QtGui.QColor()
|
||||||
c.setHsv(h, sat, v)
|
c.setHsv(h, sat, v)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
from pyqtgraph.Qt import QtGui, QtCore, QtTest
|
from pyqtgraph.Qt import QtGui, QtCore, QtTest
|
||||||
from pyqtgraph.tests import mouseDrag, mouseMove
|
from pyqtgraph.tests import mouseDrag, mouseMove
|
||||||
@ -50,10 +51,12 @@ def test_InfiniteLine():
|
|||||||
|
|
||||||
|
|
||||||
def test_mouseInteraction():
|
def test_mouseInteraction():
|
||||||
|
# disable delay of mouse move events because events is called immediately in test
|
||||||
|
pg.setConfigOption('mouseRateLimit', -1)
|
||||||
|
|
||||||
plt = pg.plot()
|
plt = pg.plot()
|
||||||
plt.scene().minDragTime = 0 # let us simulate mouse drags very quickly.
|
plt.scene().minDragTime = 0 # let us simulate mouse drags very quickly.
|
||||||
vline = plt.addLine(x=0, movable=True)
|
vline = plt.addLine(x=0, movable=True)
|
||||||
plt.addItem(vline)
|
|
||||||
hline = plt.addLine(y=0, movable=True)
|
hline = plt.addLine(y=0, movable=True)
|
||||||
hline2 = plt.addLine(y=-1, movable=False)
|
hline2 = plt.addLine(y=-1, movable=False)
|
||||||
plt.setXRange(-10, 10)
|
plt.setXRange(-10, 10)
|
||||||
|
@ -370,7 +370,7 @@ class GraphicsView(QtGui.QGraphicsView):
|
|||||||
def mouseMoveEvent(self, ev):
|
def mouseMoveEvent(self, ev):
|
||||||
if self.lastMousePos is None:
|
if self.lastMousePos is None:
|
||||||
self.lastMousePos = Point(ev.pos())
|
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())
|
self.lastMousePos = Point(ev.pos())
|
||||||
|
|
||||||
QtGui.QGraphicsView.mouseMoveEvent(self, ev)
|
QtGui.QGraphicsView.mouseMoveEvent(self, ev)
|
||||||
|
Loading…
Reference in New Issue
Block a user