Skip to content

Commit

Permalink
sort Confidence col in Source Citations tabs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SNoiraud committed Sep 22, 2023
1 parent 238d3b3 commit f6fb3f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions gramps/gui/editors/displaytabs/citationembedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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):
Expand Down
7 changes: 6 additions & 1 deletion gramps/gui/editors/displaytabs/citationrefmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# -------------------------------------------------------------------------
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, str, str)
self.db = db
dbgsfh = self.db.get_source_from_handle
for handle in citation_list:
Expand All @@ -57,6 +57,7 @@ def __init__(self, citation_list, db):
citation.gramps_id,
citation.get_privacy(),
self.column_sort_date(citation),
self.column_sort_confidence(citation),
handle,
]
)
Expand All @@ -74,3 +75,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 str(confidence)

0 comments on commit f6fb3f1

Please sign in to comment.