diff --git a/src/calibre/gui2/preferences/template_functions.py b/src/calibre/gui2/preferences/template_functions.py index f02b6bf2ac..00957f4042 100644 --- a/src/calibre/gui2/preferences/template_functions.py +++ b/src/calibre/gui2/preferences/template_functions.py @@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en' import json, traceback -from PyQt5.Qt import Qt, QDialogButtonBox, QSizePolicy +from PyQt5.Qt import QDialogButtonBox from calibre.gui2 import error_dialog, warning_dialog from calibre.gui2.preferences import ConfigWidgetBase, test_widget diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py index d6992a78d8..d41e2e2b49 100644 --- a/src/calibre/utils/formatter_functions.py +++ b/src/calibre/utils/formatter_functions.py @@ -1825,6 +1825,7 @@ class FormatterUserFunction(FormatterFunction): def to_pref(self): return [self.name, self.doc, self.arg_count, self.program_text] + tabs = re.compile(r'^\t*') @@ -1837,9 +1838,11 @@ def function_pref_is_python(pref): return False raise ValueError('Unknown program type in formatter function pref') + def function_pref_name(pref): return pref[0] + def compile_user_function(name, doc, arg_count, eval_func): if not function_pref_is_python(eval_func): return FormatterUserFunction(name, doc, arg_count, eval_func, False)