From c830183073c428658ff65e0bf7fb54a60ce5e365 Mon Sep 17 00:00:00 2001 From: Conrad Steenberg Date: Wed, 21 Jul 2021 13:16:06 -0700 Subject: [PATCH] More fixes, some reversions --- piker/ui/_axes.py | 4 ++-- piker/ui/_graphics/_cursor.py | 2 +- piker/ui/_graphics/_curve.py | 4 ++-- piker/ui/_graphics/_ohlc.py | 5 ++--- piker/ui/_signalling.py | 6 +++--- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/piker/ui/_axes.py b/piker/ui/_axes.py index a85cdedd..53707407 100644 --- a/piker/ui/_axes.py +++ b/piker/ui/_axes.py @@ -351,7 +351,7 @@ class XAxisLabel(AxisLabel): def _draw_arrow_path(self): y_offset = self._parent.style['tickTextOffset'][1] - path = QtWidgets.QPainterPath() + path = QtGui.QPainterPath() h, w = self.rect.height(), self.rect.width() middle = w/2 - 0.5 aw = h/2 @@ -453,7 +453,7 @@ class YAxisLabel(AxisLabel): def _draw_arrow_path(self): x_offset = self._parent.style['tickTextOffset'][0] - path = QtWidgets.QPainterPath() + path = QtGui.QPainterPath() h = self.rect.height() path.moveTo(0, 0) path.lineTo(-x_offset - h/4, h/2.) diff --git a/piker/ui/_graphics/_cursor.py b/piker/ui/_graphics/_cursor.py index 6e6938f8..0ad4fb7a 100644 --- a/piker/ui/_graphics/_cursor.py +++ b/piker/ui/_graphics/_cursor.py @@ -103,7 +103,7 @@ class LineDot(pg.CurvePoint): i = index - x[0] if i > 0 and i < len(y): newPos = (index, y[i]) - QtGui.QGraphicsItem.setPos(self, *newPos) + QtWidgets.QGraphicsItem.setPos(self, *newPos) return True return False diff --git a/piker/ui/_graphics/_curve.py b/piker/ui/_graphics/_curve.py index a177c382..6214c07c 100644 --- a/piker/ui/_graphics/_curve.py +++ b/piker/ui/_graphics/_curve.py @@ -101,7 +101,7 @@ class FastAppendCurve(pg.PlotCurveItem): # XXX: pretty annoying but, without this there's little # artefacts on the append updates to the curve... - self.setCacheMode(QtGui.QGraphicsItem.NoCache) + self.setCacheMode(QtWidgets.QGraphicsItem.NoCache) self.prepareGeometryChange() flip_cache = True @@ -121,7 +121,7 @@ class FastAppendCurve(pg.PlotCurveItem): self.update() if flip_cache: - self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache) + self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache) def boundingRect(self): if self.path is None: diff --git a/piker/ui/_graphics/_ohlc.py b/piker/ui/_graphics/_ohlc.py index 3861908e..24f35075 100644 --- a/piker/ui/_graphics/_ohlc.py +++ b/piker/ui/_graphics/_ohlc.py @@ -22,7 +22,6 @@ from typing import List, Optional, Tuple import numpy as np import pyqtgraph as pg from numba import njit, float64, int64 # , optional -import PyQt5 from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import QLineF, QPointF # from numba import types as ntypes @@ -315,7 +314,7 @@ class BarItems(pg.GraphicsObject): # trigger redraw despite caching self.prepareGeometryChange() - self.setCacheMode(QtGui.QGraphicsItem.NoCache) + self.setCacheMode(QtWidgets.QGraphicsItem.NoCache) flip_cache = True self._xrange = first_index, last_index @@ -353,7 +352,7 @@ class BarItems(pg.GraphicsObject): self.update() if flip_cache: - self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache) + self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache) def paint( self, diff --git a/piker/ui/_signalling.py b/piker/ui/_signalling.py index dbb4f467..13bc2fc8 100644 --- a/piker/ui/_signalling.py +++ b/piker/ui/_signalling.py @@ -23,7 +23,7 @@ WARNING: this code likely doesn't work at all (yet) """ import numpy as np import pyqtgraph as pg -from PyQt5 import QtCore, QtGui +from PyQt5 import QtCore, QtGui, QtWidgets from .quantdom.charts import CenteredTextItem from .quantdom.base import Quotes @@ -57,8 +57,8 @@ class SignallingApi(object): self.signals_visible = False def add_signals(self): - self.signals_group_text = QtGui.QGraphicsItemGroup() - self.signals_group_arrow = QtGui.QGraphicsItemGroup() + self.signals_group_text = QtWidgets.QGraphicsItemGroup() + self.signals_group_arrow = QtWidgets.QGraphicsItemGroup() self.signals_text_items = np.empty(len(Quotes), dtype=object) for p in Portfolio.positions: