diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index c4df7dfd9..2bf8dfaf8 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -37,6 +37,8 @@ Highlights: - A "Quick Open" dialog to open experiments by typing part of their name can be brought up Ctrl-P (Ctrl+Return to immediately submit the selected entry with the default arguments). + - The Applets dock now has a context menu command to quickly close all open + applets (shortcut: Ctrl-Alt-W). * Experiment results are now always saved to HDF5, even if run() fails. * Core device: ``panic_reset 1`` now correctly resets the kernel CPU as well if communication CPU panic occurs. diff --git a/artiq/gui/applets.py b/artiq/gui/applets.py index 432fb458d..178593a07 100644 --- a/artiq/gui/applets.py +++ b/artiq/gui/applets.py @@ -370,6 +370,11 @@ class AppletsDock(QtWidgets.QDockWidget): delete_action.setShortcutContext(QtCore.Qt.WidgetShortcut) delete_action.triggered.connect(self.delete) self.table.addAction(delete_action) + close_all_action = QtWidgets.QAction("Close all applets", self.table) + close_all_action.setShortcut("CTRL+ALT+W") + close_all_action.setShortcutContext(QtCore.Qt.ApplicationShortcut) + close_all_action.triggered.connect(self.close_all) + self.table.addAction(close_all_action) new_group_action = QtWidgets.QAction("New group", self.table) new_group_action.triggered.connect(partial(self.new_with_parent, self.new_group)) self.table.addAction(new_group_action) @@ -641,3 +646,14 @@ class AppletsDock(QtWidgets.QDockWidget): def restore_state(self, state): self.restore_state_item(state, None) + + def close_all(self): + def walk(wi): + for i in range(wi.childCount()): + cwi = wi.child(i) + if cwi.ty == "applet": + if cwi.checkState(0) == QtCore.Qt.Checked: + cwi.setCheckState(0, QtCore.Qt.Unchecked) + elif cwi.ty == "group": + walk(cwi) + walk(self.table.invisibleRootItem())