Skip to content

Commit

Permalink
make hdf5 tree model work with DatasetSlice
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 committed Jun 15, 2023
1 parent 48e83b7 commit 5f7383a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/silx/gui/hdf5/Hdf5TreeModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from .Hdf5LoadingItem import Hdf5LoadingItem
from . import _utils
from ... import io as silx_io
from ...io._sliceh5 import DatasetSlice

import h5py

Expand All @@ -61,6 +62,8 @@ def _createRootLabel(h5obj):
if path.startswith("/"):
path = path[1:]
label = "%s::%s" % (filename, path)
if isinstance(h5obj, DatasetSlice):
label += str(list(h5obj.indices))
return label


Expand Down Expand Up @@ -573,9 +576,12 @@ def __areH5pyObjectEqual(obj1, obj2):
if not isinstance(obj2, type(obj1)):
return False
def key(item):
if item.file is None:
return item.name
return item.file.filename, item.file.mode, item.name
info = [item.name]
if item.file is not None:
info += [item.file.filename, item.file.mode]
if isinstance(item, DatasetSlice):
info.append(item.indices)
return tuple(info)
return key(obj1) == key(obj2)

def h5pyObjectRow(self, h5pyObject):
Expand Down

0 comments on commit 5f7383a

Please sign in to comment.