mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Support passing the new global_vars dict into the template editor/tester
This commit is contained in:
parent
508936d721
commit
ad95233e64
@ -213,7 +213,8 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
|||||||
|
|
||||||
def __init__(self, parent, text, mi=None, fm=None, color_field=None,
|
def __init__(self, parent, text, mi=None, fm=None, color_field=None,
|
||||||
icon_field_key=None, icon_rule_kind=None, doing_emblem=False,
|
icon_field_key=None, icon_rule_kind=None, doing_emblem=False,
|
||||||
text_is_placeholder=False, dialog_is_st_editor=False):
|
text_is_placeholder=False, dialog_is_st_editor=False,
|
||||||
|
global_vars={}):
|
||||||
QDialog.__init__(self, parent)
|
QDialog.__init__(self, parent)
|
||||||
Ui_TemplateDialog.__init__(self)
|
Ui_TemplateDialog.__init__(self)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
@ -222,6 +223,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
|||||||
self.iconing = icon_field_key is not None
|
self.iconing = icon_field_key is not None
|
||||||
self.embleming = doing_emblem
|
self.embleming = doing_emblem
|
||||||
self.dialog_is_st_editor = dialog_is_st_editor
|
self.dialog_is_st_editor = dialog_is_st_editor
|
||||||
|
self.global_vars = global_vars
|
||||||
|
|
||||||
cols = []
|
cols = []
|
||||||
if fm is not None:
|
if fm is not None:
|
||||||
@ -424,8 +426,8 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
|||||||
self.highlighter.regenerate_paren_positions()
|
self.highlighter.regenerate_paren_positions()
|
||||||
self.text_cursor_changed()
|
self.text_cursor_changed()
|
||||||
self.template_value.setText(
|
self.template_value.setText(
|
||||||
SafeFormat().safe_format(cur_text, self.mi,
|
SafeFormat().safe_format(cur_text, self.mi, _('EXCEPTION: '),
|
||||||
_('EXCEPTION: '), self.mi))
|
self.mi, global_vars=self.global_vars))
|
||||||
|
|
||||||
def text_cursor_changed(self):
|
def text_cursor_changed(self):
|
||||||
cursor = self.textbox.textCursor()
|
cursor = self.textbox.textCursor()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user