From e892ad37aa6272fb5da08b20ba13527c8b3c55ba Mon Sep 17 00:00:00 2001 From: Ogi Moore Date: Thu, 10 Jun 2021 19:25:05 -0700 Subject: [PATCH] Add missing enums --- pyqtgraph/GraphicsScene/GraphicsScene.py | 10 +++++----- pyqtgraph/graphicsItems/CurvePoint.py | 3 +-- pyqtgraph/graphicsItems/ItemGroup.py | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pyqtgraph/GraphicsScene/GraphicsScene.py b/pyqtgraph/GraphicsScene/GraphicsScene.py index 642dca3c..aaf9fe39 100644 --- a/pyqtgraph/GraphicsScene/GraphicsScene.py +++ b/pyqtgraph/GraphicsScene/GraphicsScene.py @@ -165,18 +165,18 @@ class GraphicsScene(QtGui.QGraphicsScene): ## set focus on the topmost focusable item under this click items = self.items(ev.scenePos()) for i in items: - if i.isEnabled() and i.isVisible() and (i.flags() & i.ItemIsFocusable): + if i.isEnabled() and i.isVisible() and (i.flags() & i.GraphicsItemFlag.ItemIsFocusable): i.setFocus(QtCore.Qt.FocusReason.MouseFocusReason) break def _moveEventIsAllowed(self): # For ignoring events that are too close together - + # Max number of events per second rateLimit = getConfigOption('mouseRateLimit') if rateLimit <= 0: return True - + # Delay between events (in milliseconds) delay = 1000.0 / rateLimit if getMillis() - self._lastMoveEventTime >= delay: @@ -344,7 +344,7 @@ class GraphicsScene(QtGui.QGraphicsScene): if event.isAccepted(): #print " --> accepted" self.dragItem = item - if item.flags() & item.ItemIsFocusable: + if item.flags() & item.GraphicsItemFlag.ItemIsFocusable: item.setFocus(QtCore.Qt.FocusReason.MouseFocusReason) break elif self.dragItem is not None: @@ -389,7 +389,7 @@ class GraphicsScene(QtGui.QGraphicsScene): debug.printExc("Error sending click event:") if ev.isAccepted(): - if item.flags() & item.ItemIsFocusable: + if item.flags() & item.GraphicsItemFlag.ItemIsFocusable: item.setFocus(QtCore.Qt.FocusReason.MouseFocusReason) break self.sigMouseClicked.emit(ev) diff --git a/pyqtgraph/graphicsItems/CurvePoint.py b/pyqtgraph/graphicsItems/CurvePoint.py index fa04402b..171a05e5 100644 --- a/pyqtgraph/graphicsItems/CurvePoint.py +++ b/pyqtgraph/graphicsItems/CurvePoint.py @@ -29,8 +29,7 @@ class CurvePoint(GraphicsObject): self.setProperty('position', 0.0) self.setProperty('index', 0) - if hasattr(self, 'ItemHasNoContents'): - self.setFlags(self.flags() | self.GraphicsItemFlag.ItemHasNoContents) + self.setFlags(self.flags() | self.GraphicsItemFlag.ItemHasNoContents) if pos is not None: self.setPos(pos) diff --git a/pyqtgraph/graphicsItems/ItemGroup.py b/pyqtgraph/graphicsItems/ItemGroup.py index cfeebe50..2826c720 100644 --- a/pyqtgraph/graphicsItems/ItemGroup.py +++ b/pyqtgraph/graphicsItems/ItemGroup.py @@ -9,8 +9,7 @@ class ItemGroup(GraphicsObject): def __init__(self, *args): GraphicsObject.__init__(self, *args) - if hasattr(self, "ItemHasNoContents"): - self.setFlag(self.GraphicsItemFlag.ItemHasNoContents) + self.setFlag(self.GraphicsItemFlag.ItemHasNoContents) def boundingRect(self): return QtCore.QRectF()