From f996ee9ceb22cbf8e717e10ff4083dd03e93bfb9 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 1 Feb 2023 18:12:43 +0100 Subject: [PATCH] fix #592 (crash on mouse click in TDR window) (#593) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix #592 (crash on mouse click in TDR window) AttributeError: 'list' object has no attribute 'size' Signed-off-by: Martin * Apply suggestions from code review Looks better, I was too much focused on the "size" and it was all about the emptiness. Co-authored-by: Holger Müller --------- Signed-off-by: Martin Co-authored-by: Holger Müller --- NanoVNASaver/Charts/TDR.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NanoVNASaver/Charts/TDR.py b/NanoVNASaver/Charts/TDR.py index 02c43cc..0530d1f 100644 --- a/NanoVNASaver/Charts/TDR.py +++ b/NanoVNASaver/Charts/TDR.py @@ -258,7 +258,7 @@ class TDRChart(Chart): return a0.accept() width = self.width() - self.leftMargin - self.rightMargin - if self.tdrWindow.td.size: + if self.tdrWindow.td: if self.fixedSpan: max_index = np.searchsorted( self.tdrWindow.distance_axis, self.maxDisplayLength * 2) @@ -436,7 +436,7 @@ class TDRChart(Chart): qp.end() def valueAtPosition(self, y): - if self.tdrWindow.td.size: + if self.tdrWindow.td: height = self.height() - self.topMargin - self.bottomMargin absy = (self.height() - y) - self.bottomMargin if self.fixedValues: @@ -454,7 +454,7 @@ class TDRChart(Chart): return 0 def lengthAtPosition(self, x, limit=True): - if not self.tdrWindow.td.size: + if not self.tdrWindow.td: return 0 width = self.width() - self.leftMargin - self.rightMargin absx = x - self.leftMargin