Fix curve up-sampling on `'r'` hotkey

Previously when very zoomed out and using the `'r'` hotkey the
interaction handler loop wouldn't trigger a re-(up)sampling to get
a more detailed curve graphic and instead the previous downsampled
(under-detailed) graphic would show. Fix that by ensuring we yield back
to the Qt event loop and do at least a couple render cycles with paired
`.interact_graphics_cycle()` calls.

Further this flips the `.start/signal_ic()` methods to use the new
`.reset_graphics_caches()` ctr-mngr method.
storage_cli
Tyler Goodlet 2023-03-05 21:23:42 -05:00
parent 08f1f569d0
commit 1d649e55ca
1 changed files with 19 additions and 16 deletions

View File

@ -154,9 +154,12 @@ async def handle_viewmode_kb_inputs(
god = order_mode.godw # noqa god = order_mode.godw # noqa
feed = order_mode.feed # noqa feed = order_mode.feed # noqa
chart = order_mode.chart # noqa chart = order_mode.chart # noqa
viz = chart.main_viz # noqa
vlm_chart = chart.linked.subplots['volume'] # noqa vlm_chart = chart.linked.subplots['volume'] # noqa
vlm_viz = vlm_chart.main_viz # noqa
dvlm_pi = vlm_chart._vizs['dolla_vlm'].plot # noqa dvlm_pi = vlm_chart._vizs['dolla_vlm'].plot # noqa
await tractor.breakpoint() await tractor.breakpoint()
view.interact_graphics_cycle()
# SEARCH MODE # # SEARCH MODE #
# ctlr-<space>/<l> for "lookup", "search" -> open search tree # ctlr-<space>/<l> for "lookup", "search" -> open search tree
@ -185,9 +188,13 @@ async def handle_viewmode_kb_inputs(
# View modes # View modes
if key == Qt.Key_R: if key == Qt.Key_R:
# TODO: set this for all subplots # NOTE: seems that if we don't yield a Qt render
# edge triggered default view activation # cycle then the m4 downsampled curves will show here
view.chart.default_view() # without another reset..
view._viz.default_view()
view.interact_graphics_cycle()
await trio.sleep(0)
view.interact_graphics_cycle()
if len(fast_key_seq) > 1: if len(fast_key_seq) > 1:
# begin matches against sequences # begin matches against sequences
@ -427,16 +434,11 @@ class ChartView(ViewBox):
if self._in_interact is None: if self._in_interact is None:
chart = self.chart chart = self.chart
try: try:
chart.pause_all_feeds()
self._in_interact = trio.Event() self._in_interact = trio.Event()
for viz in chart.iter_vizs():
chart.pause_all_feeds()
self._interact_stack.enter_context( self._interact_stack.enter_context(
viz.graphics.reset_cache(), chart.reset_graphics_caches()
)
dsg = viz.ds_graphics
if dsg:
self._interact_stack.enter_context(
dsg.reset_cache(),
) )
except RuntimeError: except RuntimeError:
pass pass
@ -453,10 +455,11 @@ class ChartView(ViewBox):
''' '''
if self._in_interact: if self._in_interact:
try: try:
self._in_interact.set()
self._in_interact = None
self._interact_stack.close() self._interact_stack.close()
self.chart.resume_all_feeds() self.chart.resume_all_feeds()
self._in_interact.set()
self._in_interact = None
except RuntimeError: except RuntimeError:
pass pass