mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Enhancement #1417219: description field for custom columns
This commit is contained in:
parent
9c19537b70
commit
719b36ea00
@ -926,13 +926,19 @@ class BooksModel(QAbstractTableModel): # {{{
|
||||
return None
|
||||
if role == Qt.ToolTipRole:
|
||||
ht = self.column_map[section]
|
||||
fm = self.db.field_metadata[self.column_map[section]]
|
||||
if ht == 'timestamp': # change help text because users know this field as 'date'
|
||||
ht = 'date'
|
||||
if self.db.field_metadata[self.column_map[section]]['is_category']:
|
||||
is_cat = '.\n\n' + _('Click in this column and press Q to Quickview books with the same %s') % ht
|
||||
if fm['is_category']:
|
||||
is_cat = '\n\n' + _('Click in this column and press Q to Quickview books with the same %s') % ht
|
||||
else:
|
||||
is_cat = ''
|
||||
return (_('The lookup/search name is "{0}"{1}').format(ht, is_cat))
|
||||
cust_desc = ''
|
||||
if fm['is_custom']:
|
||||
cust_desc = fm['display'].get('description', '')
|
||||
if cust_desc:
|
||||
cust_desc = '\n' + _('Description:') + ' ' + cust_desc
|
||||
return (_('The lookup/search name is "{0}"{1}{2}').format(ht, cust_desc, is_cat))
|
||||
if role == Qt.DisplayRole:
|
||||
return (self.headers[self.column_map[section]])
|
||||
return None
|
||||
|
@ -145,6 +145,7 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
|
||||
self.use_decorations.setChecked(c['display'].get('use_decorations', False))
|
||||
elif ct == '*text':
|
||||
self.is_names.setChecked(c['display'].get('is_names', False))
|
||||
self.description_box.setText(c['display'].get('description', ''))
|
||||
|
||||
self.composite_contains_html.setToolTip('<p>' +
|
||||
_('If checked, this column will be displayed as HTML in '
|
||||
@ -312,6 +313,7 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
|
||||
|
||||
if col_type in ['text', 'composite', 'enumeration'] and not is_multiple:
|
||||
display_dict['use_decorations'] = self.use_decorations.checkState()
|
||||
display_dict['description'] = self.description_box.text().strip()
|
||||
|
||||
if not self.editing_col:
|
||||
self.parent.custcols[key] = {
|
||||
|
@ -151,6 +151,23 @@ Everything else will show nothing.</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="text">
|
||||
<string>D&escription</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>description_box</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLineEdit" name="description_box">
|
||||
<property name="toolTip">
|
||||
<string>Optional text describing what this column is for</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
|
@ -333,7 +333,13 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
elif key == 'news':
|
||||
tt = ''
|
||||
else:
|
||||
tt = _(u'The lookup/search name is "{0}"').format(key)
|
||||
cust_desc = ''
|
||||
fm = self.db.field_metadata[key]
|
||||
if fm['is_custom']:
|
||||
cust_desc = fm['display'].get('description', '')
|
||||
if cust_desc:
|
||||
cust_desc = '\n' + _('Description:') + ' ' + cust_desc
|
||||
tt = _(u'The lookup/search name is "{0}"{1}').format(key, cust_desc)
|
||||
|
||||
if self.category_custom_icons.get(key, None) is None:
|
||||
self.category_custom_icons[key] = (
|
||||
|
Loading…
x
Reference in New Issue
Block a user