diff --git a/piker/ui/monitor.py b/piker/ui/monitor.py index fafab986..237f6432 100644 --- a/piker/ui/monitor.py +++ b/piker/ui/monitor.py @@ -148,13 +148,14 @@ async def stream_symbol_selection(): """ widgets = tractor.current_actor().statespace['widgets'] table = widgets['table'] - q = trio.Queue(1) - table._click_queues.append(q) + send_chan, recv_chan = trio.open_memory_channel(0) + table._click_queues.append(send_chan) try: - async for symbol in q: - yield symbol + async with recv_chan: + async for symbol in recv_chan: + yield symbol finally: - table._click_queues.remove(q) + table._click_queues.remove(send_chan) async def _async_main( diff --git a/piker/ui/tabular.py b/piker/ui/tabular.py index 7a9aca2f..bb307a91 100644 --- a/piker/ui/tabular.py +++ b/piker/ui/tabular.py @@ -383,8 +383,8 @@ class Row(HoverBehavior, GridLayout): def on_press(self, value=None): log.info(f"Pressed row for {self._last_record['symbol']}") if self.table and not self.is_header: - for q in self.table._click_queues: - q.put_nowait(self._last_record['symbol']) + for sendchan in self.table._click_queues: + sendchan.send_nowait(self._last_record['symbol']) class TickerTable(GridLayout): @@ -399,7 +399,7 @@ class TickerTable(GridLayout): self._auto_sort = auto_sort self._symbols2index = {} self._sorted = [] - self._click_queues: List[trio.Queue] = [] + self._click_queues: List[trio.abc.SendChannel[str]] = [] def append_row(self, key, row): """Append a `Row` of `Cell` objects to this table.