From 49c25eeef405cfa959c09b84d2c36fb5e0aaac8e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 1 Apr 2022 13:49:42 -0400 Subject: [PATCH] Index must be int bro.. --- piker/ui/_cursor.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/piker/ui/_cursor.py b/piker/ui/_cursor.py index e006858e..ad3ddc98 100644 --- a/piker/ui/_cursor.py +++ b/piker/ui/_cursor.py @@ -95,22 +95,24 @@ class LineDot(pg.CurvePoint): def event( self, - ev: QtCore.QEvent, - ) -> None: + ) -> bool: if not isinstance( ev, QtCore.QDynamicPropertyChangeEvent ) or self.curve() is None: return False + # TODO: get rid of this ``.getData()`` and + # make a more pythonic api to retreive backing + # numpy arrays... (x, y) = self.curve().getData() index = self.property('index') # first = self._plot._arrays['ohlc'][0]['index'] # first = x[0] # i = index - first if index: - i = index - x[0] + i = round(index - x[0]) if i > 0 and i < len(y): newPos = (index, y[i]) QtWidgets.QGraphicsItem.setPos(self, *newPos) @@ -405,6 +407,7 @@ class Cursor(pg.GraphicsObject): slot=self.mouseMoved, delay=_debounce_delay, ) + px_enter = pg.SignalProxy( plot.sig_mouse_enter, rateLimit=_mouse_rate_limit,