diff --git a/src/calibre/gui2/dialogs/template_dialog.py b/src/calibre/gui2/dialogs/template_dialog.py index 28e0fb2ad5..0712369e9e 100644 --- a/src/calibre/gui2/dialogs/template_dialog.py +++ b/src/calibre/gui2/dialogs/template_dialog.py @@ -449,7 +449,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): else: self.source_code.setPlainText(self.funcs[name].program_text) if self.funcs[name].is_python: - self.func_type.setText(_('Template function in python')) + self.func_type.setText(_('Template function in Python')) else: self.func_type.setText(_('Stored template')) diff --git a/src/calibre/gui2/preferences/template_functions.py b/src/calibre/gui2/preferences/template_functions.py index e8f8010dbd..3f03fef6b7 100644 --- a/src/calibre/gui2/preferences/template_functions.py +++ b/src/calibre/gui2/preferences/template_functions.py @@ -1,23 +1,19 @@ #!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai +# License: GPLv3 Copyright: 2010, Kovid Goyal - -__license__ = 'GPL v3' -__copyright__ = '2010, Kovid Goyal ' -__docformat__ = 'restructuredtext en' - -import json, traceback - +import json +import traceback from PyQt5.Qt import QDialogButtonBox from calibre.gui2 import error_dialog, warning_dialog from calibre.gui2.preferences import ConfigWidgetBase, test_widget from calibre.gui2.preferences.template_functions_ui import Ui_Form from calibre.gui2.widgets import PythonHighlighter -from calibre.utils.formatter_functions import (formatter_functions, - compile_user_function, compile_user_template_functions, - load_user_template_functions, function_pref_is_python, - function_pref_name) +from calibre.utils.formatter_functions import ( + compile_user_function, compile_user_template_functions, formatter_functions, + function_pref_is_python, function_pref_name, load_user_template_functions +) from polyglot.builtins import iteritems, native_string_type, unicode_type @@ -194,7 +190,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.db.prefs.get('user_template_functions', []) if not function_pref_is_python(v)}: error_dialog(self.gui, _('Template functions'), - _('Name %s is already used for stored template')%(name,), show=True) + _('The name {} is already used for stored template').format(name), show=True) return if self.argument_count.value() == 0: box = warning_dialog(self.gui, _('Template functions'), @@ -302,7 +298,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): for k,v in formatter_functions().get_functions().items(): if k == name and v.is_python: error_dialog(self.gui, _('Stored templates'), - _('Name %s is already used for template function')%(name,), show=True) + _('The name {} is already used for template function').format(name), show=True) try: prog = unicode_type(self.template_editor.textbox.toPlainText()) if not prog.startswith('program:'):