mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove text from bool-decorated composite columns if that text results in a decoration.
This commit is contained in:
parent
f7886289d9
commit
8a282596b3
@ -646,6 +646,14 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
return QVariant(', '.join(sorted(text.split('|'),key=sort_key)))
|
return QVariant(', '.join(sorted(text.split('|'),key=sort_key)))
|
||||||
return QVariant(text)
|
return QVariant(text)
|
||||||
|
|
||||||
|
def decorated_text_type(r, mult=False, idx=-1):
|
||||||
|
text = self.db.data[r][idx]
|
||||||
|
if force_to_bool(text) is not None:
|
||||||
|
return None
|
||||||
|
if text and mult:
|
||||||
|
return QVariant(', '.join(sorted(text.split('|'),key=sort_key)))
|
||||||
|
return QVariant(text)
|
||||||
|
|
||||||
def number_type(r, idx=-1):
|
def number_type(r, idx=-1):
|
||||||
return QVariant(self.db.data[r][idx])
|
return QVariant(self.db.data[r][idx])
|
||||||
|
|
||||||
@ -687,6 +695,8 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
self.dc[col] = functools.partial(text_type, idx=idx, mult=mult)
|
self.dc[col] = functools.partial(text_type, idx=idx, mult=mult)
|
||||||
if datatype in ['text', 'composite', 'enumeration'] and not mult:
|
if datatype in ['text', 'composite', 'enumeration'] and not mult:
|
||||||
if self.custom_columns[col]['display'].get('use_decorations', False):
|
if self.custom_columns[col]['display'].get('use_decorations', False):
|
||||||
|
self.dc[col] = functools.partial(decorated_text_type,
|
||||||
|
idx=idx, mult=mult)
|
||||||
self.dc_decorator[col] = functools.partial(
|
self.dc_decorator[col] = functools.partial(
|
||||||
bool_type_decorator, idx=idx,
|
bool_type_decorator, idx=idx,
|
||||||
bool_cols_are_tristate=
|
bool_cols_are_tristate=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user