Book details panel: An option to control the layout of the panel in "Narrow" mode (Preferences->Look & feel->Book details)

See #1714613 (Is the description suppose to bleed over to the details panel?)
This commit is contained in:
Kovid Goyal 2017-09-18 10:03:16 +05:30
parent 28965f45ae
commit 110b022a86
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 43 additions and 18 deletions

View File

@ -156,6 +156,7 @@ def create_defs():
defs['qv_dclick_changes_column'] = True defs['qv_dclick_changes_column'] = True
defs['qv_retkey_changes_column'] = True defs['qv_retkey_changes_column'] = True
defs['qv_follows_column'] = False defs['qv_follows_column'] = False
defs['book_details_narrow_comments_layout'] = 'float'
create_defs() create_defs()

View File

@ -134,8 +134,13 @@ def render_html(mi, css, vertical, widget, all_fields=False, render_data_func=No
if vertical: if vertical:
ans = templ%(table+right_pane) ans = templ%(table+right_pane)
else: else:
ans = templ%(u'<div style="float: left; margin-right: 1em; margin-bottom: 1em; max-width: 40%">{}</div><div>{}</div>'.format( if gprefs['book_details_narrow_comments_layout'] == 'columns':
table, right_pane)) ans = templ%(u'<table><tr><td valign="top" '
'style="padding-right:2em; width:40%%">%s</td><td valign="top">%s</td></tr></table>'
% (table, right_pane))
else:
ans = templ%(u'<div style="float: left; margin-right: 1em; margin-bottom: 1em; max-width: 40%">{}</div><div>{}</div>'.format(
table, right_pane))
return ans return ans

View File

@ -5,7 +5,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 import json, textwrap
from collections import defaultdict from collections import defaultdict
from threading import Thread from threading import Thread
@ -403,6 +403,12 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
r('emblem_position', gprefs, choices=[ r('emblem_position', gprefs, choices=[
(_('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('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)

View File

@ -168,7 +168,7 @@
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Interface font:</string> <string>&amp;Interface font:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>font_display</cstring> <cstring>font_display</cstring>
@ -252,7 +252,7 @@
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_hidpi"> <widget class="QLabel" name="label_hidpi">
<property name="text"> <property name="text">
<string>Adjust for &amp;high resolution screens (needs restart):</string> <string>&amp;Adjust for high resolution screens (needs restart):</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>opt_hidpi</cstring> <cstring>opt_hidpi</cstring>
@ -340,7 +340,7 @@
<item row="6" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_16"> <widget class="QLabel" name="label_16">
<property name="text"> <property name="text">
<string>&amp;Spacing between covers:</string> <string>Spac&amp;ing between covers:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>opt_cover_grid_spacing</cstring> <cstring>opt_cover_grid_spacing</cstring>
@ -703,7 +703,7 @@ A value of zero means calculate automatically.</string>
<string>&amp;Book details</string> <string>&amp;Book details</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_12"> <layout class="QGridLayout" name="gridLayout_12">
<item row="3" column="1"> <item row="4" column="1">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Note that &lt;b&gt;comments&lt;/b&gt; will always be displayed at the end, regardless of the position you assign here.</string> <string>Note that &lt;b&gt;comments&lt;/b&gt; will always be displayed at the end, regardless of the position you assign here.</string>
@ -713,7 +713,7 @@ A value of zero means calculate automatically.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" rowspan="2"> <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>
@ -808,7 +808,7 @@ A value of zero means calculate automatically.</string>
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="3" 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 &amp;identifiers into links</string> <string>Create rules to convert &amp;identifiers into links</string>
@ -825,6 +825,19 @@ A value of zero means calculate automatically.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>How to display text in the 'Narrow' &amp;layout:</string>
</property>
<property name="buddy">
<cstring>opt_book_details_narrow_comments_layout</cstring>
</property>
</widget>
</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">
@ -890,7 +903,7 @@ a few top-level elements.</string>
<item row="7" column="0"> <item row="7" column="0">
<widget class="QLabel" name="label_81"> <widget class="QLabel" name="label_81">
<property name="text"> <property name="text">
<string>Categories with &amp;hierarchical items:</string> <string>C&amp;ategories with hierarchical items:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>opt_categories_using_hierarchy</cstring> <cstring>opt_categories_using_hierarchy</cstring>
@ -981,7 +994,7 @@ see the counts by hovering your mouse over any item.</string>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>&amp;Spacing between items:</string> <string>Spacing between &amp;items:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>opt_tag_browser_item_padding</cstring> <cstring>opt_tag_browser_item_padding</cstring>
@ -1144,25 +1157,25 @@ them to all have the same width and height</string>
<layout class="QGridLayout" name="gridLayout_122"> <layout class="QGridLayout" name="gridLayout_122">
<item row="2" column="0"> <item row="2" column="0">
<widget class="QCheckBox" name="opt_qv_respects_vls"> <widget class="QCheckBox" name="opt_qv_respects_vls">
<property name="text">
<string>&amp;Apply virtual libraries in Quickview panel</string>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Check this box to make Quickview show books only in the <string>Check this box to make Quickview show books only in the
current virtual library. If unchecked, Quickview ignores virtual libraries. If current virtual library. If unchecked, Quickview ignores virtual libraries. If
unchecked then only row changes are taken into account.</string> unchecked then only row changes are taken into account.</string>
</property> </property>
<property name="text">
<string>&amp;Apply virtual libraries in Quickview panel</string>
</property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QCheckBox" name="opt_qv_follows_column"> <widget class="QCheckBox" name="opt_qv_follows_column">
<property name="text">
<string>&amp;Change QV item when book list column changes</string>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Check this box to make Quickview change the column being examined <string>Check this box to make Quickview change the column being examined
when the column in the book list is changed using the cursor arrow keys</string> when the column in the book list is changed using the cursor arrow keys</string>
</property> </property>
<property name="text">
<string>&amp;Change QV item when book list column changes</string>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
@ -1187,7 +1200,7 @@ column being examined (the left-hand pane)</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0" rowspan="2"> <item row="3" column="0" rowspan="2">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">