mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
2b8ed93987
@ -46,7 +46,7 @@ class TemplateHighlighter(QSyntaxHighlighter):
|
||||
|
||||
KEYWORDS = ["program", 'if', 'then', 'else', 'elif', 'fi']
|
||||
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, parent=None, builtin_functions=None):
|
||||
super(TemplateHighlighter, self).__init__(parent)
|
||||
|
||||
self.initializeFormats()
|
||||
@ -56,7 +56,8 @@ class TemplateHighlighter(QSyntaxHighlighter):
|
||||
"keyword"))
|
||||
TemplateHighlighter.Rules.append((QRegExp(
|
||||
"|".join([r"\b%s\b" % builtin for builtin in
|
||||
formatter_functions().get_builtins()])),
|
||||
(builtin_functions if builtin_functions else
|
||||
formatter_functions().get_builtins())])),
|
||||
"builtin"))
|
||||
|
||||
TemplateHighlighter.Rules.append((QRegExp(
|
||||
@ -214,7 +215,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
def __init__(self, parent, text, mi=None, fm=None, color_field=None,
|
||||
icon_field_key=None, icon_rule_kind=None, doing_emblem=False,
|
||||
text_is_placeholder=False, dialog_is_st_editor=False,
|
||||
global_vars={}):
|
||||
global_vars={}, all_functions=None, builtin_functions=None):
|
||||
QDialog.__init__(self, parent)
|
||||
Ui_TemplateDialog.__init__(self)
|
||||
self.setupUi(self)
|
||||
@ -314,8 +315,11 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
self.setWindowFlags(self.windowFlags()&(~Qt.WindowType.WindowContextHelpButtonHint))
|
||||
self.setWindowIcon(icon)
|
||||
|
||||
self.all_functions = all_functions if all_functions else formatter_functions().get_functions()
|
||||
self.builtins = builtin_functions if builtin_functions else formatter_functions().get_builtins()
|
||||
|
||||
self.last_text = ''
|
||||
self.highlighter = TemplateHighlighter(self.textbox.document())
|
||||
self.highlighter = TemplateHighlighter(self.textbox.document(), builtin_functions=self.builtins)
|
||||
self.textbox.cursorPositionChanged.connect(self.text_cursor_changed)
|
||||
self.textbox.textChanged.connect(self.textbox_changed)
|
||||
|
||||
@ -342,10 +346,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
except:
|
||||
self.builtin_source_dict = {}
|
||||
|
||||
self.funcs = formatter_functions().get_functions()
|
||||
self.builtins = formatter_functions().get_builtins()
|
||||
|
||||
func_names = sorted(self.funcs)
|
||||
func_names = sorted(self.all_functions)
|
||||
self.function.clear()
|
||||
self.function.addItem('')
|
||||
for f in func_names:
|
||||
@ -430,7 +431,8 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
self.text_cursor_changed()
|
||||
self.template_value.setText(
|
||||
SafeFormat().safe_format(cur_text, self.mi, _('EXCEPTION: '),
|
||||
self.mi, global_vars=self.global_vars))
|
||||
self.mi, global_vars=self.global_vars,
|
||||
template_functions= self.all_functions))
|
||||
|
||||
def text_cursor_changed(self):
|
||||
cursor = self.textbox.textCursor()
|
||||
@ -443,7 +445,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
pos_in_block)
|
||||
|
||||
def function_type_string(self, name, longform=True):
|
||||
if self.funcs[name].is_python:
|
||||
if self.all_functions[name].is_python:
|
||||
if name in self.builtins:
|
||||
return (_('Built-in template function') if longform else
|
||||
_('Built-in function'))
|
||||
@ -457,12 +459,12 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
self.source_code.clear()
|
||||
self.documentation.clear()
|
||||
self.func_type.clear()
|
||||
if name in self.funcs:
|
||||
self.documentation.setPlainText(self.funcs[name].doc)
|
||||
if name in self.all_functions:
|
||||
self.documentation.setPlainText(self.all_functions[name].doc)
|
||||
if name in self.builtins and name in self.builtin_source_dict:
|
||||
self.source_code.setPlainText(self.builtin_source_dict[name])
|
||||
else:
|
||||
self.source_code.setPlainText(self.funcs[name].program_text)
|
||||
self.source_code.setPlainText(self.all_functions[name].program_text)
|
||||
self.func_type.setText(self.function_type_string(name, longform=True))
|
||||
|
||||
def accept(self):
|
||||
|
@ -21,349 +21,520 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="color_layout">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="colored_field_label">
|
||||
<property name="text">
|
||||
<string>Set the color of the column:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>colored_field</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="colored_field">
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="color_chooser_label">
|
||||
<property name="text">
|
||||
<string>Copy a color name to the clipboard:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>color_name</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="ColorButton" name="color_name">
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="color_copy_button">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/edit-copy.png</normaloff>:/images/edit-copy.png</iconset>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy the selected color name to the clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="icon_layout">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="icon_kind_label">
|
||||
<property name="text">
|
||||
<string>Kind:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="icon_kind">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="icon_chooser_label">
|
||||
<property name="text">
|
||||
<string>Apply the icon to column:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>icon_field</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="icon_field">
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="image_chooser_label">
|
||||
<property name="text">
|
||||
<string>Copy an icon file name to the clipboard:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>color_name</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="icon_files">
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="icon_copy_button">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/edit-copy.png</normaloff>:/images/edit-copy.png</iconset>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy the selected icon file name to the clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="filename_button">
|
||||
<widget class="QScrollArea" name="scroll_area">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="wid1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="color_layout">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="colored_field_label">
|
||||
<property name="text">
|
||||
<string>Set the color of the column:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>colored_field</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="colored_field">
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="color_chooser_label">
|
||||
<property name="text">
|
||||
<string>Copy a color name to the clipboard:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>color_name</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="ColorButton" name="color_name">
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="color_copy_button">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/edit-copy.png</normaloff>:/images/edit-copy.png</iconset>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy the selected color name to the clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="icon_layout">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="icon_kind_label">
|
||||
<property name="text">
|
||||
<string>Kind:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="icon_kind">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="icon_chooser_label">
|
||||
<property name="text">
|
||||
<string>Apply the icon to column:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>icon_field</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="icon_field">
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="image_chooser_label">
|
||||
<property name="text">
|
||||
<string>Copy an icon file name to the clipboard:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>color_name</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="icon_files">
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="icon_copy_button">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/edit-copy.png</normaloff>:/images/edit-copy.png</iconset>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy the selected icon file name to the clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="filename_button">
|
||||
<property name="text">
|
||||
<string>Add icon</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add an icon file to the set of choices</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="template_name_label">
|
||||
<property name="text">
|
||||
<string>Add icon</string>
|
||||
<string>Template &name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_name</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="template_name">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add an icon file to the set of choices</string>
|
||||
<string>The name of the callable template</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>T&emplate:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>textbox</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPlainTextEdit" name="textbox">
|
||||
<property name="toolTip">
|
||||
<string>The template program text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="new_doc_label">
|
||||
<property name="text">
|
||||
<string>D&ocumentation:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>new_doc</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QTextEdit" name="new_doc">
|
||||
<property name="toolTip">
|
||||
<string>Documentation for the function being defined or edited</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>Template value:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The value of the template using the current book in the library view</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="template_value">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="user_label_1">
|
||||
<property name="text">
|
||||
<string>User Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<layout class="BoxLayout" name="user_layout_1" dir="TopToBottom">
|
||||
</layout>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="user_label_2">
|
||||
<property name="text">
|
||||
<string>User Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<layout class="BoxLayout" name="user_layout_2" dir="TopToBottom">
|
||||
</layout>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="user_label_3">
|
||||
<property name="text">
|
||||
<string>User Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<layout class="BoxLayout" name="user_layout_3" dir="TopToBottom">
|
||||
</layout>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="user_label_4">
|
||||
<property name="text">
|
||||
<string>User Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<layout class="BoxLayout" name="user_layout_4" dir="TopToBottom">
|
||||
</layout>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="user_label_5">
|
||||
<property name="text">
|
||||
<string>User Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<layout class="BoxLayout" name="user_layout_5" dir="TopToBottom">
|
||||
</layout>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="user_label_6">
|
||||
<property name="text">
|
||||
<string>User Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<layout class="BoxLayout" name="user_layout_6" dir="TopToBottom">
|
||||
</layout>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="user_label_7">
|
||||
<property name="text">
|
||||
<string>User Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<layout class="BoxLayout" name="user_layout_7" dir="TopToBottom">
|
||||
</layout>
|
||||
</item>
|
||||
<item row="18" column="0">
|
||||
<widget class="QLabel" name="user_label_8">
|
||||
<property name="text">
|
||||
<string>User Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<layout class="BoxLayout" name="user_layout_8" dir="TopToBottom">
|
||||
</layout>
|
||||
</item>
|
||||
<item row="19" column="0">
|
||||
<widget class="QLabel" name="user_label_9">
|
||||
<property name="text">
|
||||
<string>User Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="1">
|
||||
<layout class="BoxLayout" name="user_layout_9" dir="TopToBottom">
|
||||
</layout>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Font size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1" colspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QSpinBox" name="font_size_box"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="21" column="0" colspan="5">
|
||||
<widget class="QFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Template Function Reference</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>function</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="23" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Function &name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>function</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="23" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="function"/>
|
||||
</item>
|
||||
<item row="24" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>&Function type:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>func_type</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="24" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="func_type">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>&Documentation:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>documentation</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>&Code:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>source_code</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="1" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="documentation">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="1" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="source_code">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="27" column="1">
|
||||
<widget class="QLabel" name="template_tutorial">
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="28" column="1">
|
||||
<widget class="QLabel" name="template_func_reference">
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="template_name_label">
|
||||
<property name="text">
|
||||
<string>Template &name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_name</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="template_name">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The name of the callable template</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>T&emplate:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>textbox</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPlainTextEdit" name="textbox">
|
||||
<property name="toolTip">
|
||||
<string>The template program text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="new_doc_label">
|
||||
<property name="text">
|
||||
<string>D&ocumentation:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>new_doc</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QTextEdit" name="new_doc">
|
||||
<property name="toolTip">
|
||||
<string>Documentation for the function being defined or edited</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>Template value:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>template_value</cstring>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The value of the template using the current book in the library view</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="template_value">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Font size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QSpinBox" name="font_size_box"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="5">
|
||||
<widget class="QFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Template Function Reference</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>function</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Function &name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>function</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="function"/>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>&Function type:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>func_type</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="func_type">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>&Documentation:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>documentation</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>&Code:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>source_code</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="documentation">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="source_code"/>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QLabel" name="template_tutorial">
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QLabel" name="template_func_reference">
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -373,6 +544,11 @@
|
||||
<extends>QPushButton</extends>
|
||||
<header>calibre/gui2/widgets2.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BoxLayout</class>
|
||||
<extends>QBoxLayout</extends>
|
||||
<header>calibre/gui2/dialogs/template_dialog_box_layout.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
13
src/calibre/gui2/dialogs/template_dialog_box_layout.py
Normal file
13
src/calibre/gui2/dialogs/template_dialog_box_layout.py
Normal file
@ -0,0 +1,13 @@
|
||||
'''
|
||||
Created on 20 Jan 2021
|
||||
|
||||
@author: Charles Haley
|
||||
'''
|
||||
|
||||
from PyQt5.Qt import (QBoxLayout)
|
||||
|
||||
|
||||
class BoxLayout(QBoxLayout):
|
||||
|
||||
def __init__(self):
|
||||
QBoxLayout.__init__(self, QBoxLayout.Direction.TopToBottom)
|
@ -25,11 +25,17 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2" stretch="0">
|
||||
<widget class="QTextBrowser" name="st_textBrowser"/>
|
||||
<widget class="QTextBrowser" name="st_textBrowser">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" stretch="1">
|
||||
<widget class="EmbeddedTemplateDialog" name="template_editor">
|
||||
</widget>
|
||||
<widget class="EmbeddedTemplateDialog" name="template_editor"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QVBoxLayout" name="st_button_layout">
|
||||
@ -76,19 +82,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
|
Loading…
x
Reference in New Issue
Block a user