def rowCount(self, parent: PySide2.QtCore.QModelIndex = ...): if not parent.isValid(): parent_node = self.root else: parent_node = parent.internalPointer() return len(parent_node.children)
def rowCount(self, parent: PySide2.QtCore.QModelIndex = ...) -> int: if parent.column() > 0: return 0 if not parent.isValid(): parent_item = self.root_item else: parent_item = parent.internalPointer() return parent_item.children_count()
def index(self, row: int, column: int, parent: PySide2.QtCore.QModelIndex = ...): if not parent.isValid(): parent_node = self.root else: parent_node = parent.internalPointer() child_node = parent_node.children[row] return self.createIndex(row, column, child_node)
def data(self, index: PySide2.QtCore.QModelIndex, role: int = ...) -> typing.Any: if index.isValid() is False: return None if role != Qt.DisplayRole: return None item = index.internalPointer() return item.data(index.column())
def data(self, index: PySide2.QtCore.QModelIndex, role: int = ...) -> Any: if not index.isValid(): return None row = index.row() col = index.column() if role == Qt.DisplayRole: return self._get_column_text(row, col) else: return None
def parent( self, child: PySide2.QtCore.QModelIndex = ... ) -> PySide2.QtCore.QModelIndex: if not child.isValid(): return QModelIndex() child_item = child.internalPointer() parent_item = child_item.parent() if (parent_item == self.root_item): return QModelIndex() return self.createIndex(parent_item.row(), 0, parent_item)
def data(self, index:PySide2.QtCore.QModelIndex, role:int=...) -> Any: if not index.isValid(): return None row = index.row() if row >= len(self.instance.traces): return None col = index.column() if role == Qt.DisplayRole: return self._get_column_text(self.instance.traces[row], col) else: return None
def data(self, index: PySide2.QtCore.QModelIndex, role: int = ...): if not index.isValid(): return None node = index.internalPointer() if role == Qt.DisplayRole: if node.is_leaf: return "{}: {}".format(node.name, node.value) else: return "{} [{}]".format(node.name, node.class_name) return None
def data(self, index: PySide2.QtCore.QModelIndex, role: int = ...) -> Any: if not index.isValid(): return None row = index.row() reg = self._filtered_register_list()[row] col = index.column() if role == Qt.DisplayRole: return self._get_column_text(reg, col) elif role == Qt.ForegroundRole: return QBrush(Qt.red) if self._did_data_change(reg) else None else: return None
def data(self, index: PySide2.QtCore.QModelIndex, role: int = ...) -> typing.Any: if not index.isValid(): return None row = index.row() if row >= len(self.targets): return None target = self.targets[row] col = index.column() if role == Qt.DisplayRole: return self._get_column_text(target, col) return None
def data(self, index: PySide2.QtCore.QModelIndex, role: int = ...): if not index.isValid(): return None node = index.internalPointer() if role == Qt.DisplayRole: column = index.column() if column == 0: return node.value.timestamp elif column == 1: return node.value.server elif column == 2: return node.value.source elif column == 3: return len(node.value.packets)
def data(self, index: PySide2.QtCore.QModelIndex, role: int = ...) -> Any: if not index.isValid(): return None row = index.row() if row >= len(self.log): return None log = self.log[row] col = index.column() if role == Qt.DisplayRole: return self._get_column_text(log, col) elif role == Qt.DecorationRole and col == QLogTableModel.COL_ICON: return self._get_column_icon(log) return None
def index(self, row: int, column: int, parent: PySide2.QtCore.QModelIndex = ... ) -> PySide2.QtCore.QModelIndex: if not self.hasIndex(row, column, parent): return QModelIndex() if not parent.isValid(): parent_item = self.root_item else: parent_item = parent.internalPointer() child_item = parent_item.child(row) if child_item: return self.createIndex(row, column, child_item) return QModelIndex()
def data(self, index: PySide2.QtCore.QModelIndex, role: int = ...): if not index.isValid(): return None node = index.internalPointer() if role == Qt.DisplayRole: column = index.column() if column == 0: return self.name_resolver.get(node, '../../../../../../server').value elif column == 1: return node.value.code elif column == 2: return self.name_resolver.get(node, './content').class_name elif column == 3: return self.name_resolver.get(node, './content/content').class_name
def columnCount(self, parent: PySide2.QtCore.QModelIndex = ...) -> int: if parent.isValid(): # print(parent.internalPointer().columnCount()) return parent.internalPointer().columnCount() # print(self.root_item.column_count()) return self.root_item.column_count()
def rowCount(self, parent: PySide2.QtCore.QModelIndex = ...): if not parent.isValid(): return len(self.root.children) return 0
def flags( self, index: PySide2.QtCore.QModelIndex) -> PySide2.QtCore.Qt.ItemFlags: if not index.isValid(): return Qt.NoItemFlags return QAbstractItemModel.flags(self, index)
def rowCount(self, parent: PySide2.QtCore.QModelIndex = ...): if not parent.isValid(): return len(self.message_list) return 0