mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
cf6ee757a8
commit
5df61a0472
@ -104,7 +104,7 @@ def render_data(mi, use_roman_numbers=True, all_fields=False):
|
|||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def details_context_menu_event(view, ev, self): # {{{
|
def details_context_menu_event(view, ev, book_info): # {{{
|
||||||
p = view.page()
|
p = view.page()
|
||||||
mf = p.mainFrame()
|
mf = p.mainFrame()
|
||||||
r = mf.hitTestContent(ev.pos())
|
r = mf.hitTestContent(ev.pos())
|
||||||
@ -142,22 +142,22 @@ def details_context_menu_event(view, ev, self): # {{{
|
|||||||
t = _('Compare to the %s format') % (fmt[9:] if fmt.startswith('ORIGINAL_') else ofmt)
|
t = _('Compare to the %s format') % (fmt[9:] if fmt.startswith('ORIGINAL_') else ofmt)
|
||||||
else:
|
else:
|
||||||
t = t % fmt
|
t = t % fmt
|
||||||
ac = getattr(self, '%s_format_action'%a)
|
ac = getattr(book_info, '%s_format_action'%a)
|
||||||
ac.current_fmt = (book_id, fmt)
|
ac.current_fmt = (book_id, fmt)
|
||||||
ac.setText(t)
|
ac.setText(t)
|
||||||
menu.addAction(ac)
|
menu.addAction(ac)
|
||||||
if not fmt.upper().startswith('ORIGINAL_'):
|
if not fmt.upper().startswith('ORIGINAL_'):
|
||||||
from calibre.gui2.open_with import populate_menu, edit_programs
|
from calibre.gui2.open_with import populate_menu, edit_programs
|
||||||
m = QMenu(_('Open %s with...') % fmt.upper())
|
m = QMenu(_('Open %s with...') % fmt.upper())
|
||||||
populate_menu(m, partial(self.open_with, book_id, fmt), fmt)
|
populate_menu(m, partial(book_info.open_with, book_id, fmt), fmt)
|
||||||
if len(m.actions()) == 0:
|
if len(m.actions()) == 0:
|
||||||
menu.addAction(_('Open %s with...') % fmt.upper(), partial(self.choose_open_with, book_id, fmt))
|
menu.addAction(_('Open %s with...') % fmt.upper(), partial(book_info.choose_open_with, book_id, fmt))
|
||||||
else:
|
else:
|
||||||
m.addSeparator()
|
m.addSeparator()
|
||||||
m.addAction(_('Add other application for %s files...') % fmt.upper(), partial(self.choose_open_with, book_id, fmt))
|
m.addAction(_('Add other application for %s files...') % fmt.upper(), partial(book_info.choose_open_with, book_id, fmt))
|
||||||
m.addAction(_('Edit Open With applications...'), partial(edit_programs, fmt, self))
|
m.addAction(_('Edit Open With applications...'), partial(edit_programs, fmt, book_info))
|
||||||
menu.addMenu(m)
|
menu.addMenu(m)
|
||||||
ac = self.copy_link_action
|
ac = book_info.copy_link_action
|
||||||
ac.current_url = r.linkElement().attribute('data-full-path')
|
ac.current_url = r.linkElement().attribute('data-full-path')
|
||||||
if ac.current_url:
|
if ac.current_url:
|
||||||
ac.setText(_('&Copy path to file'))
|
ac.setText(_('&Copy path to file'))
|
||||||
@ -168,14 +168,14 @@ def details_context_menu_event(view, ev, self): # {{{
|
|||||||
if not url.startswith('search:'):
|
if not url.startswith('search:'):
|
||||||
for a, t in [('copy', _('&Copy Link')),
|
for a, t in [('copy', _('&Copy Link')),
|
||||||
]:
|
]:
|
||||||
ac = getattr(self, '%s_link_action'%a)
|
ac = getattr(book_info, '%s_link_action'%a)
|
||||||
ac.current_url = url
|
ac.current_url = url
|
||||||
if url.startswith('path:'):
|
if url.startswith('path:'):
|
||||||
ac.current_url = el.attribute('title')
|
ac.current_url = el.attribute('title')
|
||||||
ac.setText(t)
|
ac.setText(t)
|
||||||
menu.addAction(ac)
|
menu.addAction(ac)
|
||||||
if author is not None:
|
if author is not None:
|
||||||
ac = self.manage_author_action
|
ac = book_info.manage_author_action
|
||||||
ac.current_fmt = author
|
ac.current_fmt = author
|
||||||
ac.setText(_('Manage %s') % author)
|
ac.setText(_('Manage %s') % author)
|
||||||
menu.addAction(ac)
|
menu.addAction(ac)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user