Uggh, don't override click handler on view; pg has it's own mouse events..

fsp_feeds
Tyler Goodlet 2021-08-13 13:49:07 -04:00
parent f2376f90ad
commit c37ce664f5
1 changed files with 20 additions and 12 deletions

View File

@ -23,6 +23,7 @@ import time
from typing import Optional, Callable
import pyqtgraph as pg
from pyqtgraph.GraphicsScene import mouseEvents
from PyQt5.QtWidgets import QGraphicsSceneMouseEvent as gs_mouse
from PyQt5.QtCore import Qt, QEvent
from pyqtgraph import ViewBox, Point, QtCore
@ -250,16 +251,23 @@ async def handle_viewmode_mouse(
async for msg in recv_chan:
button = msg.button
# pos = ev.pos()
if button == QtCore.Qt.RightButton and view.menuEnabled():
# ev.accept()
view.raiseContextMenu(msg.event)
# XXX: ugggh ``pyqtgraph`` has its own mouse events..
# so we can't overried this easily.
# it's going to take probably some decent
# reworking of the mouseClickEvent() handler.
elif button == QtCore.Qt.LeftButton:
# if button == QtCore.Qt.RightButton and view.menuEnabled():
# event = mouseEvents.MouseClickEvent(msg.event)
# # event.accept()
# view.raiseContextMenu(event)
if (
view.order_mode and
button == QtCore.Qt.LeftButton
):
# when in order mode, submit execution
if view.order_mode:
# ev.accept()
# msg.event.accept()
view.mode.submit_order()
@ -515,10 +523,10 @@ class ChartView(ViewBox):
self.scaleBy(x=x, y=y, center=center)
self.sigRangeChangedManually.emit(self.state['mouseEnabled'])
def mouseClickEvent(self, event: QtCore.QEvent) -> None:
'''This routine is rerouted to an async handler.
'''
pass
# def mouseClickEvent(self, event: QtCore.QEvent) -> None:
# '''This routine is rerouted to an async handler.
# '''
# pass
def keyReleaseEvent(self, event: QtCore.QEvent) -> None:
'''This routine is rerouted to an async handler.