From 2b76baeb1003cea99189475038bd44c3503e429b Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 6 Sep 2022 14:30:35 -0400 Subject: [PATCH] Pass god widget to line editor and order mode instances --- piker/ui/_display.py | 3 +-- piker/ui/order_mode.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/piker/ui/_display.py b/piker/ui/_display.py index e55f6ce3..0cd21dbb 100644 --- a/piker/ui/_display.py +++ b/piker/ui/_display.py @@ -1020,8 +1020,7 @@ async def display_symbol_data( async with ( open_order_mode( feed, - chart, - hist_chart, + godwidget, fqsn, order_mode_started ) diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index 4fdfafcb..d13d2b86 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -67,7 +67,10 @@ from ._forms import open_form_input_handling if TYPE_CHECKING: - from ._chart import ChartPlotWidget + from ._chart import ( + ChartPlotWidget, + GodWidget, + ) log = get_logger(__name__) @@ -110,6 +113,7 @@ class OrderMode: ''' chart: ChartPlotWidget # type: ignore # noqa + hist_chart: ChartPlotWidget # type: ignore # noqa nursery: trio.Nursery quote_feed: Feed book: OrderBook @@ -577,8 +581,7 @@ class OrderMode: async def open_order_mode( feed: Feed, - chart: ChartPlotWidget, # noqa - hist_chart: ChartPlotWidget, # noqa + godw: GodWidget, fqsn: str, started: trio.Event, @@ -591,6 +594,9 @@ async def open_order_mode( state, mostly graphics / UI. ''' + chart = godw.rt_linked.chart + hist_chart = godw.hist_linked.chart + multistatus = chart.window().status_bar done = multistatus.open_status('starting order mode..') @@ -616,11 +622,9 @@ async def open_order_mode( ): log.info(f'Opening order mode for {fqsn}') - rt_view = chart.view - hist_view = chart.view # annotations editors - lines = LineEditor(chart=chart) + lines = LineEditor(godw=godw) arrows = ArrowEditor(chart, {}) # symbol id @@ -732,6 +736,7 @@ async def open_order_mode( # a namespace.. mode = OrderMode( chart, + hist_chart, tn, feed, book,