forked from M-Labs/artiq
1
0
Fork 0

browser: wire up activate in list

This commit is contained in:
Robert Jördens 2016-05-16 11:45:13 +02:00
parent f1747b5ea5
commit ecdbf2ae08
1 changed files with 9 additions and 0 deletions

View File

@ -126,6 +126,7 @@ class FilesDock(QtWidgets.QDockWidget):
self.rl.setModel(self.model)
self.rl.selectionModel().currentChanged.connect(
self.list_current_changed)
self.rl.activated.connect(self.list_activated)
self.splitter.addWidget(self.rl)
self.restore_selected = select is None
@ -152,6 +153,14 @@ class FilesDock(QtWidgets.QDockWidget):
rd = {k: (True, v.value) for k, v in f["datasets"].items()}
self.datasets.init(rd)
def list_activated(self, idx):
if not self.model.fileInfo(idx).isDir():
return
self.rl.setRootIndex(idx)
idx = self.rt.model().mapFromSource(idx)
self.rt.expand(idx)
self.rt.setCurrentIndex(idx)
def select_dir(self, path):
if not os.path.exists(path):
return