So, I figured that the bug is in
annotated_books.py at the else below:
Code:
def sort(self, Ncol, order=Qt.AscendingOrder):
"""
Sort table by given column number.
"""
self.layoutAboutToBeChanged.emit()
if Ncol == self.ENABLED_COL: # Don't sort on the checkbox column.
self.arraydata = sorted(self.arraydata, key=lambda row: row[Ncol].checkState(), reverse=(order == Qt.DescendingOrder))
else:
self.arraydata = sorted(self.arraydata, key=operator.itemgetter(Ncol), reverse=(order == Qt.DescendingOrder))
self.layoutChanged.emit()
I printed out
self.arraydata and I get
Code:
DEBUG: 18.9 Trying to sort this: [['b99a2e76-53bf-4100-948b-3c41f42a2c03', '2', 'COMPUTERS / Programming / General', <PyQt5.QtWidgets.QCheckBox object at 0x12f5a2ee0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x13090ea60>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x13090eaf0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x13090eb80>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x13090e9d0>, 5, 5], ['86c19abd-5cb6-41c5-8da5-d641c4b6b8a0', '1', 'History, Ancient, Greece, Philosophy, Political, History & Surveys, Ancient & Classical', <PyQt5.QtWidgets.QCheckBox object at 0x13090ec10>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x13090ed30>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x13090ee50>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x13090eee0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x13090eca0>, 1, 5], [None, '-8', '', <PyQt5.QtWidgets.QCheckBox object at 0x13090ef70>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x1309120d0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912160>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x1309121f0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912040>, 7, 0], [None, '-9', '', <PyQt5.QtWidgets.QCheckBox object at 0x130912280>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x1309123a0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912430>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x1309124c0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912310>, 13, 0], [None, '-21', '', <PyQt5.QtWidgets.QCheckBox object at 0x130912550>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912670>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912700>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912790>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x1309125e0>, 21, 0], [None, '-22', '', <PyQt5.QtWidgets.QCheckBox object at 0x130912820>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x1309129d0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912a60>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912af0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912940>, 3, 0], [None, '-26', '', <PyQt5.QtWidgets.QCheckBox object at 0x130912c10>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912ca0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912d30>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912dc0>, <calibre_plugins.annotations.annotated_books.SortableTableWidgetItem object at 0x130912b80>, 49, 0]]
Not sure how to move forward.