mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Show tooltips in the File Browser for "special" files, such as the cover, opf, ncx, etc.
This commit is contained in:
parent
31c4f65977
commit
3b5c34170b
@ -357,26 +357,35 @@ class FileList(QTreeWidget):
|
|||||||
item.setData(0, LINEAR_ROLE, bool(linear))
|
item.setData(0, LINEAR_ROLE, bool(linear))
|
||||||
item.setData(0, MIME_ROLE, imt)
|
item.setData(0, MIME_ROLE, imt)
|
||||||
set_display_name(name, item)
|
set_display_name(name, item)
|
||||||
# TODO: Add appropriate tooltips based on the emblems
|
tooltips = []
|
||||||
emblems = []
|
emblems = []
|
||||||
if name in {cover_page_name, cover_image_name}:
|
if name in {cover_page_name, cover_image_name}:
|
||||||
emblems.append('default_cover.png')
|
emblems.append('default_cover.png')
|
||||||
|
tooltips.append(_('This file is the cover %s for this book') % (_('image') if name == cover_image_name else _('page')))
|
||||||
if name in container.opf_name:
|
if name in container.opf_name:
|
||||||
emblems.append('metadata.png')
|
emblems.append('metadata.png')
|
||||||
|
tooltips.append(_('This file contains all the metadata and book structure information'))
|
||||||
if imt == ncx_mime:
|
if imt == ncx_mime:
|
||||||
emblems.append('toc.png')
|
emblems.append('toc.png')
|
||||||
|
tooltips.append(_('This file contains the metadata table of contents'))
|
||||||
if name not in manifested_names and name not in ok_to_be_unmanifested:
|
if name not in manifested_names and name not in ok_to_be_unmanifested:
|
||||||
emblems.append('dialog_question.png')
|
emblems.append('dialog_question.png')
|
||||||
|
tooltips.append(_('This file is not listed in the book manifest'))
|
||||||
if linear is False:
|
if linear is False:
|
||||||
emblems.append('arrow-down.png')
|
emblems.append('arrow-down.png')
|
||||||
|
tooltips.append(_('This file is marked as non-linear in the spine'))
|
||||||
if linear is None and icat == 'text':
|
if linear is None and icat == 'text':
|
||||||
# Text item outside spine
|
# Text item outside spine
|
||||||
emblems.append('dialog_warning.png')
|
emblems.append('dialog_warning.png')
|
||||||
|
tooltips.append(_('This file is a text file that is not referenced in the spine'))
|
||||||
if category == 'text' and name in processed:
|
if category == 'text' and name in processed:
|
||||||
# Duplicate entry in spine
|
# Duplicate entry in spine
|
||||||
emblems.append('dialog_warning.png')
|
emblems.append('dialog_warning.png')
|
||||||
|
tooltips.append(_('This file occurs more than once in the spine'))
|
||||||
|
|
||||||
render_emblems(item, emblems)
|
render_emblems(item, emblems)
|
||||||
|
if tooltips:
|
||||||
|
item.setData(0, Qt.ToolTipRole, '\n'.join(tooltips))
|
||||||
return item
|
return item
|
||||||
|
|
||||||
for name, linear in container.spine_names:
|
for name, linear in container.spine_names:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user