Drop all `ChartPlotWidget._lc` remap to `.linked

fsp_feeds
Tyler Goodlet 2021-07-22 11:42:12 -04:00
parent c8b14e9445
commit 7367ed5464
5 changed files with 10 additions and 15 deletions

View File

@ -1,5 +1,5 @@
# piker: trading gear for hackers
# Copyright (C) 2018-present Tyler Goodlet (in stewardship of piker0)
# Copyright (C) 2018-present Tyler Goodlet (in stewardship for piker0)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by

View File

@ -287,7 +287,6 @@ class LinkedSplits(QtWidgets.QWidget):
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.addWidget(self.splitter)
# state tracker?
self._symbol: Symbol = None
@property
@ -491,7 +490,6 @@ class ChartPlotWidget(pg.PlotWidget):
**kwargs
)
self.name = name
self._lc = linkedsplits
self.linked = linkedsplits
# scene-local placeholder for book graphics
@ -737,7 +735,7 @@ class ChartPlotWidget(pg.PlotWidget):
# if the sticky is for our symbol
# use the tick size precision for display
sym = self._lc.symbol
sym = self.linked.symbol
if name == sym.key:
digits = sym.digits()
else:
@ -987,7 +985,7 @@ async def chart_from_quotes(
last, volume = ohlcv.array[-1][['close', 'volume']]
symbol = chart._lc.symbol
symbol = chart.linked.symbol
l1 = L1Labels(
chart,
@ -1005,7 +1003,7 @@ async def chart_from_quotes(
# levels this might be dark volume we need to
# present differently?
tick_size = chart._lc.symbol.tick_size
tick_size = chart.linked.symbol.tick_size
tick_margin = 2 * tick_size
last_ask = last_bid = last_clear = time.time()
@ -1014,7 +1012,7 @@ async def chart_from_quotes(
async for quotes in stream:
# chart isn't actively shown so just skip render cycle
if chart._lc.isHidden():
if chart.linked.isHidden():
continue
for sym, quote in quotes.items():
@ -1304,7 +1302,7 @@ async def run_fsp(
value = array[fsp_func_name][-1]
last_val_sticky.update_from_data(-1, value)
chart._lc.focus()
chart.linked.focus()
# works also for overlays in which case data is looked up from
# internal chart array set....
@ -1339,7 +1337,7 @@ async def run_fsp(
async for value in stream:
# chart isn't actively shown so just skip render cycle
if chart._lc.isHidden():
if chart.linked.isHidden():
continue
now = time.time()

View File

@ -119,7 +119,7 @@ class LineEditor:
chart = cursor.active_plot
y = cursor._datum_xy[1]
symbol = chart._lc.symbol
symbol = chart.linked.symbol
# add a "staged" cursor-tracking line to view
# and cash it in a a var
@ -199,7 +199,7 @@ class LineEditor:
if not line:
raise RuntimeError("No line is currently staged!?")
sym = chart._lc.symbol
sym = chart.linked.symbol
line = order_line(
chart,

View File

@ -175,9 +175,6 @@ class Label:
assert s_xy == self.txt.pos()
# def orient_on(self, h: str, v: str) -> None:
# pass
@property
def fmt_str(self) -> str:
return self._fmt_str

View File

@ -119,7 +119,7 @@ class LevelLine(pg.InfiniteLine):
self._on_drag_start = lambda l: None
self._on_drag_end = lambda l: None
self._y_incr_mult = 1 / chart._lc._symbol.tick_size
self._y_incr_mult = 1 / chart.linked.symbol.tick_size
self._right_end_sc: float = 0
def txt_offsets(self) -> Tuple[int, int]: