Add runtime guards around feed pausing during interaction

open_order_loading
Tyler Goodlet 2022-08-11 19:58:53 -04:00
parent 2aec1c5f1d
commit c8bff81220
1 changed files with 16 additions and 9 deletions

View File

@ -221,6 +221,7 @@ async def handle_viewmode_kb_inputs(
# TODO: show pp config mini-params in status bar widget # TODO: show pp config mini-params in status bar widget
# mode.pp_config.show() # mode.pp_config.show()
trigger_type: str = 'dark'
if ( if (
# 's' for "submit" to activate "live" order # 's' for "submit" to activate "live" order
Qt.Key_S in pressed or Qt.Key_S in pressed or
@ -228,9 +229,6 @@ async def handle_viewmode_kb_inputs(
): ):
trigger_type: str = 'live' trigger_type: str = 'live'
else:
trigger_type: str = 'dark'
# order mode trigger "actions" # order mode trigger "actions"
if Qt.Key_D in pressed: # for "damp eet" if Qt.Key_D in pressed: # for "damp eet"
action = 'sell' action = 'sell'
@ -397,8 +395,11 @@ class ChartView(ViewBox):
''' '''
if self._ic is None: if self._ic is None:
self.chart.pause_all_feeds() try:
self._ic = trio.Event() self.chart.pause_all_feeds()
self._ic = trio.Event()
except RuntimeError:
pass
def signal_ic( def signal_ic(
self, self,
@ -411,9 +412,12 @@ class ChartView(ViewBox):
''' '''
if self._ic: if self._ic:
self._ic.set() try:
self._ic = None self._ic.set()
self.chart.resume_all_feeds() self._ic = None
self.chart.resume_all_feeds()
except RuntimeError:
pass
@asynccontextmanager @asynccontextmanager
async def open_async_input_handler( async def open_async_input_handler(
@ -669,7 +673,10 @@ class ChartView(ViewBox):
# XXX: WHY # XXX: WHY
ev.accept() ev.accept()
self.start_ic() try:
self.start_ic()
except RuntimeError:
pass
# if self._ic is None: # if self._ic is None:
# self.chart.pause_all_feeds() # self.chart.pause_all_feeds()
# self._ic = trio.Event() # self._ic = trio.Event()