From fc74b78a459948b5132cb36281d81dfb0e90c120 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Fri, 9 Jun 2023 16:35:28 +0100 Subject: [PATCH] dashboard: Make Ctrl-Alt-W close non-docked applets only I had introduced this in f11aef74b as a means of quickly cleaning up after e.g. an exploratory session where a lot of transient applets were opened from ndscan, or for a dashboard that has been running for a while with CCBs enabled but without anybody actually working there. It turns out that one usually wants the few docked applets to stay open, as they were necessarily arranged manually at some prior point. And as a corollary to the latter, if one did want to close them as well, doing so manually would not be too onerous either. --- RELEASE_NOTES.rst | 4 ++++ artiq/gui/applets.py | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 0fd58fda3..98f111c2d 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -28,6 +28,10 @@ Highlights: * Distributed DMA is now supported, allowing DMA to be run directly on satellites for corresponding RTIO events, increasing bandwidth in scenarios with heavy satellite usage. * API extensions have been implemented, enabling applets to directly modify datasets. +* Dashboard: + - The "Close all applets" command (shortcut: Ctrl-Alt-W) now ignores docked applets, + making it a convenient way to clean up after exploratory work without destroying a + carefully arranged default workspace. * Persistent datasets are now stored in a LMDB database for improved performance. PYON databases can be converted with the script below. diff --git a/artiq/gui/applets.py b/artiq/gui/applets.py index a9e22b420..4b3d2b98b 100644 --- a/artiq/gui/applets.py +++ b/artiq/gui/applets.py @@ -397,11 +397,12 @@ 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) + close_nondocked_action = QtWidgets.QAction("Close non-docked applets", self.table) + close_nondocked_action.setShortcut("CTRL+ALT+W") + close_nondocked_action.setShortcutContext(QtCore.Qt.ApplicationShortcut) + close_nondocked_action.triggered.connect(self.close_nondocked) + self.table.addAction(close_nondocked_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) @@ -674,12 +675,15 @@ class AppletsDock(QtWidgets.QDockWidget): def restore_state(self, state): self.restore_state_item(state, None) - def close_all(self): + def close_nondocked(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: + if cwi.applet_dock is not None: + if not cwi.applet_dock.isFloating(): + continue cwi.setCheckState(0, QtCore.Qt.Unchecked) elif cwi.ty == "group": walk(cwi)