From 6986be1b21f5436c2c945ead0238a7d0c5556f37 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 16 Nov 2022 13:40:15 -0500 Subject: [PATCH] Define a single `ChartPlotWidget.feed: Feed` for pause/resume --- piker/ui/_chart.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/piker/ui/_chart.py b/piker/ui/_chart.py index e3967f81..a8d0e20e 100644 --- a/piker/ui/_chart.py +++ b/piker/ui/_chart.py @@ -896,7 +896,7 @@ class ChartPlotWidget(pg.PlotWidget): # registry of overlay curve names self._flows: dict[str, Flow] = {} - self._feeds: dict[Symbol, Feed] = {} + self.feed: Feed | None = None self._labels = {} # registry of underlying graphics self._ysticks = {} # registry of underlying graphics @@ -917,20 +917,18 @@ class ChartPlotWidget(pg.PlotWidget): self._on_screen: bool = False def resume_all_feeds(self): - ... - # try: - # for feed in self._feeds.values(): - # for flume in feed.flumes.values(): - # self.linked.godwidget._root_n.start_soon(flume.resume) - # except RuntimeError: - # # TODO: cancel the qtractor runtime here? - # raise + feed = self.feed + if feed: + try: + self.linked.godwidget._root_n.start_soon(feed.resume) + except RuntimeError: + # TODO: cancel the qtractor runtime here? + raise def pause_all_feeds(self): - ... - # for feed in self._feeds.values(): - # for flume in feed.flumes.values(): - # self.linked.godwidget._root_n.start_soon(flume.pause) + feed = self.feed + if feed: + self.linked.godwidget._root_n.start_soon(feed.pause) @property def view(self) -> ChartView: