mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix comments not being displayed to the side in the horizontal book display panel
Thanks to limitations of Qt's HTML support we cant any longer have comments text wrap around the rest of the metadata. Now the rest of the metadata and the comments are display in 2:3 fixed columns
This commit is contained in:
parent
6bb5a1376c
commit
85394a43a8
@ -131,6 +131,7 @@ def render_html(mi, css, vertical, widget, all_fields=False, render_data_func=No
|
|||||||
</style>
|
</style>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
%s
|
%s
|
||||||
|
table td.title { white-space: nowrap }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -141,17 +142,13 @@ def render_html(mi, css, vertical, widget, all_fields=False, render_data_func=No
|
|||||||
comments = ''
|
comments = ''
|
||||||
if comment_fields:
|
if comment_fields:
|
||||||
comments = '\n'.join('<div>%s</div>' % x for x in comment_fields)
|
comments = '\n'.join('<div>%s</div>' % x for x in comment_fields)
|
||||||
right_pane = '<div id="comments" class="comments">%s</div>'%comments
|
right_pane = comments
|
||||||
|
|
||||||
if vertical:
|
if vertical:
|
||||||
ans = templ%(table+right_pane)
|
ans = templ%(table+right_pane)
|
||||||
else:
|
else:
|
||||||
if gprefs['book_details_narrow_comments_layout'] == 'columns':
|
ans = templ % (
|
||||||
ans = templ%('<table><tr><td valign="top" '
|
'<table><tr><td valign="top" width="40%">{}</td><td valign="top" width="60%">{}</td></tr></table>'.format(
|
||||||
'style="padding-right:2em; width:40%%">%s</td><td valign="top">%s</td></tr></table>'
|
|
||||||
% (table, right_pane))
|
|
||||||
else:
|
|
||||||
ans = templ%('<div style="float: left; margin-right: 1em; margin-bottom: 1em; max-width: 40%">{}</div><div>{}</div>'.format(
|
|
||||||
table, right_pane))
|
table, right_pane))
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import json, textwrap
|
import json
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
@ -440,12 +440,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
(_('Left'), 'left'), (_('Top'), 'top'), (_('Right'), 'right'), (_('Bottom'), 'bottom')])
|
(_('Left'), 'left'), (_('Top'), 'top'), (_('Right'), 'right'), (_('Bottom'), 'bottom')])
|
||||||
r('book_list_extra_row_spacing', gprefs)
|
r('book_list_extra_row_spacing', gprefs)
|
||||||
r('booklist_grid', gprefs)
|
r('booklist_grid', gprefs)
|
||||||
r('book_details_narrow_comments_layout', gprefs, choices=[(_('Float'), 'float'), (_('Columns'), 'columns')])
|
|
||||||
self.opt_book_details_narrow_comments_layout.setToolTip(textwrap.fill(_(
|
|
||||||
'Choose how the text is laid out when using the "Narrow" user interface layout.'
|
|
||||||
' A value of "Float" means that the comments text will wrap around'
|
|
||||||
' the other metadata fields, while a value of "Columns" means that'
|
|
||||||
' the comments will be in a separate fixed width column.')))
|
|
||||||
self.cover_browser_title_template_button.clicked.connect(self.edit_cb_title_template)
|
self.cover_browser_title_template_button.clicked.connect(self.edit_cb_title_template)
|
||||||
self.id_links_button.clicked.connect(self.edit_id_link_rules)
|
self.id_links_button.clicked.connect(self.edit_id_link_rules)
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>843</width>
|
<width>843</width>
|
||||||
<height>552</height>
|
<height>580</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -727,17 +727,7 @@ A value of zero means calculate automatically.</string>
|
|||||||
<string>&Book details</string>
|
<string>&Book details</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_12">
|
<layout class="QGridLayout" name="gridLayout_12">
|
||||||
<item row="4" column="1">
|
<item row="3" column="0" rowspan="2">
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Note that <b>comments</b> will always be displayed at the end, regardless of the position you assign here.</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" rowspan="2">
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Select displayed metadata</string>
|
<string>Select displayed metadata</string>
|
||||||
@ -832,7 +822,7 @@ A value of zero means calculate automatically.</string>
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QPushButton" name="id_links_button">
|
<widget class="QPushButton" name="id_links_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Create rules to convert &identifiers into links</string>
|
<string>Create rules to convert &identifiers into links</string>
|
||||||
@ -849,19 +839,16 @@ A value of zero means calculate automatically.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="label_25">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>How to display text in the 'Narrow' &layout:</string>
|
<string>Note that <b>comments</b> will always be displayed at the end, regardless of the position you assign here.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="wordWrap">
|
||||||
<cstring>opt_book_details_narrow_comments_layout</cstring>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="opt_book_details_narrow_comments_layout"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tag_browser_tab">
|
<widget class="QWidget" name="tag_browser_tab">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user