mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix adding user category search terms
This commit is contained in:
parent
c47013ef46
commit
ab4ad1be85
@ -7,6 +7,7 @@ import copy
|
|||||||
|
|
||||||
from calibre.utils.ordered_dict import OrderedDict
|
from calibre.utils.ordered_dict import OrderedDict
|
||||||
from calibre.utils.config import tweaks
|
from calibre.utils.config import tweaks
|
||||||
|
from calibre.utils.icu import lower
|
||||||
|
|
||||||
class TagsIcons(dict):
|
class TagsIcons(dict):
|
||||||
'''
|
'''
|
||||||
@ -471,7 +472,8 @@ class FieldMetadata(dict):
|
|||||||
self.custom_label_to_key_map[label+'_index'] = key
|
self.custom_label_to_key_map[label+'_index'] = key
|
||||||
|
|
||||||
def remove_dynamic_categories(self):
|
def remove_dynamic_categories(self):
|
||||||
for key in list(self._tb_cats.keys()):
|
keys = list(self._tb_cats.keys())[:]
|
||||||
|
for key in keys:
|
||||||
val = self._tb_cats[key]
|
val = self._tb_cats[key]
|
||||||
if val['is_category'] and val['kind'] in ('user', 'search'):
|
if val['is_category'] and val['kind'] in ('user', 'search'):
|
||||||
del self._tb_cats[key]
|
del self._tb_cats[key]
|
||||||
@ -482,6 +484,7 @@ class FieldMetadata(dict):
|
|||||||
return self._tb_cats[key]['rec_index'] + 1
|
return self._tb_cats[key]['rec_index'] + 1
|
||||||
|
|
||||||
def add_user_category(self, label, name):
|
def add_user_category(self, label, name):
|
||||||
|
label = lower(label)
|
||||||
if label in self._tb_cats:
|
if label in self._tb_cats:
|
||||||
raise ValueError('Duplicate user field [%s]'%(label))
|
raise ValueError('Duplicate user field [%s]'%(label))
|
||||||
self._tb_cats[label] = {'table':None, 'column':None,
|
self._tb_cats[label] = {'table':None, 'column':None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user