From 70f374c293a85232bcaf70f1fb2e48be0a9f1f8a Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Mon, 22 Jan 2024 15:55:29 +0800 Subject: [PATCH] waveform: changes --- artiq/dashboard/waveform.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/artiq/dashboard/waveform.py b/artiq/dashboard/waveform.py index 647154e92..9bde2da3b 100644 --- a/artiq/dashboard/waveform.py +++ b/artiq/dashboard/waveform.py @@ -445,27 +445,27 @@ class _WaveformView(QtWidgets.QWidget): self._model.rowsInserted.connect(self.onInsert) self._model.rowsRemoved.connect(self.onRemove) self._model.rowsMoved.connect(self.onMove) - + def onDataChange(self, top, bottom, roles): first = top.row() last = bottom.row() for i in range(first, last + 1): data = self._model.data(self._model.index(i, 2)) self._splitter.widget(i).onDataChange(data) - + def onInsert(self, parent, first, last): for i in range(first, last + 1): w = self._create_waveform(self.index(i, 0)) self.splitter.insertWidget(i, w) self._resize() - + def onRemove(self, parent, first, last): for i in reversed(range(first, last + 1)): w = self.splitter.widget(i) w.deleteLater() self.splitter.refresh() self._resize() - + def onMove(self, src_parent, src_start, src_end, dest_parent, dest_row): w = self.splitter.widget(src_start) self.splitter.insertWidget(dest_row, w) @@ -492,15 +492,15 @@ class _WaveformModel(QtCore.QAbstractTableModel): self.backing_struct = [] self.headers = ["name", "type", "width", "data"] QtCore.QAbstractTableModel.__init__(self) - + def rowCount(self): return len(self.backing_struct) def columnCount(self): return len(self.headers) - + def data(self, index, role=QtCore.Qt.DisplayRole): - if index.isValid(): + if index.isValid(): return self.backing_struct[index.row()][index.col()] return None @@ -521,12 +521,12 @@ class _WaveformModel(QtCore.QAbstractTableModel): self.backing_struct.insert(dest, self.backing_struct.pop(src)) self.endMoveRows() - def update_data(self, waveform_data): + def update_data(self, waveform_data): for i in range(len(self.backing_struct)): name = self.data(self.index(i, 0)) if name in waveform_data: - self.backing_struct[i][3] = waveform_data[name] - self.dataChanged.emit(self.index(0, 0), + self.backing_struct[i][3] = waveform_data[name] + self.dataChanged.emit(self.index(0, 0), self.index(len(self.backing_struct)-1, len(self.headers)))