fix #592 (crash on mouse click in TDR window) (#593)

* fix #592 (crash on mouse click in TDR window)

AttributeError: 'list' object has no attribute 'size'

Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>

* 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 <zarath@gmx.de>

---------

Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>
Co-authored-by: Holger Müller <zarath@gmx.de>
pull/604/head
Martin 2023-02-01 18:12:43 +01:00 zatwierdzone przez Holger Müller
rodzic 4cebe94b87
commit f377c999fa
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -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