summaryrefslogtreecommitdiff
path: root/silx/gui/hdf5/Hdf5TreeModel.py
diff options
context:
space:
mode:
Diffstat (limited to 'silx/gui/hdf5/Hdf5TreeModel.py')
-rw-r--r--silx/gui/hdf5/Hdf5TreeModel.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/silx/gui/hdf5/Hdf5TreeModel.py b/silx/gui/hdf5/Hdf5TreeModel.py
index 835708a..438200b 100644
--- a/silx/gui/hdf5/Hdf5TreeModel.py
+++ b/silx/gui/hdf5/Hdf5TreeModel.py
@@ -25,7 +25,7 @@
__authors__ = ["V. Valls"]
__license__ = "MIT"
-__date__ = "11/06/2018"
+__date__ = "08/10/2018"
import os
@@ -591,6 +591,13 @@ class Hdf5TreeModel(qt.QAbstractItemModel):
filename = node.obj.filename
self.insertFileAsync(filename, index.row(), synchronizingNode=node)
+ def h5pyObjectRow(self, h5pyObject):
+ for row in range(self.__root.childCount()):
+ item = self.__root.child(row)
+ if item.obj == h5pyObject:
+ return row
+ return -1
+
def synchronizeH5pyObject(self, h5pyObject):
"""
Synchronize a h5py object in all the tree.
@@ -602,7 +609,7 @@ class Hdf5TreeModel(qt.QAbstractItemModel):
index = 0
while index < self.__root.childCount():
item = self.__root.child(index)
- if item.obj is h5pyObject:
+ if item.obj == h5pyObject:
qindex = self.index(index, 0, qt.QModelIndex())
self.synchronizeIndex(qindex)
index += 1
@@ -614,7 +621,7 @@ class Hdf5TreeModel(qt.QAbstractItemModel):
:param qt.QModelIndex index: Index of the item to remove
"""
node = self.nodeFromIndex(index)
- if node.parent is not self.__root:
+ if node.parent != self.__root:
return
self._closeFileIfOwned(node)
self.beginRemoveRows(qt.QModelIndex(), index.row(), index.row())
@@ -632,7 +639,7 @@ class Hdf5TreeModel(qt.QAbstractItemModel):
index = 0
while index < self.__root.childCount():
item = self.__root.child(index)
- if item.obj is h5pyObject:
+ if item.obj == h5pyObject:
qindex = self.index(index, 0, qt.QModelIndex())
self.removeIndex(qindex)
else: