mirror of https://github.com/m-labs/artiq.git
browser: use suffix for thumbnails
This commit is contained in:
parent
762e0400c0
commit
d84bcfddbe
|
@ -1,5 +1,4 @@
|
||||||
import logging
|
import logging
|
||||||
import threading
|
|
||||||
|
|
||||||
import h5py
|
import h5py
|
||||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||||
|
@ -21,9 +20,9 @@ class ResultIconProvider(QtWidgets.QFileIconProvider):
|
||||||
if "thumbnail" not in f:
|
if "thumbnail" not in f:
|
||||||
raise ResultError
|
raise ResultError
|
||||||
d = f["thumbnail"]
|
d = f["thumbnail"]
|
||||||
if "extension" not in d.attrs:
|
if "suffix" not in d.attrs:
|
||||||
raise ResultError
|
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)
|
pix = QtGui.QPixmap.fromImage(img)
|
||||||
return QtGui.QIcon(pix)
|
return QtGui.QIcon(pix)
|
||||||
except ResultError:
|
except ResultError:
|
||||||
|
@ -40,8 +39,7 @@ class ResultsBrowser(QtWidgets.QSplitter):
|
||||||
self.rt_model.setRootPath(QtCore.QDir.currentPath())
|
self.rt_model.setRootPath(QtCore.QDir.currentPath())
|
||||||
self.rt_model.setNameFilters(["*.h5"])
|
self.rt_model.setNameFilters(["*.h5"])
|
||||||
self.rt_model.setNameFilterDisables(False)
|
self.rt_model.setNameFilterDisables(False)
|
||||||
self.icon_provider = ResultIconProvider()
|
self.rt_model.setIconProvider(ResultIconProvider())
|
||||||
self.rt_model.setIconProvider(self.icon_provider)
|
|
||||||
|
|
||||||
self.rt = QtWidgets.QTreeView()
|
self.rt = QtWidgets.QTreeView()
|
||||||
self.rt.setModel(self.rt_model)
|
self.rt.setModel(self.rt_model)
|
||||||
|
@ -73,9 +71,6 @@ class ResultsBrowser(QtWidgets.QSplitter):
|
||||||
self.rt.hideColumn(3)
|
self.rt.hideColumn(3)
|
||||||
self.rt.scrollTo(self.rt.selectionModel().currentIndex())
|
self.rt.scrollTo(self.rt.selectionModel().currentIndex())
|
||||||
|
|
||||||
def cleanup(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def current_changed(self, current, previous):
|
def current_changed(self, current, previous):
|
||||||
info = self.rt_model.fileInfo(current)
|
info = self.rt_model.fileInfo(current)
|
||||||
logger.info("opening %s", info.filePath())
|
logger.info("opening %s", info.filePath())
|
||||||
|
|
Loading…
Reference in New Issue