diff --git a/piker/ui/_axes.py b/piker/ui/_axes.py index d2bac3cd..08d2e1b5 100644 --- a/piker/ui/_axes.py +++ b/piker/ui/_axes.py @@ -22,7 +22,7 @@ from typing import List, Tuple, Optional import pandas as pd import pyqtgraph as pg -from PyQt5 import QtCore, QtGui +from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import QPointF from ._style import DpiAwareFont, hcolor, _font @@ -44,6 +44,10 @@ class Axis(pg.AxisItem): ) -> None: super().__init__(**kwargs) + + # XXX: pretty sure this makes things slower + # self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache) + self.linked_charts = linked_charts self._min_tick = min_tick @@ -158,9 +162,12 @@ class AxisLabel(pg.GraphicsObject): fg_color: str = 'black', opacity: int = 0, font_size_inches: Optional[float] = None, - ): + ) -> None: + super().__init__(parent) self.setFlag(self.ItemIgnoresTransformations) + # XXX: pretty sure this is faster + self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache) self.parent = parent self.opacity = opacity @@ -177,7 +184,12 @@ class AxisLabel(pg.GraphicsObject): self.rect = None - def paint(self, p, option, widget): + def paint( + self, + p: QtGui.QPainter, + opt: QtWidgets.QStyleOptionGraphicsItem, + w: QtWidgets.QWidget + ) -> None: # p.setCompositionMode(QtGui.QPainter.CompositionMode_SourceOver) if self.label_str: diff --git a/piker/ui/_graphics/_cursor.py b/piker/ui/_graphics/_cursor.py index 2e6c2c35..83f0ee96 100644 --- a/piker/ui/_graphics/_cursor.py +++ b/piker/ui/_graphics/_cursor.py @@ -218,7 +218,6 @@ class CrossHair(pg.GraphicsObject): self.active_plot = None self.digits = digits self._lastx = None - # self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache) def add_plot( self, @@ -240,7 +239,6 @@ class CrossHair(pg.GraphicsObject): opacity=_ch_label_opac, bg_color='default', ) - yl.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache) yl.hide() # on startup if mouse is off screen # TODO: checkout what ``.sigDelayed`` can be used for @@ -283,8 +281,6 @@ class CrossHair(pg.GraphicsObject): ) # place label off-screen during startup self.xaxis_label.setPos(self.plots[0].mapFromView(QPointF(0, 0))) - self.xaxis_label.setCacheMode( - QtGui.QGraphicsItem.DeviceCoordinateCache) def add_curve_cursor( self, diff --git a/piker/ui/_graphics/_curve.py b/piker/ui/_graphics/_curve.py index 49b93910..7bf39cea 100644 --- a/piker/ui/_graphics/_curve.py +++ b/piker/ui/_graphics/_curve.py @@ -25,6 +25,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets from ..._profile import pg_profile_enabled +# TODO: got a feeling that dropping this inheritance gets us even more speedups class FastAppendCurve(pg.PlotCurveItem): def __init__(self, *args, **kwargs):