From 212882a5a58fdafef4dae54da61bb96f41a3e486 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 20 May 2021 16:10:42 -0400 Subject: [PATCH] Don't try to show xhair if no active plot --- piker/ui/_chart.py | 1 + piker/ui/_graphics/_cursor.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/piker/ui/_chart.py b/piker/ui/_chart.py index 32743cfb..be5aaf7a 100644 --- a/piker/ui/_chart.py +++ b/piker/ui/_chart.py @@ -172,6 +172,7 @@ class ChartSpace(QtGui.QWidget): # XXX: pretty sure we don't need this # remove any existing plots? + # XXX: ahh we might want to support cache unloading.. # self.vbox.removeWidget(self.linkedcharts) # switching to a new viewable chart diff --git a/piker/ui/_graphics/_cursor.py b/piker/ui/_graphics/_cursor.py index 159c773e..0919f6f9 100644 --- a/piker/ui/_graphics/_cursor.py +++ b/piker/ui/_graphics/_cursor.py @@ -435,7 +435,12 @@ class Cursor(pg.GraphicsObject): self, y_label_level: float = None, ) -> None: - g = self.graphics[self.active_plot] + + plot = self.active_plot + if not plot: + return + + g = self.graphics[plot] # show horiz line and y-label g['hl'].show() g['vl'].show()