Fixes #1970045 [Enhancement Request: is_marked() text as tooltip](https://bugs.launchpad.net/calibre/+bug/1970045)
This commit is contained in:
Kovid Goyal 2022-04-24 08:13:44 +05:30
commit d5b879cee6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1100,9 +1100,17 @@ class BooksModel(QAbstractTableModel): # {{{
if role == Qt.ItemDataRole.DisplayRole: if role == Qt.ItemDataRole.DisplayRole:
return (self.headers[self.column_map[section]]) return (self.headers[self.column_map[section]])
return None return None
if DEBUG and role == Qt.ItemDataRole.ToolTipRole and orientation == Qt.Orientation.Vertical: 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'] col = self.db.field_metadata['uuid']['rec_index']
return (_('This book\'s UUID is "{0}"').format(self.db.data[section][col])) 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 if role == Qt.ItemDataRole.DisplayRole: # orientation is vertical
return (section+1) return (section+1)