From 7fef279faea4c6a44b0a2ca6a2a5e0cdc66fb7c2 Mon Sep 17 00:00:00 2001 From: rooosyf Date: Wed, 14 Dec 2022 20:05:44 +0100 Subject: [PATCH] ui: ontology: sort annotation properties in ontology manager --- eddy/ui/ontology.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/eddy/ui/ontology.py b/eddy/ui/ontology.py index f3df8587..d8909f90 100644 --- a/eddy/ui/ontology.py +++ b/eddy/ui/ontology.py @@ -765,11 +765,12 @@ def redraw(self): # ANNOTATIONS TAB ################################# - annotationProperties = self.project.getAnnotationPropertyIRIs() + annotationProperties = [str(e) for e in self.project.getAnnotationPropertyIRIs()] table = self.widget('annotation_properties_table_widget') table.clear() table.setHorizontalHeaderLabels(['IRI', 'Comment']) table.setRowCount(len(annotationProperties)) + annotationProperties.sort() rowcount = 0 for annIRI in annotationProperties: propertyItem = QtWidgets.QTableWidgetItem(str(annIRI)) @@ -1343,9 +1344,12 @@ def addAnnotationProperty(self, _): table.setRowCount(rowcount + 1) propertyItem = QtWidgets.QTableWidgetItem(str(annIRI)) propertyItem.setFlags(QtCore.Qt.ItemIsEnabled) - table.setItem(rowcount, 0, propertyItem) - table.setItem(rowcount, 1, QtWidgets.QTableWidgetItem('')) - table.scrollToItem(table.item(rowcount, 0)) + annotationProperties = [str(e) for e in self.project.getAnnotationPropertyIRIs()] + annotationProperties.sort() + idx = annotationProperties.index(str(annIRI)) if str(annIRI) in annotationProperties else rowcount + table.setItem(idx, 0, propertyItem) + table.setItem(idx, 1, QtWidgets.QTableWidgetItem('')) + table.scrollToItem(table.item(idx, 0)) self.widget('iri_prefix_switch').setCurrentText(self.noPrefixString) self.widget('iri_input_field').setText('') except IllegalNamespaceError as e: