mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Book details: Add an option in Preferences->Look & feel->Book details to show a heading for the comments in the book details panel
See #1855942 ([Enhancements] Comments and select text with keyboard)
This commit is contained in:
parent
e24e4b0a58
commit
431d55dbca
@ -87,7 +87,11 @@ def author_search_href(which, title=None, author=None):
|
||||
return func(key, title=title, author=author), tt
|
||||
|
||||
|
||||
def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=True, rating_font='Liberation Serif', rtl=False):
|
||||
def mi_to_html(
|
||||
mi,
|
||||
field_list=None, default_author_link=None, use_roman_numbers=True,
|
||||
rating_font='Liberation Serif', rtl=False, comments_heading_pos='hide'
|
||||
):
|
||||
if field_list is None:
|
||||
field_list = get_field_list(mi)
|
||||
ans = []
|
||||
@ -131,10 +135,11 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=
|
||||
val = markdown(val)
|
||||
else:
|
||||
val = comments_to_html(val)
|
||||
if disp.get('heading_position', 'hide') == 'side':
|
||||
heading_position = disp.get('heading_position', comments_heading_pos)
|
||||
if heading_position == 'side':
|
||||
ans.append((field, row % (name, val)))
|
||||
else:
|
||||
if disp.get('heading_position', 'hide') == 'above':
|
||||
if heading_position == 'above':
|
||||
val = '<h3 class="comments-heading">%s</h3>%s' % (p(name), val)
|
||||
comment_fields.append('<div id="%s" class="comments">%s</div>' % (field.replace('#', '_'), val))
|
||||
elif metadata['datatype'] == 'rating':
|
||||
|
@ -186,7 +186,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'
|
||||
defs['book_details_comments_heading_pos'] = 'hide'
|
||||
defs['book_list_split'] = False
|
||||
defs['wrap_toolbar_text'] = False
|
||||
defs['dnd_merge'] = True
|
||||
|
@ -160,8 +160,11 @@ def get_field_list(fm, use_defaults=False, pref_name='book_display_fields'):
|
||||
def render_data(mi, use_roman_numbers=True, all_fields=False, pref_name='book_display_fields'):
|
||||
field_list = get_field_list(getattr(mi, 'field_metadata', field_metadata), pref_name=pref_name)
|
||||
field_list = [(x, all_fields or display) for x, display in field_list]
|
||||
return mi_to_html(mi, field_list=field_list, use_roman_numbers=use_roman_numbers, rtl=is_rtl(),
|
||||
rating_font=rating_font(), default_author_link=default_author_link())
|
||||
return mi_to_html(
|
||||
mi, field_list=field_list, use_roman_numbers=use_roman_numbers, rtl=is_rtl(),
|
||||
rating_font=rating_font(), default_author_link=default_author_link(),
|
||||
comments_heading_pos=gprefs['book_details_comments_heading_pos']
|
||||
)
|
||||
|
||||
# }}}
|
||||
|
||||
|
@ -441,6 +441,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
(_('Left'), 'left'), (_('Top'), 'top'), (_('Right'), 'right'), (_('Bottom'), 'bottom')])
|
||||
r('book_list_extra_row_spacing', gprefs)
|
||||
r('booklist_grid', gprefs)
|
||||
r('book_details_comments_heading_pos', gprefs, choices=[
|
||||
(_('Never'), 'hide'), (_('Above text'), 'above'), (_('Beside text'), 'side')])
|
||||
self.cover_browser_title_template_button.clicked.connect(self.edit_cb_title_template)
|
||||
self.id_links_button.clicked.connect(self.edit_id_link_rules)
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="main_interface_tab">
|
||||
<attribute name="icon">
|
||||
@ -726,69 +726,8 @@ A value of zero means calculate automatically.</string>
|
||||
<attribute name="title">
|
||||
<string>&Book details</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="opt_bd_show_cover">
|
||||
<property name="text">
|
||||
<string>Show &cover in the Book details panel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="opt_bd_overlay_cover_size">
|
||||
<property name="toolTip">
|
||||
<string>Show the size of the book's cover in pixels</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show cover &size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="opt_use_roman_numerals_for_series_number">
|
||||
<property name="text">
|
||||
<string>Use &Roman numerals for series</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_bd1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QWidget" name="default_author_link_container" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="id_links_button">
|
||||
<property name="text">
|
||||
<string>Create rules to convert &identifiers into links</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="6" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Text styling</string>
|
||||
@ -800,7 +739,24 @@ A value of zero means calculate automatically.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="id_links_button">
|
||||
<property name="text">
|
||||
<string>Create rules to convert &identifiers into links</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QWidget" name="default_author_link_container" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Select displayed metadata</string>
|
||||
@ -861,6 +817,74 @@ A value of zero means calculate automatically.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="opt_bd_show_cover">
|
||||
<property name="text">
|
||||
<string>Show &cover in the Book details panel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="opt_bd_overlay_cover_size">
|
||||
<property name="toolTip">
|
||||
<string>Show the size of the book's cover in pixels</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show cover &size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="opt_use_roman_numerals_for_series_number">
|
||||
<property name="text">
|
||||
<string>Use &Roman numerals for series</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_bd1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Show comments &heading:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>opt_book_details_comments_heading_pos</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="opt_book_details_comments_heading_pos">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tag_browser_tab">
|
||||
|
Loading…
x
Reference in New Issue
Block a user