From d84bcfddbe355613d3e07d80f0175b03edc2e300 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Wed, 6 Apr 2016 15:53:59 +0800 Subject: [PATCH] browser: use suffix for thumbnails --- artiq/browser/results.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/artiq/browser/results.py b/artiq/browser/results.py index 600e73475..c7d301828 100644 --- a/artiq/browser/results.py +++ b/artiq/browser/results.py @@ -1,5 +1,4 @@ import logging -import threading import h5py from PyQt5 import QtCore, QtWidgets, QtGui @@ -21,9 +20,9 @@ class ResultIconProvider(QtWidgets.QFileIconProvider): if "thumbnail" not in f: raise ResultError d = f["thumbnail"] - if "extension" not in d.attrs: + if "suffix" not in d.attrs: raise ResultError - img = QtGui.QImage.fromData(d.value, d.attrs["extension"]) + img = QtGui.QImage.fromData(d.value, d.attrs["suffix"]) pix = QtGui.QPixmap.fromImage(img) return QtGui.QIcon(pix) except ResultError: @@ -40,8 +39,7 @@ class ResultsBrowser(QtWidgets.QSplitter): self.rt_model.setRootPath(QtCore.QDir.currentPath()) self.rt_model.setNameFilters(["*.h5"]) self.rt_model.setNameFilterDisables(False) - self.icon_provider = ResultIconProvider() - self.rt_model.setIconProvider(self.icon_provider) + self.rt_model.setIconProvider(ResultIconProvider()) self.rt = QtWidgets.QTreeView() self.rt.setModel(self.rt_model) @@ -73,9 +71,6 @@ class ResultsBrowser(QtWidgets.QSplitter): self.rt.hideColumn(3) self.rt.scrollTo(self.rt.selectionModel().currentIndex()) - def cleanup(self): - pass - def current_changed(self, current, previous): info = self.rt_model.fileInfo(current) logger.info("opening %s", info.filePath())