Add guard for real-time-not-active last line is `None` case

m4_corrections
Tyler Goodlet 2022-03-06 17:15:43 -05:00
parent fd296fa762
commit 0d062bfe66
1 changed files with 7 additions and 6 deletions

View File

@ -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()')
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()')