forked from M-Labs/artiq
1
0
Fork 0

gui/results: add QListView

This commit is contained in:
Robert Jördens 2016-04-05 16:05:53 +08:00
parent 670e8907a5
commit 826d529756
1 changed files with 8 additions and 9 deletions

View File

@ -21,13 +21,6 @@ class ResultsDock(QtWidgets.QDockWidget):
top_widget = LayoutWidget()
self.setWidget(top_widget)
self.stack = QtWidgets.QStackedWidget()
top_widget.addWidget(self.stack, 1, 0, colspan=2)
self.rt_buttons = LayoutWidget()
self.rt_buttons.layout.setContentsMargins(0, 0, 0, 0)
self.stack.addWidget(self.rt_buttons)
self.rt_model = QtWidgets.QFileSystemModel()
self.rt_model.setRootPath(QtCore.QDir.currentPath())
self.rt_model.setNameFilters(["*.h5"])
@ -38,9 +31,15 @@ class ResultsDock(QtWidgets.QDockWidget):
self.rt.setRootIndex(self.rt_model.index(QtCore.QDir.currentPath()))
self.rt.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.rt.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.rt.selectionModel().selectionChanged.connect(
top_widget.addWidget(self.rt, 0, 0)
self.rl = QtWidgets.QListView()
self.rl.setModel(self.rt_model)
self.rl.setRootIndex(self.rt_model.index(QtCore.QDir.currentPath()))
self.rl.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.rl.selectionModel().selectionChanged.connect(
self.selection_changed)
self.rt_buttons.addWidget(self.rt, 0, 0, colspan=2)
top_widget.addWidget(self.rl, 0, 1)
def selection_changed(self, selected, deselected):
indexes = selected.indexes()