mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
74b9f66d02
@ -2350,11 +2350,18 @@ class Cache:
|
||||
return self._books_for_field(f.name, int(item_id_or_composite_value))
|
||||
|
||||
@read_api
|
||||
def split_if_is_multiple_composite(self, f, v):
|
||||
def split_if_is_multiple_composite(self, f, val):
|
||||
'''
|
||||
If f is a composite column lookup key and the column is is_multiple then
|
||||
split v into unique non-empty values. The comparison is case sensitive.
|
||||
Order is not preserved. Return a list() for compatibility with proxy
|
||||
metadata field getters, for example tags.
|
||||
'''
|
||||
fm = self.field_metadata.get(f, None)
|
||||
if fm and fm['datatype'] == 'composite' and fm['is_multiple']:
|
||||
return [v.strip() for v in v.split(',') if v.strip()]
|
||||
return v
|
||||
sep = fm['is_multiple'].get('cache_to_list', ',')
|
||||
return (list(set(v.strip() for v in val.split(sep) if v.strip())))
|
||||
return val
|
||||
|
||||
@read_api
|
||||
def data_for_find_identical_books(self):
|
||||
|
@ -542,10 +542,7 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
self.books_table.setRowCount(0)
|
||||
|
||||
mi = self.db.new_api.get_proxy_metadata(book_id)
|
||||
vals = mi.get(key, None)
|
||||
if self.fm[key]['datatype'] == 'composite' and self.fm[key]['is_multiple']:
|
||||
sep = self.fm[key]['is_multiple'].get('cache_to_list', ',')
|
||||
vals = [v.strip() for v in vals.split(sep) if v.strip()]
|
||||
vals = self.db.new_api.split_if_is_multiple_composite(key, mi.get(key, None))
|
||||
try:
|
||||
# Check if we are in the GridView and there are no values for the
|
||||
# selected column. In this case switch the column to 'authors'
|
||||
|
@ -773,7 +773,7 @@ class CcTemplateDelegate(QStyledItemDelegate): # {{{
|
||||
|
||||
def __init__(self, parent):
|
||||
'''
|
||||
Delegate for custom_column bool data.
|
||||
Delegate for composite custom_columns.
|
||||
'''
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
self.disallow_edit = gprefs['edit_metadata_templates_only_F2_on_booklist']
|
||||
|
Loading…
x
Reference in New Issue
Block a user