`ui._lines`: more direct Qt imports for typing
parent
1231c459aa
commit
d4b07cc95a
|
@ -28,7 +28,17 @@ from typing import (
|
||||||
|
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
from pyqtgraph import Point, functions as fn
|
from pyqtgraph import Point, functions as fn
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
from PyQt5 import (
|
||||||
|
QtCore,
|
||||||
|
QtGui,
|
||||||
|
)
|
||||||
|
from PyQt5.QtWidgets import (
|
||||||
|
QGraphicsPathItem,
|
||||||
|
QStyleOptionGraphicsItem,
|
||||||
|
QGraphicsItem,
|
||||||
|
QGraphicsScene,
|
||||||
|
QWidget,
|
||||||
|
)
|
||||||
from PyQt5.QtCore import QPointF
|
from PyQt5.QtCore import QPointF
|
||||||
|
|
||||||
from ._annotate import LevelMarker
|
from ._annotate import LevelMarker
|
||||||
|
@ -130,7 +140,7 @@ class LevelLine(pg.InfiniteLine):
|
||||||
self._right_end_sc: float = 0
|
self._right_end_sc: float = 0
|
||||||
|
|
||||||
# use px caching
|
# use px caching
|
||||||
self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
|
||||||
|
|
||||||
def txt_offsets(self) -> tuple[int, int]:
|
def txt_offsets(self) -> tuple[int, int]:
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
@ -308,7 +318,7 @@ class LevelLine(pg.InfiniteLine):
|
||||||
Remove this line from containing chart/view/scene.
|
Remove this line from containing chart/view/scene.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
scene = self.scene()
|
scene: QGraphicsScene = self.scene()
|
||||||
if scene:
|
if scene:
|
||||||
for label in self._labels:
|
for label in self._labels:
|
||||||
label.delete()
|
label.delete()
|
||||||
|
@ -339,8 +349,8 @@ class LevelLine(pg.InfiniteLine):
|
||||||
self,
|
self,
|
||||||
|
|
||||||
p: QtGui.QPainter,
|
p: QtGui.QPainter,
|
||||||
opt: QtWidgets.QStyleOptionGraphicsItem,
|
opt: QStyleOptionGraphicsItem,
|
||||||
w: QtWidgets.QWidget
|
w: QWidget
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
'''
|
'''
|
||||||
|
@ -417,9 +427,9 @@ class LevelLine(pg.InfiniteLine):
|
||||||
|
|
||||||
def add_marker(
|
def add_marker(
|
||||||
self,
|
self,
|
||||||
path: QtWidgets.QGraphicsPathItem,
|
path: QGraphicsPathItem,
|
||||||
|
|
||||||
) -> QtWidgets.QGraphicsPathItem:
|
) -> QGraphicsPathItem:
|
||||||
|
|
||||||
self._marker = path
|
self._marker = path
|
||||||
self._marker.setPen(self.currentPen)
|
self._marker.setPen(self.currentPen)
|
||||||
|
|
Loading…
Reference in New Issue