def data(self, index, role=Qt.DisplayRole): if not index.isValid(): return _variant if role == Qt.DisplayRole: return QVariant(self.packages[index.row()]) elif role == Qt.CheckStateRole and index.column() == 0: return QVariant(self.package_selections[index.row()]) if role >= Qt.UserRole: try: package = self.package(index) except Exception, e: logger.warning(e) return _variant