Skip to content

Commit

Permalink
ui: ontology: sort annotation properties in ontology manager
Browse files Browse the repository at this point in the history
  • Loading branch information
rooosyf authored and mnamici committed Dec 17, 2022
1 parent 4bf7790 commit 7fef279
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions eddy/ui/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7fef279

Please sign in to comment.