From 3c12c13a67d5082a25bcf93b0a05a788a0fc8cbb Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 14 Feb 2016 13:46:15 +0100 Subject: [PATCH] gui: dock state save/restore --- artiq/frontend/artiq_gui.py | 4 ++-- artiq/gui/applets.py | 1 + artiq/gui/datasets.py | 1 + artiq/gui/experiments.py | 4 +++- artiq/gui/explorer.py | 1 + artiq/gui/moninj.py | 1 + artiq/gui/schedule.py | 1 + artiq/gui/shortcuts.py | 1 + 8 files changed, 11 insertions(+), 3 deletions(-) diff --git a/artiq/frontend/artiq_gui.py b/artiq/frontend/artiq_gui.py index 1a882c45e..7f5394f78 100755 --- a/artiq/frontend/artiq_gui.py +++ b/artiq/frontend/artiq_gui.py @@ -47,10 +47,10 @@ class MainWindow(QtGui.QMainWindow): self.exit_request.set() def save_state(self): - return bytes(self.saveGeometry()) + return bytes(self.saveState()) def restore_state(self, state): - self.restoreGeometry(QtCore.QByteArray(state)) + self.restoreState(QtCore.QByteArray(state)) def main(): diff --git a/artiq/gui/applets.py b/artiq/gui/applets.py index 9507c87c3..ddc801726 100644 --- a/artiq/gui/applets.py +++ b/artiq/gui/applets.py @@ -188,6 +188,7 @@ _templates = [ class AppletsDock(QtWidgets.QDockWidget): def __init__(self, main_window, datasets_sub): QtWidgets.QDockWidget.__init__(self, "Applets") + self.setObjectName("Applets") self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable) diff --git a/artiq/gui/datasets.py b/artiq/gui/datasets.py index 50f4e60b8..ac0c7d430 100644 --- a/artiq/gui/datasets.py +++ b/artiq/gui/datasets.py @@ -31,6 +31,7 @@ class Model(DictSyncTreeSepModel): class DatasetsDock(QtWidgets.QDockWidget): def __init__(self, datasets_sub, dataset_ctl): QtWidgets.QDockWidget.__init__(self, "Datasets") + self.setObjectName("Datasets") self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable) self.dataset_ctl = dataset_ctl diff --git a/artiq/gui/experiments.py b/artiq/gui/experiments.py index 5a964df1c..8b81edc92 100644 --- a/artiq/gui/experiments.py +++ b/artiq/gui/experiments.py @@ -137,7 +137,9 @@ class _ExperimentDock(QtWidgets.QDockWidget): sigClosed = QtCore.pyqtSignal() def __init__(self, manager, expurl): - QtWidgets.QDockWidget.__init__(self, "Exp: " + expurl) + name = "Exp: " + expurl + QtWidgets.QDockWidget.__init__(self, name) + self.setObjectName(name) self.layout = QtWidgets.QGridLayout() top_widget = QtWidgets.QWidget() diff --git a/artiq/gui/explorer.py b/artiq/gui/explorer.py index 73ce6ce96..079b1dcbe 100644 --- a/artiq/gui/explorer.py +++ b/artiq/gui/explorer.py @@ -119,6 +119,7 @@ class ExplorerDock(QtWidgets.QDockWidget): def __init__(self, status_bar, exp_manager, d_shortcuts, explist_sub, schedule_ctl, experiment_db_ctl): QtWidgets.QDockWidget.__init__(self, "Explorer") + self.setObjectName("Explorer") self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable) diff --git a/artiq/gui/moninj.py b/artiq/gui/moninj.py index 755ceecad..32b8f9656 100644 --- a/artiq/gui/moninj.py +++ b/artiq/gui/moninj.py @@ -215,6 +215,7 @@ class _DeviceManager: class _MonInjDock(QtWidgets.QDockWidget): def __init__(self, name): QtWidgets.QDockWidget.__init__(self, name) + self.setObjectName(name) self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable) diff --git a/artiq/gui/schedule.py b/artiq/gui/schedule.py index 4265c5ea7..f43baf5ae 100644 --- a/artiq/gui/schedule.py +++ b/artiq/gui/schedule.py @@ -58,6 +58,7 @@ class Model(DictSyncModel): class ScheduleDock(QtWidgets.QDockWidget): def __init__(self, status_bar, schedule_ctl, schedule_sub): QtWidgets.QDockWidget.__init__(self, "Schedule") + self.setObjectName("Schedule") self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable) diff --git a/artiq/gui/shortcuts.py b/artiq/gui/shortcuts.py index 7ffec34db..9bc90c365 100644 --- a/artiq/gui/shortcuts.py +++ b/artiq/gui/shortcuts.py @@ -11,6 +11,7 @@ logger = logging.getLogger(__name__) class ShortcutsDock(QtWidgets.QDockWidget): def __init__(self, main_window, exp_manager): QtWidgets.QDockWidget.__init__(self, "Shortcuts") + self.setObjectName("Shortcuts") self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable)