From 271e378ce3413690dc6d188f160461aece5f5487 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 6 Sep 2022 21:18:41 -0400 Subject: [PATCH] Add `GodWidget.iter_linked()` interator over linked split charts --- piker/ui/_chart.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/piker/ui/_chart.py b/piker/ui/_chart.py index f7d7a9df..f919f396 100644 --- a/piker/ui/_chart.py +++ b/piker/ui/_chart.py @@ -19,7 +19,11 @@ High level chart-widget apis. ''' from __future__ import annotations -from typing import Optional, TYPE_CHECKING +from typing import ( + Iterator, + Optional, + TYPE_CHECKING, +) from PyQt5 import QtCore, QtWidgets from PyQt5.QtCore import ( @@ -195,7 +199,7 @@ class GodWidget(QWidget): if not self.vbox.isEmpty(): for linked in [self.rt_linked, self.hist_linked]: - # XXX: this is CRITICAL especially with pixel buffer caching + # XXX: this is CRITICAL especially with pixel buffer caching linked.hide() linked.unfocus() # self.hist_linked.hide() @@ -308,10 +312,11 @@ class GodWidget(QWidget): self._resizing = False def get_cursor(self) -> Cursor: - c = self._active_cursor - assert c - return c + return self._active_cursor + def iter_linked(self) -> Iterator[LinkedSplits]: + for linked in [self.hist_linked, self.rt_linked]: + yield linked class ChartnPane(QFrame):