From c8bff81220b968672df0cd5d865dbd1d772ade62 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 11 Aug 2022 19:58:53 -0400 Subject: [PATCH] Add runtime guards around feed pausing during interaction --- piker/ui/_interaction.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/piker/ui/_interaction.py b/piker/ui/_interaction.py index d8f65dd9..71797a33 100644 --- a/piker/ui/_interaction.py +++ b/piker/ui/_interaction.py @@ -221,6 +221,7 @@ async def handle_viewmode_kb_inputs( # TODO: show pp config mini-params in status bar widget # mode.pp_config.show() + trigger_type: str = 'dark' if ( # 's' for "submit" to activate "live" order Qt.Key_S in pressed or @@ -228,9 +229,6 @@ async def handle_viewmode_kb_inputs( ): trigger_type: str = 'live' - else: - trigger_type: str = 'dark' - # order mode trigger "actions" if Qt.Key_D in pressed: # for "damp eet" action = 'sell' @@ -397,8 +395,11 @@ class ChartView(ViewBox): ''' if self._ic is None: - self.chart.pause_all_feeds() - self._ic = trio.Event() + try: + self.chart.pause_all_feeds() + self._ic = trio.Event() + except RuntimeError: + pass def signal_ic( self, @@ -411,9 +412,12 @@ class ChartView(ViewBox): ''' if self._ic: - self._ic.set() - self._ic = None - self.chart.resume_all_feeds() + try: + self._ic.set() + self._ic = None + self.chart.resume_all_feeds() + except RuntimeError: + pass @asynccontextmanager async def open_async_input_handler( @@ -669,7 +673,10 @@ class ChartView(ViewBox): # XXX: WHY ev.accept() - self.start_ic() + try: + self.start_ic() + except RuntimeError: + pass # if self._ic is None: # self.chart.pause_all_feeds() # self._ic = trio.Event()