From edd23977f83e3e2e80790e08543fe9fdc29207dc Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Mon, 19 Feb 2024 11:37:46 +0800 Subject: [PATCH] waveform: delete all waveforms confirm dialog --- artiq/dashboard/waveform.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/artiq/dashboard/waveform.py b/artiq/dashboard/waveform.py index cb3299136..4191e172a 100644 --- a/artiq/dashboard/waveform.py +++ b/artiq/dashboard/waveform.py @@ -455,6 +455,18 @@ class _WaveformView(QtWidgets.QWidget): self.cursorMove.connect(self.onCursorMove) + self.confirm_delete_dialog = QtWidgets.QMessageBox(self) + self.confirm_delete_dialog.setIcon( + QtWidgets.QMessageBox.Icon.Warning + ) + self.confirm_delete_dialog.setText("Delete all waveforms?") + self.confirm_delete_dialog.setStandardButtons( + QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel + ) + self.confirm_delete_dialog.setDefaultButton( + QtWidgets.QMessageBox.Ok + ) + def setModel(self, model): self._model = model self._model.dataChanged.connect(self.onDataChange) @@ -462,6 +474,7 @@ class _WaveformView(QtWidgets.QWidget): self._model.rowsRemoved.connect(self.onRemove) self._model.rowsMoved.connect(self.onMove) self._splitter.dropped.connect(self._model.move) + self.confirm_delete_dialog.accepted.connect(self._model.clear) def setTimescale(self, timescale): self._timescale = timescale @@ -525,8 +538,8 @@ class _WaveformView(QtWidgets.QWidget): action = QtWidgets.QAction("Delete waveform", w) action.triggered.connect(lambda: self._delete_waveform(w)) w.addAction(action) - action = QtWidgets.QAction("Clear waveforms", w) - action.triggered.connect(self._model.clear) + action = QtWidgets.QAction("Delete all waveforms", w) + action.triggered.connect(self.confirm_delete_dialog.open) w.addAction(action) return w