From b9ee0997a7d22de5eb574192c60bfccd372612c3 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 6 Sep 2021 12:42:25 -0400 Subject: [PATCH] Only do tracker update if pp msg is received for sym --- piker/ui/order_mode.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index 00f675406..85555bad0 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -574,31 +574,32 @@ async def open_order_mode( # so that view handlers can access it view.order_mode = mode - # make fill bar and positioning snapshot - # XXX: this need to be called *before* the first - # pp tracker update(s) below to ensure the limit size unit has - # been correctly set prior to updating the line's pp size label - # (the one on the RHS) - order_pane.init_status_ui() + our_sym = mode.chart.linked._symbol.key # update any exising position + pp_msg = None for sym, msg in positions.items(): - - our_sym = mode.chart.linked._symbol.key if sym.lower() in our_sym: + pp_msg = msg + break + # make fill bar and positioning snapshot + # XXX: this need to be called *before* the first + # pp tracker update(s) below to ensure the limit size unit has + # been correctly set prior to updating the line's pp size label + # (the one on the RHS). + # TODO: should probably split out the alloc config from the UI + # config startup steps.. + order_pane.init_status_ui() - # call this again now since we've configured - # the allocator from the asset type...super dumb. - # we should probably make the allocator config - # and explitict helper func call that takes in the aloc and - # the postion / symbol info then take that alloc ref and - # update the pp_tracker and pp_pane. - # pp_tracker.update(msg, position=pp_tracker.startup_pp) + # we should probably make the allocator config + # and explitict helper func call that takes in the aloc and + # the postion / symbol info then take that alloc ref and + # update the pp_tracker and pp_pane? + if pp_msg: + pp_tracker.update_from_pp_msg(msg) - pp_tracker.update_from_pp_msg(msg, position=pp_tracker.startup_pp) - pp_tracker.update_from_pp_msg(msg) - break + order_pane.update_status_ui() live_pp = mode.pp.live_pp size = live_pp.size