Drop all `ChartPlotWidget._lc` remap to `.linked
parent
86cb8421d9
commit
9fc46fd40d
|
@ -1,5 +1,5 @@
|
||||||
# piker: trading gear for hackers
|
# 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
|
# 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
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -287,7 +287,6 @@ class LinkedSplits(QtWidgets.QWidget):
|
||||||
self.layout.setContentsMargins(0, 0, 0, 0)
|
self.layout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.layout.addWidget(self.splitter)
|
self.layout.addWidget(self.splitter)
|
||||||
|
|
||||||
# state tracker?
|
|
||||||
self._symbol: Symbol = None
|
self._symbol: Symbol = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -491,7 +490,6 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
self.name = name
|
self.name = name
|
||||||
self._lc = linkedsplits
|
|
||||||
self.linked = linkedsplits
|
self.linked = linkedsplits
|
||||||
|
|
||||||
# scene-local placeholder for book graphics
|
# scene-local placeholder for book graphics
|
||||||
|
@ -733,7 +731,7 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
|
|
||||||
# if the sticky is for our symbol
|
# if the sticky is for our symbol
|
||||||
# use the tick size precision for display
|
# use the tick size precision for display
|
||||||
sym = self._lc.symbol
|
sym = self.linked.symbol
|
||||||
if name == sym.key:
|
if name == sym.key:
|
||||||
digits = sym.digits()
|
digits = sym.digits()
|
||||||
else:
|
else:
|
||||||
|
@ -983,7 +981,7 @@ async def chart_from_quotes(
|
||||||
|
|
||||||
last, volume = ohlcv.array[-1][['close', 'volume']]
|
last, volume = ohlcv.array[-1][['close', 'volume']]
|
||||||
|
|
||||||
symbol = chart._lc.symbol
|
symbol = chart.linked.symbol
|
||||||
|
|
||||||
l1 = L1Labels(
|
l1 = L1Labels(
|
||||||
chart,
|
chart,
|
||||||
|
@ -1001,7 +999,7 @@ async def chart_from_quotes(
|
||||||
# levels this might be dark volume we need to
|
# levels this might be dark volume we need to
|
||||||
# present differently?
|
# present differently?
|
||||||
|
|
||||||
tick_size = chart._lc.symbol.tick_size
|
tick_size = chart.linked.symbol.tick_size
|
||||||
tick_margin = 2 * tick_size
|
tick_margin = 2 * tick_size
|
||||||
|
|
||||||
last_ask = last_bid = last_clear = time.time()
|
last_ask = last_bid = last_clear = time.time()
|
||||||
|
@ -1010,7 +1008,7 @@ async def chart_from_quotes(
|
||||||
async for quotes in stream:
|
async for quotes in stream:
|
||||||
|
|
||||||
# chart isn't actively shown so just skip render cycle
|
# chart isn't actively shown so just skip render cycle
|
||||||
if chart._lc.isHidden():
|
if chart.linked.isHidden():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for sym, quote in quotes.items():
|
for sym, quote in quotes.items():
|
||||||
|
@ -1300,7 +1298,7 @@ async def run_fsp(
|
||||||
value = array[fsp_func_name][-1]
|
value = array[fsp_func_name][-1]
|
||||||
last_val_sticky.update_from_data(-1, value)
|
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
|
# works also for overlays in which case data is looked up from
|
||||||
# internal chart array set....
|
# internal chart array set....
|
||||||
|
@ -1335,7 +1333,7 @@ async def run_fsp(
|
||||||
async for value in stream:
|
async for value in stream:
|
||||||
|
|
||||||
# chart isn't actively shown so just skip render cycle
|
# chart isn't actively shown so just skip render cycle
|
||||||
if chart._lc.isHidden():
|
if chart.linked.isHidden():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
|
|
@ -118,7 +118,7 @@ class LineEditor:
|
||||||
chart = cursor.active_plot
|
chart = cursor.active_plot
|
||||||
y = cursor._datum_xy[1]
|
y = cursor._datum_xy[1]
|
||||||
|
|
||||||
symbol = chart._lc.symbol
|
symbol = chart.linked.symbol
|
||||||
|
|
||||||
# add a "staged" cursor-tracking line to view
|
# add a "staged" cursor-tracking line to view
|
||||||
# and cash it in a a var
|
# and cash it in a a var
|
||||||
|
@ -194,7 +194,7 @@ class LineEditor:
|
||||||
if not line:
|
if not line:
|
||||||
raise RuntimeError("No line is currently staged!?")
|
raise RuntimeError("No line is currently staged!?")
|
||||||
|
|
||||||
sym = chart._lc.symbol
|
sym = chart.linked.symbol
|
||||||
|
|
||||||
line = order_line(
|
line = order_line(
|
||||||
chart,
|
chart,
|
||||||
|
|
|
@ -210,9 +210,6 @@ class Label:
|
||||||
|
|
||||||
assert s_xy == self.txt.pos()
|
assert s_xy == self.txt.pos()
|
||||||
|
|
||||||
def orient_on(self, h: str, v: str) -> None:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def fmt_str(self) -> str:
|
def fmt_str(self) -> str:
|
||||||
return self._fmt_str
|
return self._fmt_str
|
||||||
|
|
|
@ -114,9 +114,7 @@ class LevelLine(pg.InfiniteLine):
|
||||||
self._on_drag_start = lambda l: None
|
self._on_drag_start = lambda l: None
|
||||||
self._on_drag_end = 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._last_scene_y: float = 0
|
|
||||||
|
|
||||||
self._right_end_sc: float = 0
|
self._right_end_sc: float = 0
|
||||||
|
|
||||||
def txt_offsets(self) -> Tuple[int, int]:
|
def txt_offsets(self) -> Tuple[int, int]:
|
||||||
|
|
Loading…
Reference in New Issue