fix click bug on removable ROIs; test#1804
Conversation
|
Thanks for the fix @outofculture that's too bad the Elsewhere in ROI.py we use Should we change the other usage of |
|
Oh, I hadn't seen it used elsewhere. |
we can't get everything we want in life.... |
elif ev.button() & self.acceptedMouseButtons() > 0:0fa4557 is the commit that added PyQt6 compatibility wrt to enums and flags. |
|
Ran the ImageView example in PyQt6 6.0.3 and 6.1 and did a mouse click within the ROI [19:54:39] Error sending click event:
|==============================>>
| Traceback (most recent call last):
| File "C:\work\github\pyqtgraph\examples\ImageView.py", line 67, in <module>
| pg.exec()
| File "C:\work\github\pyqtgraph\pyqtgraph\Qt.py", line 447, in exec_
| return app.exec() if hasattr(app, 'exec') else app.exec_()
| File "C:\work\github\pyqtgraph\pyqtgraph\widgets\GraphicsView.py", line 355, in mouseReleaseEvent
| super().mouseReleaseEvent(ev)
| File "C:\work\github\pyqtgraph\pyqtgraph\GraphicsScene\GraphicsScene.py", line 240, in mouseReleaseEvent
| if self.sendClickEvent(cev[0]):
| File "C:\work\github\pyqtgraph\pyqtgraph\GraphicsScene\GraphicsScene.py", line 389, in sendClickEvent
| debug.printExc("Error sending click event:")
| --- exception caught here ---
| File "C:\work\github\pyqtgraph\pyqtgraph\GraphicsScene\GraphicsScene.py", line 387, in sendClickEvent
| item.mouseClickEvent(ev)
| File "C:\work\github\pyqtgraph\pyqtgraph\graphicsItems\ROI.py", line 804, in mouseClickEvent
| elif ev.button() & self.acceptedMouseButtons() > 0:
| TypeError: '>' not supported between instances of 'MouseButtons' and 'int'
|==============================<< |
|
I swear, qt bindings are never happy (PyQt5 5.12 + Python 3.8) I think I may just suppress this warning. |
|
While the fix was easy, why didn't the new test that was added catch this is the mystery, looking into that now. |
|
oh, it did catch it, but it was suppressed; ... that's a problem; you can see the exception when you run EDIT: and here is why an exception wasn't raised... pyqtgraph/pyqtgraph/GraphicsScene/GraphicsScene.py Lines 362 to 396 in 07a99cb |
Looks like
instopped working at some point, but thisintversion should be safer and work everywhere.