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