From 7577443f95bdc6a73d9c24fab622bb7c6e4b38a8 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 6 Mar 2022 17:15:43 -0500 Subject: [PATCH] Add guard for real-time-not-active last line is `None` case --- piker/ui/_curve.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/piker/ui/_curve.py b/piker/ui/_curve.py index f10f874c..30a42b05 100644 --- a/piker/ui/_curve.py +++ b/piker/ui/_curve.py @@ -140,8 +140,8 @@ class FastAppendCurve(pg.PlotCurveItem): # self.last_step_pen = pg.mkPen(hcolor(color), width=2) self.last_step_pen = pg.mkPen(pen, width=2) - self._last_line: QLineF = None - self._last_step_rect: QRectF = None + self._last_line: Optional[QLineF] = None + self._last_step_rect: Optional[QRectF] = None # flat-top style histogram-like discrete curve self._step_mode: bool = step_mode @@ -388,12 +388,13 @@ class FastAppendCurve(pg.PlotCurveItem): # p.drawPath(self.path) # profiler('.drawPath()') - p.setPen(self.last_step_pen) - p.drawLine(self._last_line) - profiler('.drawLine()') + if self._last_line: + p.setPen(self.last_step_pen) + p.drawLine(self._last_line) + profiler('.drawLine()') + p.setPen(self.opts['pen']) # else: - p.setPen(self.opts['pen']) p.drawPath(self.path) profiler('.drawPath()')