mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression in defining formatter functions
This commit is contained in:
parent
3467ba839b
commit
9a69b02f50
@ -83,7 +83,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
self.builtin_source_dict = {}
|
||||
|
||||
self.funcs = formatter_functions.get_functions()
|
||||
self.builtins = formatter_functions.get_builtins()
|
||||
self.builtins = formatter_functions.get_builtins_and_aliases()
|
||||
|
||||
self.build_function_names_box()
|
||||
self.function_name.currentIndexChanged[str].connect(self.function_index_changed)
|
||||
@ -151,7 +151,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
name = unicode(self.function_name.currentText())
|
||||
if name in self.funcs:
|
||||
error_dialog(self.gui, _('Template functions'),
|
||||
_('Name already used'), show=True)
|
||||
_('Name %s already used')%(name,), show=True)
|
||||
return
|
||||
if self.argument_count.value() == 0:
|
||||
box = warning_dialog(self.gui, _('Template functions'),
|
||||
|
@ -46,6 +46,14 @@ class FormatterFunctions(object):
|
||||
def get_builtins(self):
|
||||
return self._builtins
|
||||
|
||||
def get_builtins_and_aliases(self):
|
||||
res = {}
|
||||
for f in self._builtins.itervalues():
|
||||
res[f.name] = f
|
||||
for a in f.aliases:
|
||||
res[a] = f
|
||||
return res
|
||||
|
||||
def get_functions(self):
|
||||
return self._functions
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user