From 826d529756c4fb53dda26b20ceedd73d99e34d3c Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Tue, 5 Apr 2016 16:05:53 +0800 Subject: [PATCH] gui/results: add QListView --- artiq/gui/results.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/artiq/gui/results.py b/artiq/gui/results.py index 6e0316806..ef65370a7 100644 --- a/artiq/gui/results.py +++ b/artiq/gui/results.py @@ -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()