View Single Post
Old 03-27-2023, 10:17 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,458
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by igorius View Post
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
        },
        ...

    )))

Last edited by chaley; 03-27-2023 at 10:22 AM. Reason: Added a third source of datatypes
chaley is offline   Reply With Quote