From 110b022a86a7b8ac2c6020ebb596ac4c44d483c4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 18 Sep 2017 10:03:16 +0530 Subject: [PATCH] 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?) --- src/calibre/gui2/__init__.py | 1 + src/calibre/gui2/book_details.py | 9 +++-- src/calibre/gui2/preferences/look_feel.py | 8 ++++- src/calibre/gui2/preferences/look_feel.ui | 43 +++++++++++++++-------- 4 files changed, 43 insertions(+), 18 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 63bf776340..5bb932d9fa 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -156,6 +156,7 @@ def create_defs(): defs['qv_dclick_changes_column'] = True defs['qv_retkey_changes_column'] = True defs['qv_follows_column'] = False + defs['book_details_narrow_comments_layout'] = 'float' create_defs() diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index 4dcd694eef..c0860bcf62 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -134,8 +134,13 @@ def render_html(mi, css, vertical, widget, all_fields=False, render_data_func=No if vertical: ans = templ%(table+right_pane) else: - ans = templ%(u'
{}
{}
'.format( - table, right_pane)) + if gprefs['book_details_narrow_comments_layout'] == 'columns': + ans = templ%(u'
%s%s
' + % (table, right_pane)) + else: + ans = templ%(u'
{}
{}
'.format( + table, right_pane)) return ans diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index d6bd4cf379..0d6c46cbaa 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -5,7 +5,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import json +import json, textwrap from collections import defaultdict from threading import Thread @@ -403,6 +403,12 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('emblem_position', gprefs, choices=[ (_('Left'), 'left'), (_('Top'), 'top'), (_('Right'), 'right'), (_('Bottom'), 'bottom')]) 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.id_links_button.clicked.connect(self.edit_id_link_rules) diff --git a/src/calibre/gui2/preferences/look_feel.ui b/src/calibre/gui2/preferences/look_feel.ui index f7d4982b28..baa4a30b29 100644 --- a/src/calibre/gui2/preferences/look_feel.ui +++ b/src/calibre/gui2/preferences/look_feel.ui @@ -168,7 +168,7 @@ - Interface font: + &Interface font: font_display @@ -252,7 +252,7 @@ - Adjust for &high resolution screens (needs restart): + &Adjust for high resolution screens (needs restart): opt_hidpi @@ -340,7 +340,7 @@ - &Spacing between covers: + Spac&ing between covers: opt_cover_grid_spacing @@ -703,7 +703,7 @@ A value of zero means calculate automatically. &Book details - + Note that <b>comments</b> will always be displayed at the end, regardless of the position you assign here. @@ -713,7 +713,7 @@ A value of zero means calculate automatically. - + Select displayed metadata @@ -808,7 +808,7 @@ A value of zero means calculate automatically. - + Create rules to convert &identifiers into links @@ -825,6 +825,19 @@ A value of zero means calculate automatically. + + + + How to display text in the 'Narrow' &layout: + + + opt_book_details_narrow_comments_layout + + + + + + @@ -890,7 +903,7 @@ a few top-level elements. - Categories with &hierarchical items: + C&ategories with hierarchical items: opt_categories_using_hierarchy @@ -981,7 +994,7 @@ see the counts by hovering your mouse over any item. - &Spacing between items: + Spacing between &items: opt_tag_browser_item_padding @@ -1144,25 +1157,25 @@ them to all have the same width and height - - &Apply virtual libraries in Quickview panel - Check this box to make Quickview show books only in the current virtual library. If unchecked, Quickview ignores virtual libraries. If unchecked then only row changes are taken into account. + + &Apply virtual libraries in Quickview panel + - - &Change QV item when book list column changes - 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 + + &Change QV item when book list column changes + @@ -1187,7 +1200,7 @@ column being examined (the left-hand pane) - +