mirror of https://github.com/m-labs/artiq.git
Revert "browser: simplify and fix state restore"
This reverts commit b00089c3d3
.
This commit is contained in:
parent
1f92e034da
commit
f09bfa258d
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue