def setData(self, index, value, role=Qt.EditRole): row = index.row() col = index.column() project = File.allProjects(os.getcwd())[row] metadatakey = Metadata.listUsedAnnotations(os.getcwd())[col] value = str(value.toPyObject()) Metadata.setMetadata(project, metadatakey, value) return True
def headerData(self, section, orientation, role = QtCore.Qt.DisplayRole): if role == Qt.DisplayRole: if orientation == Qt.Horizontal: listUsedAnnotations = Metadata.listUsedAnnotations(os.getcwd()) key = listUsedAnnotations[section] return QString(key) elif orientation == Qt.Vertical: project = File.allProjects(os.getcwd())[section] return QVariant(project) else: return QVariant()
def data(self, index, role): if not index.isValid(): return QVariant() elif role != Qt.DisplayRole and role != Qt.EditRole: return QVariant() project = File.allProjects(os.getcwd())[index.row()] metadatakey = Metadata.listUsedAnnotations(os.getcwd())[index.column()] annotations = Metadata.getAnnotations(project) if annotations.has_key(metadatakey): metadatavalue = annotations[metadatakey] else: metadatavalue = "<NOT SET>" return QVariant(metadatavalue)
def columnCount(self, parent): return len(Metadata.listUsedAnnotations(os.getcwd()))