Change to using real type annots

history_view
Tyler Goodlet 2022-09-07 11:29:27 -04:00
parent ceac3f2ee4
commit 1c685189d1
1 changed files with 19 additions and 8 deletions

View File

@ -18,8 +18,13 @@
Mouse interaction graphics Mouse interaction graphics
""" """
from __future__ import annotations
from functools import partial from functools import partial
from typing import Optional, Callable from typing import (
Optional,
Callable,
TYPE_CHECKING,
)
import inspect import inspect
import numpy as np import numpy as np
@ -36,6 +41,12 @@ from ._style import (
from ._axes import YAxisLabel, XAxisLabel from ._axes import YAxisLabel, XAxisLabel
from ..log import get_logger from ..log import get_logger
if TYPE_CHECKING:
from ._chart import (
ChartPlotWidget,
LinkedSplits,
)
log = get_logger(__name__) log = get_logger(__name__)
@ -58,7 +69,7 @@ class LineDot(pg.CurvePoint):
curve: pg.PlotCurveItem, curve: pg.PlotCurveItem,
index: int, index: int,
plot: 'ChartPlotWidget', # type: ingore # noqa plot: ChartPlotWidget, # type: ingore # noqa
pos=None, pos=None,
color: str = 'default_light', color: str = 'default_light',
@ -151,7 +162,7 @@ class ContentsLabel(pg.LabelItem):
def __init__( def __init__(
self, self,
# chart: 'ChartPlotWidget', # noqa # chart: ChartPlotWidget, # noqa
view: pg.ViewBox, view: pg.ViewBox,
anchor_at: str = ('top', 'right'), anchor_at: str = ('top', 'right'),
@ -244,7 +255,7 @@ class ContentsLabels:
''' '''
def __init__( def __init__(
self, self,
linkedsplits: 'LinkedSplits', # type: ignore # noqa linkedsplits: LinkedSplits, # type: ignore # noqa
) -> None: ) -> None:
@ -289,7 +300,7 @@ class ContentsLabels:
def add_label( def add_label(
self, self,
chart: 'ChartPlotWidget', # type: ignore # noqa chart: ChartPlotWidget, # type: ignore # noqa
name: str, name: str,
anchor_at: tuple[str, str] = ('top', 'left'), anchor_at: tuple[str, str] = ('top', 'left'),
update_func: Callable = ContentsLabel.update_from_value, update_func: Callable = ContentsLabel.update_from_value,
@ -316,7 +327,7 @@ class Cursor(pg.GraphicsObject):
def __init__( def __init__(
self, self,
linkedsplits: 'LinkedSplits', # noqa linkedsplits: LinkedSplits, # noqa
digits: int = 0 digits: int = 0
) -> None: ) -> None:
@ -385,7 +396,7 @@ class Cursor(pg.GraphicsObject):
def add_plot( def add_plot(
self, self,
plot: 'ChartPlotWidget', # noqa plot: ChartPlotWidget, # noqa
digits: int = 0, digits: int = 0,
) -> None: ) -> None:
@ -469,7 +480,7 @@ class Cursor(pg.GraphicsObject):
def add_curve_cursor( def add_curve_cursor(
self, self,
plot: 'ChartPlotWidget', # noqa plot: ChartPlotWidget, # noqa
curve: 'PlotCurveItem', # noqa curve: 'PlotCurveItem', # noqa
) -> LineDot: ) -> LineDot: