From 61596cc05bba9101fe2cd9abe85f7785604a18c5 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Sat, 23 Apr 2022 18:40:02 +0100 Subject: [PATCH] Enhancement #1970045: is_marked() text as tooltip --- src/calibre/gui2/library/models.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 561c8180bd..f2b0d440d6 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -1100,9 +1100,17 @@ class BooksModel(QAbstractTableModel): # {{{ if role == Qt.ItemDataRole.DisplayRole: return (self.headers[self.column_map[section]]) return None - if DEBUG and role == Qt.ItemDataRole.ToolTipRole and orientation == Qt.Orientation.Vertical: - col = self.db.field_metadata['uuid']['rec_index'] - return (_('This book\'s UUID is "{0}"').format(self.db.data[section][col])) + if role == Qt.ItemDataRole.ToolTipRole and orientation == Qt.Orientation.Vertical: + col = self.db.field_metadata['marked']['rec_index'] + marked = self.db.data[section][col] + if marked is not None: + s = _('Marked with text "{0}"').format(marked) if marked != 'true' else _('Marked without text') + else: + s = '' + if DEBUG: + col = self.db.field_metadata['uuid']['rec_index'] + s += ('\n' if s else '') + _('This book\'s UUID is "{0}"').format(self.db.data[section][col]) + return s if role == Qt.ItemDataRole.DisplayRole: # orientation is vertical return (section+1)