gui: dock state save/restore

This commit is contained in:
Sebastien Bourdeauducq 2016-02-14 13:46:15 +01:00
parent daf49efa04
commit 3c12c13a67
8 changed files with 11 additions and 3 deletions

View File

@ -47,10 +47,10 @@ class MainWindow(QtGui.QMainWindow):
self.exit_request.set() self.exit_request.set()
def save_state(self): def save_state(self):
return bytes(self.saveGeometry()) return bytes(self.saveState())
def restore_state(self, state): def restore_state(self, state):
self.restoreGeometry(QtCore.QByteArray(state)) self.restoreState(QtCore.QByteArray(state))
def main(): def main():

View File

@ -188,6 +188,7 @@ _templates = [
class AppletsDock(QtWidgets.QDockWidget): class AppletsDock(QtWidgets.QDockWidget):
def __init__(self, main_window, datasets_sub): def __init__(self, main_window, datasets_sub):
QtWidgets.QDockWidget.__init__(self, "Applets") QtWidgets.QDockWidget.__init__(self, "Applets")
self.setObjectName("Applets")
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
QtWidgets.QDockWidget.DockWidgetFloatable) QtWidgets.QDockWidget.DockWidgetFloatable)

View File

@ -31,6 +31,7 @@ class Model(DictSyncTreeSepModel):
class DatasetsDock(QtWidgets.QDockWidget): class DatasetsDock(QtWidgets.QDockWidget):
def __init__(self, datasets_sub, dataset_ctl): def __init__(self, datasets_sub, dataset_ctl):
QtWidgets.QDockWidget.__init__(self, "Datasets") QtWidgets.QDockWidget.__init__(self, "Datasets")
self.setObjectName("Datasets")
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
QtWidgets.QDockWidget.DockWidgetFloatable) QtWidgets.QDockWidget.DockWidgetFloatable)
self.dataset_ctl = dataset_ctl self.dataset_ctl = dataset_ctl

View File

@ -137,7 +137,9 @@ class _ExperimentDock(QtWidgets.QDockWidget):
sigClosed = QtCore.pyqtSignal() sigClosed = QtCore.pyqtSignal()
def __init__(self, manager, expurl): 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() self.layout = QtWidgets.QGridLayout()
top_widget = QtWidgets.QWidget() top_widget = QtWidgets.QWidget()

View File

@ -119,6 +119,7 @@ class ExplorerDock(QtWidgets.QDockWidget):
def __init__(self, status_bar, exp_manager, d_shortcuts, def __init__(self, status_bar, exp_manager, d_shortcuts,
explist_sub, schedule_ctl, experiment_db_ctl): explist_sub, schedule_ctl, experiment_db_ctl):
QtWidgets.QDockWidget.__init__(self, "Explorer") QtWidgets.QDockWidget.__init__(self, "Explorer")
self.setObjectName("Explorer")
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
QtWidgets.QDockWidget.DockWidgetFloatable) QtWidgets.QDockWidget.DockWidgetFloatable)

View File

@ -215,6 +215,7 @@ class _DeviceManager:
class _MonInjDock(QtWidgets.QDockWidget): class _MonInjDock(QtWidgets.QDockWidget):
def __init__(self, name): def __init__(self, name):
QtWidgets.QDockWidget.__init__(self, name) QtWidgets.QDockWidget.__init__(self, name)
self.setObjectName(name)
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
QtWidgets.QDockWidget.DockWidgetFloatable) QtWidgets.QDockWidget.DockWidgetFloatable)

View File

@ -58,6 +58,7 @@ class Model(DictSyncModel):
class ScheduleDock(QtWidgets.QDockWidget): class ScheduleDock(QtWidgets.QDockWidget):
def __init__(self, status_bar, schedule_ctl, schedule_sub): def __init__(self, status_bar, schedule_ctl, schedule_sub):
QtWidgets.QDockWidget.__init__(self, "Schedule") QtWidgets.QDockWidget.__init__(self, "Schedule")
self.setObjectName("Schedule")
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
QtWidgets.QDockWidget.DockWidgetFloatable) QtWidgets.QDockWidget.DockWidgetFloatable)

View File

@ -11,6 +11,7 @@ logger = logging.getLogger(__name__)
class ShortcutsDock(QtWidgets.QDockWidget): class ShortcutsDock(QtWidgets.QDockWidget):
def __init__(self, main_window, exp_manager): def __init__(self, main_window, exp_manager):
QtWidgets.QDockWidget.__init__(self, "Shortcuts") QtWidgets.QDockWidget.__init__(self, "Shortcuts")
self.setObjectName("Shortcuts")
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
QtWidgets.QDockWidget.DockWidgetFloatable) QtWidgets.QDockWidget.DockWidgetFloatable)