forked from M-Labs/artiq
1
0
Fork 0

browser: dump tree header, fix root path setting

This commit is contained in:
Robert Jördens 2016-04-21 11:54:57 +02:00
parent 5cccdcaad6
commit 1dde911618
1 changed files with 4 additions and 3 deletions

View File

@ -111,8 +111,11 @@ class FilesDock(QtWidgets.QDockWidget):
self.model.directoryLoaded.connect(
lambda: self.rt.resizeColumnToContents(0))
self.rt.setAnimated(False)
if browse_root != "":
browse_root = os.path.abspath(browse_root)
self.rt.setRootIndex(rt_model.mapFromSource(
self.model.setRootPath(os.path.abspath(browse_root))))
self.model.setRootPath(browse_root)))
self.rt.setHeaderHidden(True)
self.rt.setSelectionBehavior(self.rt.SelectRows)
self.rt.setSelectionMode(self.rt.SingleSelection)
self.rt.selectionModel().currentChanged.connect(
@ -206,7 +209,6 @@ class FilesDock(QtWidgets.QDockWidget):
return {
"dir": self.model.filePath(self.rl.rootIndex()),
"file": self.model.filePath(self.rl.currentIndex()),
"header": bytes(self.rt.header().saveState()),
"splitter": bytes(self.splitter.saveState()),
}
@ -214,5 +216,4 @@ class FilesDock(QtWidgets.QDockWidget):
if self.restore_selected:
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"]))