Book details: Fix extra margin to the right of the metadata fields. Fixes #1881488 [Book Details panel width wrong](https://bugs.launchpad.net/calibre/+bug/1881488)

This probably breaks RTL text, but I doubt Qt supports RTL anyway.
This commit is contained in:
Kovid Goyal 2020-05-31 21:59:42 +05:30
parent 76111e4805
commit 7af2031659
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 7 deletions

View File

@ -90,7 +90,8 @@ def author_search_href(which, title=None, author=None):
def mi_to_html( def mi_to_html(
mi, mi,
field_list=None, default_author_link=None, use_roman_numbers=True, field_list=None, default_author_link=None, use_roman_numbers=True,
rating_font='Liberation Serif', rtl=False, comments_heading_pos='hide' rating_font='Liberation Serif', rtl=False, comments_heading_pos='hide',
for_qt=False,
): ):
if field_list is None: if field_list is None:
field_list = get_field_list(mi) field_list = get_field_list(mi)
@ -324,8 +325,9 @@ def mi_to_html(
ans = [u'<tr id="%s" class="%s">%s</tr>'%(fieldl.replace('#', '_'), ans = [u'<tr id="%s" class="%s">%s</tr>'%(fieldl.replace('#', '_'),
classname(fieldl), html) for fieldl, html in ans] classname(fieldl), html) for fieldl, html in ans]
# print '\n'.join(ans) # print '\n'.join(ans)
direction = 'rtl' if rtl else 'ltr' rans = u'<style>table.fields td { vertical-align:top}</style><table class="fields" '
margin = 'left' if rtl else 'right' if not for_qt:
return u'<style>table.fields td { vertical-align:top}</style>' + \ direction = 'rtl' if rtl else 'ltr'
u'<table class="fields" style="direction: %s; margin-%s:auto">%s</table>'%( margin = 'left' if rtl else 'right'
direction, margin, u'\n'.join(ans)), comment_fields rans += 'style="direction: {}; margin-{}: auto" '.format(direction, margin)
return '{}>{}</table>'.format(rans, '\n'.join(ans)), comment_fields

View File

@ -163,7 +163,7 @@ def render_data(mi, use_roman_numbers=True, all_fields=False, pref_name='book_di
return mi_to_html( return mi_to_html(
mi, field_list=field_list, use_roman_numbers=use_roman_numbers, rtl=is_rtl(), mi, field_list=field_list, use_roman_numbers=use_roman_numbers, rtl=is_rtl(),
rating_font=rating_font(), default_author_link=default_author_link(), rating_font=rating_font(), default_author_link=default_author_link(),
comments_heading_pos=gprefs['book_details_comments_heading_pos'] comments_heading_pos=gprefs['book_details_comments_heading_pos'], for_qt=True
) )
# }}} # }}}