Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def rowCount(self, index=Qt.QModelIndex()):
return len(self.curves)
def index(self, row, column, parent):
if not parent.isValid():
parentNode = self.root();
else:
parentNode = parent.internalPointer()
childNode = parentNode.child(row)
if childNode is None:
return Qt.QModelIndex();
else:
return self.createIndex(row, column, childNode);
def rowCount(self,index=Qt.QModelIndex()):
return len(self.curves)
def expanded(self):
for column in range(self.model().columnCount(Qt.QModelIndex())):
self.resizeColumnToContents(column)
def parent(self, child):
node = self.nodeFromIndex(child)
if node is None:
return Qt.QModelIndex()
parent = node.parent()
if parent is None:
return Qt.QModelIndex()
grandparent = parent.parent()
if grandparent is None:
return Qt.QModelIndex()
row = grandparent.rowOfChild(parent)
assert row != -1
return self.createIndex(row, 0, parent)
def parent(self, child):
node = self.nodeFromIndex(child)
if node is None:
return Qt.QModelIndex()
parent = node.parent()
if parent is None or isinstance(parent, macro.SequenceNode):
return Qt.QModelIndex()
grandparent = parent.parent()
if grandparent is None:
return Qt.QModelIndex()
row = grandparent.rowOfChild(parent)
return self.createIndex(row, 0, parent)
def insertRows(self, position, rows=1, index=Qt.QModelIndex()):
self.beginInsertRows(Qt.QModelIndex(), position, position + rows - 1)
self.endInsertRows()
def setRangeForMacro(self, macroId, range):
persistentIndex = self._idIndexDict.get(macroId, None)
if persistentIndex is None:
return
index = Qt.QModelIndex(persistentIndex)
node = self.model().nodeFromIndex(index)
node.setRange(range)
def index(self, row, column=0, parent=Qt.QModelIndex()):
if self.rowCount():
return self.createIndex(row, column, self.list[row])
else:
return Qt.QModelIndex()
def removeRows(self, position, rows=1, index=Qt.QModelIndex()):
self.beginRemoveRows(Qt.QModelIndex(), position, position+rows-1)
self.endRemoveRows()