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.
log_linearized_curve_overlays
Tyler Goodlet 2023-03-05 21:23:42 -05:00
parent 57d56c4791
commit fc98d66ffc
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
feed = order_mode.feed # noqa
chart = order_mode.chart # noqa
viz = chart.main_viz # noqa
vlm_chart = chart.linked.subplots['volume'] # noqa
vlm_viz = vlm_chart.main_viz # noqa
dvlm_pi = vlm_chart._vizs['dolla_vlm'].plot # noqa
await tractor.breakpoint()
view.interact_graphics_cycle()
# SEARCH MODE #
# ctlr-<space>/<l> for "lookup", "search" -> open search tree
@ -185,9 +188,13 @@ async def handle_viewmode_kb_inputs(
# View modes
if key == Qt.Key_R:
# TODO: set this for all subplots
# edge triggered default view activation
view.chart.default_view()
# NOTE: seems that if we don't yield a Qt render
# cycle then the m4 downsampled curves will show here
# 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:
# begin matches against sequences
@ -427,16 +434,11 @@ class ChartView(ViewBox):
if self._in_interact is None:
chart = self.chart
try:
chart.pause_all_feeds()
self._in_interact = trio.Event()
for viz in chart.iter_vizs():
chart.pause_all_feeds()
self._interact_stack.enter_context(
viz.graphics.reset_cache(),
)
dsg = viz.ds_graphics
if dsg:
self._interact_stack.enter_context(
dsg.reset_cache(),
chart.reset_graphics_caches()
)
except RuntimeError:
pass
@ -453,10 +455,11 @@ class ChartView(ViewBox):
'''
if self._in_interact:
try:
self._in_interact.set()
self._in_interact = None
self._interact_stack.close()
self.chart.resume_all_feeds()
self._in_interact.set()
self._in_interact = None
except RuntimeError:
pass