mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Edit Book: Reports: Characters: Fix sorting by count and name not working. Fixes #1598518 [Editor Report Characters](https://bugs.launchpad.net/calibre/+bug/1598518)
This commit is contained in:
parent
cc1a8bcf1f
commit
6effd4f2ee
@ -745,11 +745,13 @@ class CharsModel(FileCollection):
|
||||
self.files = data['chars']
|
||||
self.all_chars = tuple(entry.char for entry in self.files)
|
||||
psk = numeric_sort_key
|
||||
self.sort_keys = tuple((psk(entry.char), None, entry.codepoint, len(entry.usage)) for entry in self.files)
|
||||
self.sort_keys = tuple((psk(entry.char), None, entry.codepoint, entry.count) for entry in self.files)
|
||||
self.endResetModel()
|
||||
|
||||
def data(self, index, role=Qt.DisplayRole):
|
||||
if role == SORT_ROLE:
|
||||
if index.column() == 1:
|
||||
return self.data(index)
|
||||
try:
|
||||
return self.sort_keys[index.row()][index.column()]
|
||||
except IndexError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user