catch errors

This commit is contained in:
Johannes Pohl
2017-03-29 10:01:45 +02:00
parent 0dbc126805
commit 84642fd5b0
2 changed files with 8 additions and 3 deletions

View File

@@ -48,7 +48,10 @@ class PLabelTableModel(QAbstractTableModel):
def data(self, index: QModelIndex, role=Qt.DisplayRole):
i, j = index.row(), index.column()
if role == Qt.DisplayRole:
lbl = self.message_type[i]
try:
lbl = self.message_type[i]
except IndexError:
return False
if j == 0:
return lbl.name
elif j == 1:

View File

@@ -238,8 +238,10 @@ class Signal(QObject):
@property
def real_plot_data(self):
return self.data.real
try:
return self.data.real
except AttributeError:
return np.zeros(0, dtype=np.float32)
@property
def wave_data(self):
return bytearray(np.multiply(-1, (np.round(self.data.real * 127)).astype(np.int8)))