mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Add an option to show the title for long text (comments type) custom columns in the book details panel. Access the option in Preferences->Add your own columns->Choose the column and click the button to edit the settings for that column.
This commit is contained in:
parent
edb17d89ce
commit
0b3125e4d8
@ -14,6 +14,11 @@ a:hover {
|
||||
text-indent: 0
|
||||
}
|
||||
|
||||
.comments-heading {
|
||||
font-size: larger;
|
||||
font-weight: bold
|
||||
}
|
||||
|
||||
table.fields {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
@ -43,5 +48,8 @@ The HTML that this stylesheet applies to looks like this:
|
||||
|
||||
<div id="comments" class="comments"><h3>From Publishers Weekly</h3><p>At the start of Kearney's rousing sequel to <em>The Mark of Ran</em> (2005), Rol Cortishane, the youthful captain of the privateer <em>Revenant</em>, captures a slaver and frees its chained slaves. Back in the harbor of Ganesh Ka in the land of Umer, Rol encounters an untrustworthy acquaintance he hasn't seen in years, Canker, a former king of thieves, who urges Rol to join in the fight to save Rowen, a darkly beautiful queen, whose throne is at risk in mountainous Bionar. That Rowen is Rol's half-sister for whom he has lusted in the past doesn't make Rol's decision to help an easy one. If as in <em>The Mark of Ran</em> the action is more lively at sea than on land, Kearney's solid storytelling and nautical detail worthy of C.S. Forester or Patrick O'Brian will keep readers turning the pages. <em>(Dec.)</em> <br />Copyright © Reed Business Information, a division of Reed Elsevier Inc. All rights reserved. </p><h3>From</h3><p>The sequel to <em>The Mark of Ran</em> (2005) finds heroic young Rol Cortishane grown to be a much-feared sea captain. Deciding to ignore his mysterious past, he spends his energy on ship and crew. He is still an outlaw, however, and the only port he can call home is Ganesh Ka, the endangered city of exiles. When word comes from Rowan, his half-sister, asking him to fight on her behalf, he must weigh the safety of Ganesh Ka against Rowan's treachery in the past. Finally persuaded to aid Rowan, he learns more of betrayal and his heritage in the ensuing battles than he had wanted to know. Kearney's characters are much better developed here than they were in <em>The Mark of Ran</em>, and since the book tells a single story, the plot is tighter. Moreover, because almost all the action transpires in the here and now, the sequel can be read without reference to the predecessor. Since it ends hanging on a particularly bloody cliff, expect to see more of Kearney's excellent maritime fantasy. <em>Frieda Murray</em><br /><em>Copyright © American Library Association. All rights reserved</em></p>
|
||||
</div>
|
||||
|
||||
<h3 class="comments-heading">Custom comments column heading</h3>
|
||||
<div id="_customcolname" class="comments">...</div>
|
||||
*/
|
||||
|
||||
|
@ -86,8 +86,10 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=
|
||||
if metadata['datatype'] == 'comments' or field == 'comments':
|
||||
val = getattr(mi, field)
|
||||
if val:
|
||||
val = force_unicode(val)
|
||||
comment_fields.append(comments_to_html(val))
|
||||
val = comments_to_html(force_unicode(val))
|
||||
if metadata['display'].get('show_heading'):
|
||||
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':
|
||||
val = getattr(mi, field)
|
||||
if val:
|
||||
|
@ -163,6 +163,8 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
|
||||
elif ct in ['int', 'float']:
|
||||
if c['display'].get('number_format', None):
|
||||
self.format_box.setText(c['display'].get('number_format', ''))
|
||||
elif ct == 'comments':
|
||||
self.show_comments_heading.setChecked(c['display'].get('show_heading', False))
|
||||
self.datatype_changed()
|
||||
if ct in ['text', 'composite', 'enumeration']:
|
||||
self.use_decorations.setChecked(c['display'].get('use_decorations', False))
|
||||
@ -172,7 +174,7 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
|
||||
|
||||
self.exec_()
|
||||
|
||||
def shortcut_activated(self, url):
|
||||
def shortcut_activated(self, url): # {{{
|
||||
which = unicode(url).split(':')[-1]
|
||||
self.column_type_box.setCurrentIndex({
|
||||
'yesno': 9,
|
||||
@ -198,8 +200,9 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
|
||||
'formats': "{:'approximate_formats()'}",
|
||||
}[which])
|
||||
self.composite_sort_by.setCurrentIndex(0)
|
||||
# }}}
|
||||
|
||||
def setup_ui(self):
|
||||
def setup_ui(self): # {{{
|
||||
self.setWindowModality(Qt.ApplicationModal)
|
||||
self.setWindowIcon(QIcon(I('column.png')))
|
||||
self.vl = l = QVBoxLayout(self)
|
||||
@ -295,6 +298,12 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
|
||||
h.addWidget(cb), h.addWidget(cdl)
|
||||
self.composite_label = add_row(_("&Template"), h)
|
||||
|
||||
# Comments properties
|
||||
self.show_comments_heading = sch = QCheckBox(_('Show heading in book details panel'))
|
||||
sch.setToolTip(_(
|
||||
'Choose whether to show the heading for this column in the Book Details Panel'))
|
||||
add_row(None, sch)
|
||||
|
||||
# Values for enum type
|
||||
l = QGridLayout()
|
||||
self.enum_box = eb = QLineEdit(self)
|
||||
@ -340,6 +349,7 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
|
||||
add_row(None, l)
|
||||
|
||||
self.resize(self.sizeHint())
|
||||
# }}}
|
||||
|
||||
def datatype_changed(self, *args):
|
||||
try:
|
||||
@ -384,6 +394,7 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
|
||||
getattr(self, 'enum_'+x).setVisible(col_type == 'enumeration')
|
||||
self.use_decorations.setVisible(col_type in ['text', 'composite', 'enumeration'])
|
||||
self.is_names.setVisible(col_type == '*text')
|
||||
self.show_comments_heading.setVisible(col_type == 'comments')
|
||||
|
||||
def accept(self):
|
||||
col = unicode(self.column_name_box.text()).strip()
|
||||
@ -478,6 +489,8 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
|
||||
display_dict = {'number_format':unicode(self.format_box.text()).strip()}
|
||||
else:
|
||||
display_dict = {'number_format': None}
|
||||
elif col_type == 'comments':
|
||||
display_dict['show_heading'] = bool(self.show_comments_heading.isChecked())
|
||||
|
||||
if col_type in ['text', 'composite', 'enumeration'] and not is_multiple:
|
||||
display_dict['use_decorations'] = self.use_decorations.checkState()
|
||||
|
Loading…
x
Reference in New Issue
Block a user