Finally get chart startup view-state kinda correct
It ended up being what'd you expect, races on the accessing shm buffer data by the UI during the whole "mega-async-startup-everything" phase XD So we add the following list of ad-hoc startup steps: - do `.default_view()` on the slow chart after the fast chart is mostly fully spawned with the intention being to capture the state where the historical buffer is mostly loaded before sizing the view to the graphical form of the data. - resize slow chart sidepanes from the fast chart just before sleeping forever (and after order mode has booted).history_view
parent
40a9761943
commit
1e81feee46
|
@ -851,13 +851,6 @@ async def display_symbol_data(
|
||||||
rt_linked = godwidget.rt_linked
|
rt_linked = godwidget.rt_linked
|
||||||
rt_linked._symbol = symbol
|
rt_linked._symbol = symbol
|
||||||
|
|
||||||
# generate order mode side-pane UI
|
|
||||||
# A ``FieldsForm`` form to configure order entry
|
|
||||||
pp_pane: FieldsForm = mk_order_pane_layout(godwidget)
|
|
||||||
|
|
||||||
# add as next-to-y-axis singleton pane
|
|
||||||
godwidget.pp_pane = pp_pane
|
|
||||||
|
|
||||||
# create top history view chart above the "main rt chart".
|
# create top history view chart above the "main rt chart".
|
||||||
hist_linked = godwidget.hist_linked
|
hist_linked = godwidget.hist_linked
|
||||||
hist_linked._symbol = symbol
|
hist_linked._symbol = symbol
|
||||||
|
@ -872,10 +865,11 @@ async def display_symbol_data(
|
||||||
# don't show when not focussed
|
# don't show when not focussed
|
||||||
hist_linked.cursor.always_show_xlabel = False
|
hist_linked.cursor.always_show_xlabel = False
|
||||||
|
|
||||||
hist_chart.default_view(
|
# generate order mode side-pane UI
|
||||||
bars_from_y=int(len(hist_ohlcv.array)), # size to data
|
# A ``FieldsForm`` form to configure order entry
|
||||||
y_offset=6116*2, # push it a little away from the y-axis
|
# and add as next-to-y-axis singleton pane
|
||||||
)
|
pp_pane: FieldsForm = mk_order_pane_layout(godwidget)
|
||||||
|
godwidget.pp_pane = pp_pane
|
||||||
|
|
||||||
# create main OHLC chart
|
# create main OHLC chart
|
||||||
chart = rt_linked.plot_ohlc_main(
|
chart = rt_linked.plot_ohlc_main(
|
||||||
|
@ -1020,6 +1014,15 @@ async def display_symbol_data(
|
||||||
|
|
||||||
# size view to data prior to order mode init
|
# size view to data prior to order mode init
|
||||||
chart.default_view()
|
chart.default_view()
|
||||||
|
rt_linked.graphics_cycle()
|
||||||
|
await trio.sleep(0)
|
||||||
|
|
||||||
|
hist_chart.default_view(
|
||||||
|
bars_from_y=int(len(hist_ohlcv.array)), # size to data
|
||||||
|
y_offset=6116*2, # push it a little away from the y-axis
|
||||||
|
)
|
||||||
|
hist_linked.graphics_cycle()
|
||||||
|
await trio.sleep(0)
|
||||||
|
|
||||||
async with (
|
async with (
|
||||||
open_order_mode(
|
open_order_mode(
|
||||||
|
@ -1040,6 +1043,8 @@ async def display_symbol_data(
|
||||||
rt_linked.set_split_sizes()
|
rt_linked.set_split_sizes()
|
||||||
hist_linked.resize_sidepanes(from_linked=rt_linked)
|
hist_linked.resize_sidepanes(from_linked=rt_linked)
|
||||||
|
|
||||||
|
# TODO: look into this because not sure why it was
|
||||||
|
# commented out / we ever needed it XD
|
||||||
# NOTE: we pop the volume chart from the subplots set so
|
# NOTE: we pop the volume chart from the subplots set so
|
||||||
# that it isn't double rendered in the display loop
|
# that it isn't double rendered in the display loop
|
||||||
# above since we do a maxmin calc on the volume data to
|
# above since we do a maxmin calc on the volume data to
|
||||||
|
@ -1050,6 +1055,12 @@ async def display_symbol_data(
|
||||||
# close group status
|
# close group status
|
||||||
sbar._status_groups[loading_sym_key][1]()
|
sbar._status_groups[loading_sym_key][1]()
|
||||||
|
|
||||||
|
hist_linked.graphics_cycle()
|
||||||
|
await trio.sleep(0)
|
||||||
|
hist_chart.default_view(
|
||||||
|
bars_from_y=int(len(hist_ohlcv.array)), # size to data
|
||||||
|
y_offset=6116*2, # push it a little away from the y-axis
|
||||||
|
)
|
||||||
|
|
||||||
# let the app run.. bby
|
# let the app run.. bby
|
||||||
# rt_linked.graphics_cycle()
|
|
||||||
await trio.sleep_forever()
|
await trio.sleep_forever()
|
||||||
|
|
|
@ -142,8 +142,8 @@ async def handle_viewmode_kb_inputs(
|
||||||
}
|
}
|
||||||
):
|
):
|
||||||
godw = view._chart.linked.godwidget
|
godw = view._chart.linked.godwidget
|
||||||
|
godw.hist_linked.resize_sidepanes(from_linked=godw.rt_linked)
|
||||||
godw.search.focus()
|
godw.search.focus()
|
||||||
# godw.hist_linked.resize_sidepanes(from_linked=godw.rt_linked)
|
|
||||||
|
|
||||||
# esc and ctrl-c
|
# esc and ctrl-c
|
||||||
if key == Qt.Key_Escape or (ctrl and key == Qt.Key_C):
|
if key == Qt.Key_Escape or (ctrl and key == Qt.Key_C):
|
||||||
|
@ -181,7 +181,8 @@ async def handle_viewmode_kb_inputs(
|
||||||
if key in pressed:
|
if key in pressed:
|
||||||
pressed.remove(key)
|
pressed.remove(key)
|
||||||
|
|
||||||
# QUERY/QUOTE MODE #
|
# QUERY/QUOTE MODE
|
||||||
|
# ----------------
|
||||||
if {Qt.Key_Q}.intersection(pressed):
|
if {Qt.Key_Q}.intersection(pressed):
|
||||||
|
|
||||||
view.linked.cursor.in_query_mode = True
|
view.linked.cursor.in_query_mode = True
|
||||||
|
@ -191,7 +192,6 @@ async def handle_viewmode_kb_inputs(
|
||||||
|
|
||||||
# SELECTION MODE
|
# SELECTION MODE
|
||||||
# --------------
|
# --------------
|
||||||
|
|
||||||
if shift:
|
if shift:
|
||||||
if view.state['mouseMode'] == ViewBox.PanMode:
|
if view.state['mouseMode'] == ViewBox.PanMode:
|
||||||
view.setMouseMode(ViewBox.RectMode)
|
view.setMouseMode(ViewBox.RectMode)
|
||||||
|
@ -212,7 +212,6 @@ async def handle_viewmode_kb_inputs(
|
||||||
|
|
||||||
# ORDER MODE
|
# ORDER MODE
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
# live vs. dark trigger + an action {buy, sell, alert}
|
# live vs. dark trigger + an action {buy, sell, alert}
|
||||||
order_keys_pressed = ORDER_MODE.intersection(pressed)
|
order_keys_pressed = ORDER_MODE.intersection(pressed)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue