mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
aea3492d77
@ -155,8 +155,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
name = icu_lower(str(self.gst_names.currentText()))
|
name = icu_lower(str(self.gst_names.currentText()))
|
||||||
if not name:
|
if not name:
|
||||||
return error_dialog(self.gui, _('Grouped search terms'),
|
return error_dialog(self.gui, _('Grouped search terms'),
|
||||||
_('The search term cannot be blank'),
|
_('The search term name cannot be blank'),
|
||||||
show=True)
|
show=True)
|
||||||
|
if ' ' in name:
|
||||||
|
return error_dialog(self.gui, _('Invalid grouped search name'),
|
||||||
|
_('The grouped search term name cannot contain spaces'), show=True)
|
||||||
if idx != 0:
|
if idx != 0:
|
||||||
orig_name = str(self.gst_names.itemData(idx) or '')
|
orig_name = str(self.gst_names.itemData(idx) or '')
|
||||||
else:
|
else:
|
||||||
@ -176,7 +179,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
if not val:
|
if not val:
|
||||||
return error_dialog(self.gui, _('Grouped search terms'),
|
return error_dialog(self.gui, _('Grouped search terms'),
|
||||||
_('The value box cannot be empty'), show=True)
|
_('The value box cannot be empty'), show=True)
|
||||||
|
|
||||||
if orig_name and name != orig_name:
|
if orig_name and name != orig_name:
|
||||||
del self.gst[orig_name]
|
del self.gst[orig_name]
|
||||||
self.gst_changed = True
|
self.gst_changed = True
|
||||||
@ -234,8 +236,16 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
'The option to have un-accented characters match accented characters has no effect'
|
'The option to have un-accented characters match accented characters has no effect'
|
||||||
' if you also turn on case-sensitive searching. So only turn on one of those options'), show=True)
|
' if you also turn on case-sensitive searching. So only turn on one of those options'), show=True)
|
||||||
raise AbortCommit()
|
raise AbortCommit()
|
||||||
|
ucs = (m.strip() for m in self.opt_grouped_search_make_user_categories.text().split(',') if m.strip())
|
||||||
|
ucs -= (self.gst.keys())
|
||||||
|
if ucs:
|
||||||
|
error_dialog(self, _('Missing grouped search terms'), _(
|
||||||
|
'The option "Make user categories from" contains names that '
|
||||||
|
"aren't grouped search terms: {}").format(', '.join(sorted(ucs))), show=True)
|
||||||
|
raise AbortCommit()
|
||||||
|
|
||||||
restart = ConfigWidgetBase.commit(self)
|
restart = ConfigWidgetBase.commit(self)
|
||||||
if self.gst_changed:
|
if self.gst_changed or self.muc_changed:
|
||||||
self.db.new_api.set_pref('grouped_search_terms', self.gst)
|
self.db.new_api.set_pref('grouped_search_terms', self.gst)
|
||||||
self.db.field_metadata.add_grouped_search_terms(self.gst)
|
self.db.field_metadata.add_grouped_search_terms(self.gst)
|
||||||
self.db.new_api.set_pref('similar_authors_search_key',
|
self.db.new_api.set_pref('similar_authors_search_key',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user