Fix a few QtGui -> QtWidget issues
parent
161089de87
commit
3912b22b41
|
@ -99,3 +99,4 @@ ENV/
|
|||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.vscode/settings.json
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
Annotations for ur faces.
|
||||
|
||||
"""
|
||||
import PyQt5
|
||||
from PyQt5 import QtCore, QtGui
|
||||
from PyQt5.QtGui import QGraphicsPathItem
|
||||
from PyQt5.QtWidgets import QGraphicsPathItem
|
||||
from pyqtgraph import Point, functions as fn, Color
|
||||
import numpy as np
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class Axis(pg.AxisItem):
|
|||
super().__init__(**kwargs)
|
||||
|
||||
# XXX: pretty sure this makes things slower
|
||||
# self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache)
|
||||
# self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||
|
||||
self.linkedsplits = linkedsplits
|
||||
self._min_tick = min_tick
|
||||
|
@ -185,7 +185,7 @@ class AxisLabel(pg.GraphicsObject):
|
|||
self.setFlag(self.ItemIgnoresTransformations)
|
||||
|
||||
# XXX: pretty sure this is faster
|
||||
self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache)
|
||||
self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||
|
||||
self._parent = parent
|
||||
|
||||
|
@ -218,7 +218,7 @@ class AxisLabel(pg.GraphicsObject):
|
|||
Subtypes can customize further by overloading ``.draw()``.
|
||||
|
||||
"""
|
||||
# p.setCompositionMode(QtGui.QPainter.CompositionMode_SourceOver)
|
||||
# p.setCompositionMode(QtWidgets.QPainter.CompositionMode_SourceOver)
|
||||
|
||||
if self.label_str:
|
||||
|
||||
|
@ -351,7 +351,7 @@ class XAxisLabel(AxisLabel):
|
|||
|
||||
def _draw_arrow_path(self):
|
||||
y_offset = self._parent.style['tickTextOffset'][1]
|
||||
path = QtGui.QPainterPath()
|
||||
path = QtWidgets.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 = QtGui.QPainterPath()
|
||||
path = QtWidgets.QPainterPath()
|
||||
h = self.rect.height()
|
||||
path.moveTo(0, 0)
|
||||
path.lineTo(-x_offset - h/4, h/2.)
|
||||
|
|
|
@ -19,11 +19,11 @@ High level Qt chart widgets.
|
|||
|
||||
"""
|
||||
import time
|
||||
from typing import Tuple, Dict, Any, Optional
|
||||
from typing import Tuple, Dict, Any, Optional, List
|
||||
from types import ModuleType
|
||||
from functools import partial
|
||||
|
||||
from PyQt5 import QtCore, QtGui
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtCore import QEvent
|
||||
import numpy as np
|
||||
|
@ -73,7 +73,7 @@ from ..data import feed
|
|||
log = get_logger(__name__)
|
||||
|
||||
|
||||
class GodWidget(QtGui.QWidget):
|
||||
class GodWidget(QtWidgets.QWidget):
|
||||
'''
|
||||
"Our lord and savior, the holy child of window-shua, there is no
|
||||
widget above thee." - 6|6
|
||||
|
@ -92,17 +92,17 @@ class GodWidget(QtGui.QWidget):
|
|||
|
||||
super().__init__(parent)
|
||||
|
||||
self.hbox = QtGui.QHBoxLayout(self)
|
||||
self.hbox = QtWidgets.QHBoxLayout(self)
|
||||
self.hbox.setContentsMargins(0, 0, 0, 0)
|
||||
self.hbox.setSpacing(2)
|
||||
|
||||
self.vbox = QtGui.QVBoxLayout()
|
||||
self.vbox = QtWidgets.QVBoxLayout()
|
||||
self.vbox.setContentsMargins(0, 0, 0, 0)
|
||||
self.vbox.setSpacing(2)
|
||||
|
||||
self.hbox.addLayout(self.vbox)
|
||||
|
||||
# self.toolbar_layout = QtGui.QHBoxLayout()
|
||||
# self.toolbar_layout = QtWidgets.QHBoxLayout()
|
||||
# self.toolbar_layout.setContentsMargins(0, 0, 0, 0)
|
||||
# self.vbox.addLayout(self.toolbar_layout)
|
||||
|
||||
|
@ -134,7 +134,7 @@ class GodWidget(QtGui.QWidget):
|
|||
return self._chart_cache.get(symbol_key)
|
||||
|
||||
# def init_timeframes_ui(self):
|
||||
# self.tf_layout = QtGui.QHBoxLayout()
|
||||
# self.tf_layout = QtWidgets.QHBoxLayout()
|
||||
# self.tf_layout.setSpacing(0)
|
||||
# self.tf_layout.setContentsMargins(0, 12, 0, 0)
|
||||
# time_frames = ('1M', '5M', '15M', '30M', '1H', '1D', '1W', 'MN')
|
||||
|
@ -142,7 +142,7 @@ class GodWidget(QtGui.QWidget):
|
|||
|
||||
# for tf in time_frames:
|
||||
# btn_name = ''.join([btn_prefix, tf])
|
||||
# btn = QtGui.QPushButton(tf)
|
||||
# btn = QtWidgets.QPushButton(tf)
|
||||
# # TODO:
|
||||
# btn.setEnabled(False)
|
||||
# setattr(self, btn_name, btn)
|
||||
|
@ -233,7 +233,7 @@ class GodWidget(QtGui.QWidget):
|
|||
return order_mode_started
|
||||
|
||||
|
||||
class LinkedSplits(QtGui.QWidget):
|
||||
class LinkedSplits(QtWidgets.QWidget):
|
||||
'''
|
||||
Widget that holds a central chart plus derived
|
||||
subcharts computed from the original data set apart
|
||||
|
@ -279,11 +279,11 @@ class LinkedSplits(QtGui.QWidget):
|
|||
# self.xaxis_ind.setStyle(showValues=False)
|
||||
# self.xaxis.hide()
|
||||
|
||||
self.splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
|
||||
self.splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)
|
||||
self.splitter.setMidLineWidth(2)
|
||||
self.splitter.setHandleWidth(0)
|
||||
|
||||
self.layout = QtGui.QVBoxLayout(self)
|
||||
self.layout = QtWidgets.QVBoxLayout(self)
|
||||
self.layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.layout.addWidget(self.splitter)
|
||||
|
||||
|
@ -344,7 +344,7 @@ class LinkedSplits(QtGui.QWidget):
|
|||
self.chart.hideAxis('bottom')
|
||||
|
||||
# style?
|
||||
self.chart.setFrameStyle(QtGui.QFrame.StyledPanel | QtGui.QFrame.Plain)
|
||||
self.chart.setFrameStyle(QtWidgets.QFrame.StyledPanel | QtWidgets.QFrame.Plain)
|
||||
|
||||
return self.chart
|
||||
|
||||
|
@ -402,7 +402,7 @@ class LinkedSplits(QtGui.QWidget):
|
|||
cv.chart = cpw
|
||||
|
||||
cpw.plotItem.vb.linkedsplits = self
|
||||
cpw.setFrameStyle(QtGui.QFrame.StyledPanel) # | QtGui.QFrame.Plain)
|
||||
cpw.setFrameStyle(QtWidgets.QFrame.StyledPanel) # | QtWidgets.QFrame.Plain)
|
||||
cpw.hideButtons()
|
||||
# XXX: gives us outline on backside of y-axis
|
||||
cpw.getPlotItem().setContentsMargins(*CHART_MARGINS)
|
||||
|
@ -452,8 +452,8 @@ class ChartPlotWidget(pg.PlotWidget):
|
|||
eventually want multiple plots managed together?)
|
||||
|
||||
'''
|
||||
sig_mouse_leave = QtCore.Signal(object)
|
||||
sig_mouse_enter = QtCore.Signal(object)
|
||||
sig_mouse_leave = QtCore.pyqtSignal(object)
|
||||
sig_mouse_enter = QtCore.pyqtSignal(object)
|
||||
|
||||
_l1_labels: L1Labels = None
|
||||
|
||||
|
@ -690,11 +690,11 @@ class ChartPlotWidget(pg.PlotWidget):
|
|||
# https://stackoverflow.com/a/39410081
|
||||
# seems to only be useful if we don't re-generate the entire
|
||||
# QPainterPath every time
|
||||
# curve.curve.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache)
|
||||
# curve.curve.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||
|
||||
# don't ever use this - it's a colossal nightmare of artefacts
|
||||
# and is disastrous for performance.
|
||||
# curve.setCacheMode(QtGui.QGraphicsItem.ItemCoordinateCache)
|
||||
# curve.setCacheMode(QtWidgets.QGraphicsItem.ItemCoordinateCache)
|
||||
|
||||
self.addItem(curve)
|
||||
|
||||
|
@ -1702,7 +1702,7 @@ async def _async_main(
|
|||
|
||||
def _main(
|
||||
sym: str,
|
||||
brokernames: [str],
|
||||
brokernames: List[str],
|
||||
piker_loglevel: str,
|
||||
tractor_kwargs,
|
||||
) -> None:
|
||||
|
|
|
@ -23,7 +23,7 @@ from typing import Callable
|
|||
|
||||
from PyQt5 import QtCore
|
||||
from PyQt5.QtCore import QEvent
|
||||
from PyQt5.QtGui import QWidget
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
import trio
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ from typing import Optional, Callable
|
|||
import inspect
|
||||
import numpy as np
|
||||
import pyqtgraph as pg
|
||||
from PyQt5 import QtCore, QtGui
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5.QtCore import QPointF, QRectF
|
||||
|
||||
from .._style import (
|
||||
|
@ -74,7 +74,7 @@ class LineDot(pg.CurvePoint):
|
|||
brush = pg.mkBrush(cdefault)
|
||||
|
||||
# presuming this is fast since it's built in?
|
||||
dot = self.dot = QtGui.QGraphicsEllipseItem(
|
||||
dot = self.dot = QtWidgets.QGraphicsEllipseItem(
|
||||
QtCore.QRectF(-size / 2, -size / 2, size, size)
|
||||
)
|
||||
# if we needed transformable dot?
|
||||
|
@ -358,10 +358,10 @@ class Cursor(pg.GraphicsObject):
|
|||
# vertical and horizonal lines and a y-axis label
|
||||
|
||||
vl = plot.addLine(x=0, pen=self.lines_pen, movable=False)
|
||||
vl.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache)
|
||||
vl.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||
|
||||
hl = plot.addLine(y=0, pen=self.lines_pen, movable=False)
|
||||
hl.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache)
|
||||
hl.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||
hl.hide()
|
||||
|
||||
yl = YAxisLabel(
|
||||
|
|
|
@ -42,7 +42,7 @@ class FastAppendCurve(pg.PlotCurveItem):
|
|||
# interactions slower (such as zooming) and if so maybe if/when
|
||||
# we implement a "history" mode for the view we disable this in
|
||||
# that mode?
|
||||
self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache)
|
||||
self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||
|
||||
def update_from_array(
|
||||
self,
|
||||
|
|
|
@ -435,7 +435,7 @@ class LevelLine(pg.InfiniteLine):
|
|||
|
||||
def add_marker(
|
||||
self,
|
||||
path: QtGui.QGraphicsPathItem,
|
||||
path: QtWidgets.QGraphicsPathItem,
|
||||
) -> None:
|
||||
|
||||
# chart = self._chart
|
||||
|
@ -527,7 +527,7 @@ class LevelLine(pg.InfiniteLine):
|
|||
|
||||
|
||||
def level_line(
|
||||
chart: 'ChartPlogWidget', # noqa
|
||||
chart: 'ChartPlotWidget', # noqa
|
||||
level: float,
|
||||
color: str = 'default',
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ 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
|
||||
|
@ -172,7 +173,7 @@ def gen_qpath(
|
|||
class BarItems(pg.GraphicsObject):
|
||||
"""Price range bars graphics rendered from a OHLC sequence.
|
||||
"""
|
||||
sigPlotChanged = QtCore.Signal(object)
|
||||
sigPlotChanged = QtCore.pyqtSignal(object)
|
||||
|
||||
# 0.5 is no overlap between arms, 1.0 is full overlap
|
||||
w: float = 0.43
|
||||
|
@ -196,7 +197,7 @@ class BarItems(pg.GraphicsObject):
|
|||
# interactions slower (such as zooming) and if so maybe if/when
|
||||
# we implement a "history" mode for the view we disable this in
|
||||
# that mode?
|
||||
self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache)
|
||||
self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||
|
||||
# not sure if this is actually impoving anything but figured it
|
||||
# was worth a shot:
|
||||
|
|
|
@ -22,7 +22,7 @@ from inspect import isfunction
|
|||
from typing import Callable
|
||||
|
||||
import pyqtgraph as pg
|
||||
from PyQt5 import QtGui
|
||||
from PyQt5 import QtGui, QtWidgets
|
||||
from PyQt5.QtCore import QPointF, QRectF
|
||||
|
||||
from ._style import (
|
||||
|
@ -105,6 +105,7 @@ class Label:
|
|||
production grade UIs...
|
||||
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
||||
self,
|
||||
|
@ -125,7 +126,7 @@ class Label:
|
|||
|
||||
self._x_offset = x_offset
|
||||
|
||||
txt = self.txt = QtGui.QGraphicsTextItem()
|
||||
txt = self.txt = QtWidgets.QGraphicsTextItem()
|
||||
vb.scene().addItem(txt)
|
||||
|
||||
# configure font size based on DPI
|
||||
|
@ -149,7 +150,7 @@ class Label:
|
|||
self._anchor_func = self.txt.pos().x
|
||||
|
||||
# not sure if this makes a diff
|
||||
self.txt.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache)
|
||||
self.txt.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||
|
||||
# TODO: edit and selection support
|
||||
# https://doc.qt.io/qt-5/qt.html#TextInteractionFlag-enum
|
||||
|
|
|
@ -511,17 +511,17 @@ class SearchWidget(QtWidgets.QWidget):
|
|||
|
||||
self.godwidget = godwidget
|
||||
|
||||
self.vbox = QtGui.QVBoxLayout(self)
|
||||
self.vbox = QtWidgets.QVBoxLayout(self)
|
||||
self.vbox.setContentsMargins(0, 0, 0, 0)
|
||||
self.vbox.setSpacing(4)
|
||||
|
||||
# split layout for the (label:| search bar entry)
|
||||
self.bar_hbox = QtGui.QHBoxLayout()
|
||||
self.bar_hbox = QtWidgets.QHBoxLayout()
|
||||
self.bar_hbox.setContentsMargins(0, 0, 0, 0)
|
||||
self.bar_hbox.setSpacing(4)
|
||||
|
||||
# add label to left of search bar
|
||||
self.label = label = QtGui.QLabel(parent=self)
|
||||
self.label = label = QtWidgets.QLabel(parent=self)
|
||||
label.setTextFormat(3) # markdown
|
||||
label.setFont(_font.font)
|
||||
label.setMargin(4)
|
||||
|
@ -653,7 +653,7 @@ async def pack_matches(
|
|||
|
||||
view: CompleterView,
|
||||
has_results: dict[str, set[str]],
|
||||
matches: dict[(str, str), [str]],
|
||||
matches: dict[(str, str), List[str]],
|
||||
provider: str,
|
||||
pattern: str,
|
||||
search: Callable[..., Awaitable[dict]],
|
||||
|
|
|
@ -25,8 +25,8 @@ from typing import Callable, Optional, Union
|
|||
import uuid
|
||||
|
||||
from pyqtgraph import QtGui
|
||||
from PyQt5 import QtCore
|
||||
from PyQt5.QtGui import QLabel, QStatusBar
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
from PyQt5.QtWidgets import QLabel, QStatusBar
|
||||
|
||||
from ..log import get_logger
|
||||
from ._style import _font_small, hcolor
|
||||
|
|
Loading…
Reference in New Issue