From 7367ed5464f1f8d2351b8d0f3929702e0e75cef9 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 22 Jul 2021 11:42:12 -0400 Subject: [PATCH] Drop all `ChartPlotWidget._lc` remap to `.linked --- piker/data/_source.py | 2 +- piker/ui/_chart.py | 14 ++++++-------- piker/ui/_editors.py | 4 ++-- piker/ui/_label.py | 3 --- piker/ui/_lines.py | 2 +- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/piker/data/_source.py b/piker/data/_source.py index 23524426..bcfc6025 100644 --- a/piker/data/_source.py +++ b/piker/data/_source.py @@ -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 diff --git a/piker/ui/_chart.py b/piker/ui/_chart.py index 0e967128..d23e93b8 100644 --- a/piker/ui/_chart.py +++ b/piker/ui/_chart.py @@ -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() diff --git a/piker/ui/_editors.py b/piker/ui/_editors.py index a35a8d88..e5f7ffa4 100644 --- a/piker/ui/_editors.py +++ b/piker/ui/_editors.py @@ -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, diff --git a/piker/ui/_label.py b/piker/ui/_label.py index 1e4af75e..cfe1351c 100644 --- a/piker/ui/_label.py +++ b/piker/ui/_label.py @@ -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 diff --git a/piker/ui/_lines.py b/piker/ui/_lines.py index f0c137b2..c873857e 100644 --- a/piker/ui/_lines.py +++ b/piker/ui/_lines.py @@ -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]: