From 4436342d33428c507505d95dba5b21fb9ce5d949 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 26 Jul 2023 12:40:09 -0400 Subject: [PATCH] Change ui stuff to use new `Position.cumsize` attr name --- piker/ui/_chart.py | 2 +- piker/ui/_interaction.py | 2 +- piker/ui/_ohlc.py | 14 ++++++++++---- piker/ui/_position.py | 4 ++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/piker/ui/_chart.py b/piker/ui/_chart.py index 1b410164..28e258f3 100644 --- a/piker/ui/_chart.py +++ b/piker/ui/_chart.py @@ -282,7 +282,7 @@ class GodWidget(QWidget): # TODO: probably stick this in some kinda `LooknFeel` API? for tracker in self.rt_linked.mode.trackers.values(): pp_nav = tracker.nav - if tracker.live_pp.size: + if tracker.live_pp.cumsize: pp_nav.show() pp_nav.hide_info() else: diff --git a/piker/ui/_interaction.py b/piker/ui/_interaction.py index 6cc6bee4..63a5be8f 100644 --- a/piker/ui/_interaction.py +++ b/piker/ui/_interaction.py @@ -261,7 +261,7 @@ async def handle_viewmode_kb_inputs( # show the pp size label only if there is # a non-zero pos existing tracker = order_mode.current_pp - if tracker.live_pp.size: + if tracker.live_pp.cumsize: tracker.nav.show() # TODO: show pp config mini-params in status bar widget diff --git a/piker/ui/_ohlc.py b/piker/ui/_ohlc.py index 2bbec253..c43926a1 100644 --- a/piker/ui/_ohlc.py +++ b/piker/ui/_ohlc.py @@ -227,7 +227,13 @@ class BarItems(FlowGraphic): # last_row = ohlc[-1:] # individual values - last_row = o, h, l, last, i = ohlc[-1] + last_row = ( + o, + h, + lo, + last, + i, + ) = ohlc[-1] # times = src_data['time'] # if times[-1] - times[-2]: @@ -254,17 +260,17 @@ class BarItems(FlowGraphic): # writer is responsible for changing open on "first" volume of bar larm.setLine(larm.x1(), o, larm.x2(), o) - if l != h: # noqa + if lo != h: # noqa if body is None: body = self._last_bar_lines[0] = QLineF( - i + bg, l, + i + bg, lo, i + step_size - bg, h, ) else: # update body body.setLine( - body.x1(), l, + body.x1(), lo, body.x2(), h, ) diff --git a/piker/ui/_position.py b/piker/ui/_position.py index 11aca3e9..a664561e 100644 --- a/piker/ui/_position.py +++ b/piker/ui/_position.py @@ -279,7 +279,7 @@ class SettingsPane: elif key != 'account': # numeric fields entry try: - value = puterize(value) + value: float = puterize(value) except ValueError as err: log.error(err.args[0]) return False @@ -292,7 +292,7 @@ class SettingsPane: lpos = mode.current_pp.live_pp if alloc.size_unit == 'currency': - dsize = lpos.dsize + dsize: float = lpos.dsize if dsize > value: log.error( f'limit must > then current pp: {dsize}'