NexusSortFilterProxyModel class

class NexusSortFilterProxyModel(parent=None)[source]

Bases: PyQt5.QtCore.QSortFilterProxyModel

Try to sort items according to Nexus structure. Else sort by name.

hasChildren(parent)[source]

Returns true if parent has any children; otherwise returns false.

Parameters

parent (qt.QModelIndex) – Index of the item to check

Return type

bool

rowCount(parent)[source]

Returns the number of rows under the given parent.

Parameters

parent (qt.QModelIndex) – Index of the item to check

Return type

int

lessThan(sourceLeft, sourceRight)[source]

Returns True if the value of the item referred to by the given index sourceLeft is less than the value of the item referred to by the given index sourceRight, otherwise returns false.

Parameters
  • sourceLeft (qt.QModelIndex) –

  • sourceRight (qt.QModelIndex) –

Return type

bool

getWordsAndNumbers(name)[source]

Returns a list of words and integers composing the name.

An input “aaa10bbb50.30” will return [“aaa”, 10, “bbb”, 50, “.”, 30].

Parameters

name (str) – A name

Return type

List

nameLessThan(left, right)[source]

Returns True if the left string is less than the right string.

Number composing the names are compared as integers, as result “name2” is smaller than “name10”.

Parameters
  • left (str) – A string

  • right (str) – A string

Return type

bool

childDatasetLessThan(left, right, childName)[source]

Reach the same children name of two items and compare their values.

Returns True if the left one is smaller than the right one.

Parameters
  • left (Hdf5Item) – An item

  • right (Hdf5Item) – An item

  • childName (str) – Name of the children to search. Returns None if the children is not found.

Return type

bool

data(self, QModelIndex, role: int = Qt.DisplayRole) Any[source]