forked from M-Labs/artiq
1
0
Fork 0

Revert "browser: simplify and fix state restore"

This reverts commit b00089c3d3.
This commit is contained in:
Robert Jördens 2016-04-20 10:38:35 +02:00
parent 1f92e034da
commit f09bfa258d
1 changed files with 10 additions and 6 deletions

View File

@ -115,9 +115,7 @@ class FilesDock(QtWidgets.QDockWidget):
self.datasets.init(rd)
def select(self, path):
idx = self.rt_model.index(path)
if not idx.isValid():
return
idx = self.rt_model.index(os.path.dirname(path))
self.rt.expand(idx)
self.rt.scrollTo(idx)
self.rt.setCurrentIndex(idx)
@ -131,6 +129,12 @@ class FilesDock(QtWidgets.QDockWidget):
}
def restore_state(self, state):
self.select(state["selected"])
self.rt.header().restoreState(QtCore.QByteArray(state["header"]))
self.splitter.restoreState(QtCore.QByteArray(state["splitter"]))
selected = state.get("selected")
if selected:
self.select(selected)
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))