mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a tweak to change the font size in the template editor
This commit is contained in:
parent
e7112eb217
commit
047af20cbf
@ -501,6 +501,12 @@ change_book_details_font_size_by = 0
|
|||||||
# No compile: compile_gpm_templates = False
|
# No compile: compile_gpm_templates = False
|
||||||
compile_gpm_templates = True
|
compile_gpm_templates = True
|
||||||
|
|
||||||
|
#: Change the font size in the General Program Mode template editor
|
||||||
|
# Change the font size used when editing GPM templates. This changes the size
|
||||||
|
# of the font in the editing pane. Set it to a positive or
|
||||||
|
# negative number to increase or decrease the font size.
|
||||||
|
change_template_editor_font_size_by = 0
|
||||||
|
|
||||||
#: What format to default to when using the Tweak feature
|
#: What format to default to when using the Tweak feature
|
||||||
# The Tweak feature of calibre allows direct editing of a book format.
|
# The Tweak feature of calibre allows direct editing of a book format.
|
||||||
# If multiple formats are available, calibre will offer you a choice
|
# If multiple formats are available, calibre will offer you a choice
|
||||||
|
@ -12,6 +12,7 @@ from PyQt4.Qt import (Qt, QDialog, QDialogButtonBox, QSyntaxHighlighter, QFont,
|
|||||||
from calibre import sanitize_file_name_unicode
|
from calibre import sanitize_file_name_unicode
|
||||||
from calibre.constants import config_dir
|
from calibre.constants import config_dir
|
||||||
from calibre.gui2.dialogs.template_dialog_ui import Ui_TemplateDialog
|
from calibre.gui2.dialogs.template_dialog_ui import Ui_TemplateDialog
|
||||||
|
from calibre.utils.config_base import tweaks
|
||||||
from calibre.utils.formatter_functions import formatter_functions
|
from calibre.utils.formatter_functions import formatter_functions
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
from calibre.ebooks.metadata.book.base import Metadata
|
from calibre.ebooks.metadata.book.base import Metadata
|
||||||
@ -75,7 +76,6 @@ class TemplateHighlighter(QSyntaxHighlighter):
|
|||||||
def initializeFormats(self):
|
def initializeFormats(self):
|
||||||
Config = self.Config
|
Config = self.Config
|
||||||
Config["fontfamily"] = "monospace"
|
Config["fontfamily"] = "monospace"
|
||||||
#Config["fontsize"] = 10
|
|
||||||
for name, color, bold, italic in (
|
for name, color, bold, italic in (
|
||||||
("normal", "#000000", False, False),
|
("normal", "#000000", False, False),
|
||||||
("keyword", "#000080", True, False),
|
("keyword", "#000080", True, False),
|
||||||
@ -91,7 +91,9 @@ class TemplateHighlighter(QSyntaxHighlighter):
|
|||||||
|
|
||||||
baseFormat = QTextCharFormat()
|
baseFormat = QTextCharFormat()
|
||||||
baseFormat.setFontFamily(Config["fontfamily"])
|
baseFormat.setFontFamily(Config["fontfamily"])
|
||||||
#baseFormat.setFontPointSize(Config["fontsize"])
|
Config["fontsize"] = (baseFormat.font().pointSize() +
|
||||||
|
tweaks['change_template_editor_font_size_by'])
|
||||||
|
baseFormat.setFontPointSize(Config["fontsize"])
|
||||||
|
|
||||||
for name in ("normal", "keyword", "builtin", "comment",
|
for name in ("normal", "keyword", "builtin", "comment",
|
||||||
"string", "number", "lparen", "rparen"):
|
"string", "number", "lparen", "rparen"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user