From 856706188fa3e0d3ce44e91e679949aa90a32cbd Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Wed, 20 Apr 2016 13:57:12 +0200 Subject: [PATCH] browser: be arrogant re changing state dump formats --- artiq/browser/files.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/artiq/browser/files.py b/artiq/browser/files.py index 62d868a39..395c9bce9 100644 --- a/artiq/browser/files.py +++ b/artiq/browser/files.py @@ -179,18 +179,14 @@ class FilesDock(QtWidgets.QDockWidget): } def restore_state(self, state): - dir = state.get("dir") - if dir: - self.select_dir(dir) if self.override_restore_file: - self.select_file(os.path.normpath(self.override_restore_file)) + f = os.path.normpath(self.override_restore_file) + if os.path.isdir(f): + self.select_dir(f) + else: + self.select_file(f) else: - file = state.get("file") - if file: - self.select_file(file) - header = state.get("header") - if header: - self.rt.header().restoreState(QtCore.QByteArray(header)) - splitter = state.get("splitter") - if splitter: - self.splitter.restoreState(QtCore.QByteArray(splitter)) + self.select_dir(state["dir"]) + self.select_file(state["file"]) + self.rt.header().restoreState(QtCore.QByteArray(state["header"])) + self.splitter.restoreState(QtCore.QByteArray(state["splitter"]))