From 962d3387687d40f249bd17fd84fa90a993d0fb3a Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Fri, 22 Sep 2023 11:25:43 +0200 Subject: [PATCH] Sort Confidence column in source citation tabs The "Confidence level" is sorted by confidence label instead of the internal value. The "Confidence level" text is too wide and replaced by "Confidence". Fixes #13036 --- gramps/gui/editors/displaytabs/citationembedlist.py | 5 +++-- gramps/gui/editors/displaytabs/citationrefmodel.py | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gramps/gui/editors/displaytabs/citationembedlist.py b/gramps/gui/editors/displaytabs/citationembedlist.py index 59a45e0a02d..ec39eb158e2 100644 --- a/gramps/gui/editors/displaytabs/citationembedlist.py +++ b/gramps/gui/editors/displaytabs/citationembedlist.py @@ -63,7 +63,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement): Derives from the EmbeddedList class. """ - _HANDLE_COL = 9 # Column number from CitationRefModel + _HANDLE_COL = 10 # Column number from CitationRefModel _DND_TYPE = DdTargets.CITATION_LINK _DND_EXTRA = DdTargets.SOURCE_LINK @@ -83,11 +83,12 @@ class CitationEmbedList(EmbeddedList, DbGUIElement): (_("Author"), 1, 200, TEXT_COL, -1, None), (_("Date"), 8, 180, MARKUP_COL, -1, None), (_("Publisher"), 3, 200, TEXT_COL, -1, None), - (_("Confidence Level"), 4, 120, TEXT_COL, -1, None), + (_("Confidence"), 9, 120, MARKUP_COL, -1, None), (_("Page"), 5, 100, TEXT_COL, -1, None), (_("ID"), 6, 80, TEXT_COL, -1, None), (_("Private"), 7, 30, ICON_COL, -1, "gramps-lock"), (_("Sorted date"), 8, 80, TEXT_COL, -1, None), + (_("Sorted confidence"), 9, 120, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, data, config_key, callertitle=None): diff --git a/gramps/gui/editors/displaytabs/citationrefmodel.py b/gramps/gui/editors/displaytabs/citationrefmodel.py index 952e730d794..d007871b6ba 100644 --- a/gramps/gui/editors/displaytabs/citationrefmodel.py +++ b/gramps/gui/editors/displaytabs/citationrefmodel.py @@ -39,7 +39,9 @@ # ------------------------------------------------------------------------- class CitationRefModel(Gtk.ListStore): def __init__(self, citation_list, db): - Gtk.ListStore.__init__(self, str, str, str, str, str, str, str, bool, str, str) + Gtk.ListStore.__init__( + self, str, str, str, str, str, str, str, bool, str, int, str + ) self.db = db dbgsfh = self.db.get_source_from_handle for handle in citation_list: @@ -57,6 +59,7 @@ def __init__(self, citation_list, db): citation.gramps_id, citation.get_privacy(), self.column_sort_date(citation), + self.column_sort_confidence(citation), handle, ] ) @@ -74,3 +77,7 @@ def column_sort_date(self, citation): return "%09d" % date.get_sort_value() else: return "" + + def column_sort_confidence(self, citation): + confidence = citation.get_confidence_level() + return confidence