mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-20 13:03:22 +02:00
Change bulk edit and the template function titlecase to use utils.titlecase instead of str.title()
This commit is contained in:
parent
bf3030d173
commit
8ad31bbf08
2 changed files with 6 additions and 4 deletions
|
|
@ -16,6 +16,7 @@
|
|||
from calibre.gui2 import error_dialog
|
||||
from calibre.gui2.progress_indicator import ProgressIndicator
|
||||
from calibre.utils.config import dynamic
|
||||
from calibre.utils.titlecase import titlecase
|
||||
|
||||
class MyBlockingBusy(QDialog):
|
||||
|
||||
|
|
@ -115,7 +116,7 @@ def do_one(self, id):
|
|||
aum = [a.strip().replace('|', ',') for a in aum.split(',')]
|
||||
new_title = authors_to_string(aum)
|
||||
if do_title_case:
|
||||
new_title = new_title.title()
|
||||
new_title = titlecase(new_title)
|
||||
self.db.set_title(id, new_title, notify=False)
|
||||
title_set = True
|
||||
if title:
|
||||
|
|
@ -123,7 +124,7 @@ def do_one(self, id):
|
|||
self.db.set_authors(id, new_authors, notify=False)
|
||||
if do_title_case and not title_set:
|
||||
title = self.db.title(id, index_is_id=True)
|
||||
self.db.set_title(id, title.title(), notify=False)
|
||||
self.db.set_title(id, titlecase(title), notify=False)
|
||||
if au:
|
||||
self.db.set_authors(id, string_to_authors(au), notify=False)
|
||||
elif self.current_phase == 2:
|
||||
|
|
@ -179,7 +180,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||
s_r_functions = { '' : lambda x: x,
|
||||
_('Lower Case') : lambda x: x.lower(),
|
||||
_('Upper Case') : lambda x: x.upper(),
|
||||
_('Title Case') : lambda x: x.title(),
|
||||
_('Title Case') : lambda x: titlecase(x),
|
||||
}
|
||||
|
||||
s_r_match_modes = [ _('Character match'),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
import re, string, traceback
|
||||
|
||||
from calibre.constants import DEBUG
|
||||
from calibre.utils.titlecase import titlecase
|
||||
|
||||
class TemplateFormatter(string.Formatter):
|
||||
'''
|
||||
|
|
@ -81,7 +82,7 @@ def _shorten(self, val, leading, center_string, trailing):
|
|||
functions = {
|
||||
'uppercase' : (0, lambda s,x: x.upper()),
|
||||
'lowercase' : (0, lambda s,x: x.lower()),
|
||||
'titlecase' : (0, lambda s,x: x.title()),
|
||||
'titlecase' : (0, lambda s,x: titlecase(x)),
|
||||
'capitalize' : (0, lambda s,x: x.capitalize()),
|
||||
'contains' : (3, _contains),
|
||||
'ifempty' : (1, _ifempty),
|
||||
|
|
|
|||
Loading…
Reference in a new issue