mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
String changes
This commit is contained in:
parent
e5e5ab957b
commit
2d4c770d3d
@ -449,7 +449,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
|||||||
else:
|
else:
|
||||||
self.source_code.setPlainText(self.funcs[name].program_text)
|
self.source_code.setPlainText(self.funcs[name].program_text)
|
||||||
if self.funcs[name].is_python:
|
if self.funcs[name].is_python:
|
||||||
self.func_type.setText(_('Template function in python'))
|
self.func_type.setText(_('Template function in Python'))
|
||||||
else:
|
else:
|
||||||
self.func_type.setText(_('Stored template'))
|
self.func_type.setText(_('Stored template'))
|
||||||
|
|
||||||
|
@ -1,23 +1,19 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||||
|
# License: GPLv3 Copyright: 2010, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
import json
|
||||||
__license__ = 'GPL v3'
|
import traceback
|
||||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import json, traceback
|
|
||||||
|
|
||||||
from PyQt5.Qt import QDialogButtonBox
|
from PyQt5.Qt import QDialogButtonBox
|
||||||
|
|
||||||
from calibre.gui2 import error_dialog, warning_dialog
|
from calibre.gui2 import error_dialog, warning_dialog
|
||||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
||||||
from calibre.gui2.preferences.template_functions_ui import Ui_Form
|
from calibre.gui2.preferences.template_functions_ui import Ui_Form
|
||||||
from calibre.gui2.widgets import PythonHighlighter
|
from calibre.gui2.widgets import PythonHighlighter
|
||||||
from calibre.utils.formatter_functions import (formatter_functions,
|
from calibre.utils.formatter_functions import (
|
||||||
compile_user_function, compile_user_template_functions,
|
compile_user_function, compile_user_template_functions, formatter_functions,
|
||||||
load_user_template_functions, function_pref_is_python,
|
function_pref_is_python, function_pref_name, load_user_template_functions
|
||||||
function_pref_name)
|
)
|
||||||
from polyglot.builtins import iteritems, native_string_type, unicode_type
|
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', [])
|
self.db.prefs.get('user_template_functions', [])
|
||||||
if not function_pref_is_python(v)}:
|
if not function_pref_is_python(v)}:
|
||||||
error_dialog(self.gui, _('Template functions'),
|
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
|
return
|
||||||
if self.argument_count.value() == 0:
|
if self.argument_count.value() == 0:
|
||||||
box = warning_dialog(self.gui, _('Template functions'),
|
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():
|
for k,v in formatter_functions().get_functions().items():
|
||||||
if k == name and v.is_python:
|
if k == name and v.is_python:
|
||||||
error_dialog(self.gui, _('Stored templates'),
|
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:
|
try:
|
||||||
prog = unicode_type(self.template_editor.textbox.toPlainText())
|
prog = unicode_type(self.template_editor.textbox.toPlainText())
|
||||||
if not prog.startswith('program:'):
|
if not prog.startswith('program:'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user