mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Show full path to the format file in a tooltip when hovering over the
link to open the format in the book details panel
This commit is contained in:
parent
dd7f18eb54
commit
c185e93ea9
@ -5,6 +5,9 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
from functools import partial
|
||||
|
||||
from PyQt4.Qt import (QPixmap, QSize, QWidget, Qt, pyqtSignal, QUrl, QIcon,
|
||||
QPropertyAnimation, QEasingCurve, QApplication, QFontInfo, QAction,
|
||||
QSizePolicy, QPainter, QRect, pyqtProperty, QLayout, QPalette, QMenu,
|
||||
@ -164,8 +167,16 @@ def render_data(mi, use_roman_numbers=True, all_fields=False):
|
||||
elif field == 'formats':
|
||||
if isdevice:
|
||||
continue
|
||||
fmts = [u'<a href="format:%s:%s">%s</a>' % (mi.id, x, x) for x
|
||||
in mi.formats]
|
||||
p = partial(prepare_string_for_xml, attribute=True)
|
||||
path = ''
|
||||
if mi.path:
|
||||
h, t = os.path.split(mi.path)
|
||||
path = '/'.join((os.path.basename(h), t))
|
||||
data = ({
|
||||
'fmt':x, 'path':p(path or ''), 'fname':p(mi.format_files.get(x, '')),
|
||||
'ext':x.lower(), 'id':mi.id
|
||||
} for x in mi.formats)
|
||||
fmts = [u'<a title="{path}/{fname}.{ext}" href="format:{id}:{fmt}">{fmt}</a>'.format(**x) for x in data]
|
||||
ans.append((field, row % (name, u', '.join(fmts))))
|
||||
elif field == 'identifiers':
|
||||
urls = urls_from_identifiers(mi.identifiers)
|
||||
|
@ -493,6 +493,7 @@ class BooksModel(QAbstractTableModel): # {{{
|
||||
mi.id = self.db.id(idx)
|
||||
mi.field_metadata = self.db.field_metadata
|
||||
mi.path = self.db.abspath(idx, create_dirs=False)
|
||||
mi.format_files = self.db.new_api.format_files(self.db.data.index_to_id(idx))
|
||||
try:
|
||||
mi.marked = self.db.data.get_marked(idx, index_is_id=False)
|
||||
except:
|
||||
|
Loading…
x
Reference in New Issue
Block a user