Quote:
Originally Posted by igorius
You didnt understand: I dont want to change the column, its type yes/no. I want to change the plugin! So what types do i have?
text, float, int, comments, datetime...
Does exist a type bool and what is its name? See in preferences, custom column. The boolean is named yes/no. Whats its real name which i can use in my plugin?
|
Yes, a boolean type exists and its datatype (what I think you are referring to as 'name') is 'bool'.
For the complete list of datatypes see calibre/library/field_metadata.py line 293:
Code:
VALID_DATA_TYPES = frozenset([None, 'rating', 'text', 'comments', 'datetime',
'int', 'float', 'bool', 'series', 'composite', 'enumeration'])
and in calibre/db/backend.py line 58:
Code:
CUSTOM_DATA_TYPES = frozenset(('rating', 'text', 'comments', 'datetime',
'int', 'float', 'bool', 'series', 'composite', 'enumeration'))
and in calibre/gui2/preferences/create_custom_column.py line 822
Code:
The datatype must be one of calibre's custom column types: 'bool',
'comments', 'composite', 'datetime', 'enumeration', 'float', 'int',
'rating', 'series', or 'text'. The datatype can't be changed in the dialog.
The information can be derived from calibre/gui2/preferences/create_custom_column.py.
Code:
column_types = dict(enumerate((
...
{
'datatype':'bool', # The column datatype
'text':_('Yes/No'), # The name used in the dialog's type dropdown
'is_multiple':False
},
...
)))