diff options
author | Alexandre Marie <alexandre.marie@synchrotron-soleil.fr> | 2018-12-17 12:28:45 +0100 |
---|---|---|
committer | Alexandre Marie <alexandre.marie@synchrotron-soleil.fr> | 2018-12-17 12:28:45 +0100 |
commit | c49572a2e90b398e90a43f86b490f27ee6c58de6 (patch) | |
tree | d130cf7dfc3cf73157e1bece8173331bb4bc7156 /silx/app/view/About.py | |
parent | 0bbc8ab933e62c1fa6d548e879ae6d98cbd461f1 (diff) | |
parent | cebdc9244c019224846cb8d2668080fe386a6adc (diff) |
Merge tag 'upstream/0.9.0+dfsg'
Upstream version 0.9.0+dfsg
Diffstat (limited to 'silx/app/view/About.py')
-rw-r--r-- | silx/app/view/About.py | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/silx/app/view/About.py b/silx/app/view/About.py index 07306ef..4b804f2 100644 --- a/silx/app/view/About.py +++ b/silx/app/view/About.py @@ -25,7 +25,7 @@ __authors__ = ["V. Valls"] __license__ = "MIT" -__date__ = "05/06/2018" +__date__ = "05/07/2018" import sys @@ -147,6 +147,15 @@ class About(qt.QDialog): template = '<b>%s</b> is <font color="red">not loaded</font>' return template % name + @staticmethod + def __formatOptionalFilters(name, isAvailable): + """Utils to format availability of features""" + if isAvailable: + template = '<b>%s</b> is <font color="green">available</font>' + else: + template = '<b>%s</b> is <font color="red">not available</font>' + return template % name + def __updateText(self): """Update the content of the dialog according to the settings.""" import silx._version @@ -174,14 +183,29 @@ class About(qt.QDialog): </p> """ - hdf5pluginLoaded = "hdf5plugin" in sys.modules - fabioLoaded = "fabio" in sys.modules - h5pyLoaded = "h5py" in sys.modules - - optional_lib = [] - optional_lib.append(self.__formatOptionalLibraries("FabIO", fabioLoaded)) - optional_lib.append(self.__formatOptionalLibraries("H5py", h5pyLoaded)) - optional_lib.append(self.__formatOptionalLibraries("hdf5plugin", hdf5pluginLoaded)) + optionals = [] + optionals.append(self.__formatOptionalLibraries("H5py", "h5py" in sys.modules)) + optionals.append(self.__formatOptionalLibraries("FabIO", "fabio" in sys.modules)) + + try: + import h5py.version + if h5py.version.hdf5_version_tuple >= (1, 10, 2): + # Previous versions only return True if the filter was first used + # to decode a dataset + import h5py.h5z + FILTER_LZ4 = 32004 + FILTER_BITSHUFFLE = 32008 + filters = [ + ("HDF5 LZ4 filter", FILTER_LZ4), + ("HDF5 Bitshuffle filter", FILTER_BITSHUFFLE), + ] + for name, filterId in filters: + isAvailable = h5py.h5z.filter_avail(filterId) + optionals.append(self.__formatOptionalFilters(name, isAvailable)) + else: + optionals.append(self.__formatOptionalLibraries("hdf5plugin", "hdf5plugin" in sys.modules)) + except ImportError: + pass # Access to the logo in SVG or PNG logo = icons.getQFile("../logo/silx") @@ -194,7 +218,7 @@ class About(qt.QDialog): qt_binding=qt.BINDING, qt_version=qt.qVersion(), python_version=sys.version.replace("\n", "<br />"), - optional_lib="<br />".join(optional_lib), + optional_lib="<br />".join(optionals), silx_image_path=logo.fileName() ) |