This commit is contained in:
Kovid Goyal 2021-03-29 16:08:36 +05:30
parent c765da312c
commit 5e022932ba
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 9 additions and 9 deletions

View File

@ -11,7 +11,7 @@ from qt.core import (Qt, QDialog, QDialogButtonBox, QSyntaxHighlighter, QFont,
QRegExp, QApplication, QTextCharFormat, QColor, QCursor,
QIcon, QSize, QPalette, QLineEdit, QByteArray, QFontInfo,
QFontDatabase, QVBoxLayout, QTableWidget, QTableWidgetItem,
QFontComboBox, QComboBox)
QComboBox)
from calibre import sanitize_file_name
from calibre.constants import config_dir
@ -699,7 +699,7 @@ class BreakReporter(QDialog):
except:
t.setColumnWidth(0, t.fontMetrics().averageCharWidth() * 20)
t.horizontalHeader().sectionResized.connect(self.table_column_resized)
t.horizontalHeader().setStretchLastSection(True);
t.horizontalHeader().setStretchLastSection(True)
bb = QDialogButtonBox()
b = bb.addButton(_('&Continue'), QDialogButtonBox.ButtonRole.AcceptRole)

View File

@ -7,13 +7,15 @@ Based on classes in calibre.gui2.tweak_book.editor
License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
'''
from qt.core import (Qt, QWidget, QSize, QPlainTextEdit, QPainter,
QRect, QFont, QPalette, QTextEdit, QTextFormat)
from qt.core import (
QFont, QPainter, QPalette, QPlainTextEdit, QRect, Qt, QTextEdit, QTextFormat
)
from calibre.gui2.tweak_book.editor.themes import (get_theme, theme_color)
from calibre.gui2.tweak_book.editor.text import LineNumbers
from calibre.gui2.tweak_book.editor.themes import get_theme, theme_color
from polyglot.builtins import unicode_type
class LineNumberArea(LineNumbers):
def mouseDoubleClickEvent(self, event):
@ -26,7 +28,6 @@ class CodeEditor(QPlainTextEdit):
def __init__(self, parent):
QPlainTextEdit.__init__(self, parent)
# Use the default theme from the book editor
theme = get_theme(None)
self.line_number_palette = pal = QPalette()

View File

@ -11,7 +11,6 @@ __docformat__ = 'restructuredtext en'
import re, string, traceback, numbers
from math import modf
from functools import partial
from calibre import prints
from calibre.constants import DEBUG
@ -1122,8 +1121,8 @@ class TemplateFormatter(string.Formatter):
(r'\w+', lambda x,t: (_Parser.LEX_ID, t)), # noqa
(r'".*?((?<!\\)")', lambda x,t: (_Parser.LEX_CONST, t[1:-1])), # noqa
(r'\'.*?((?<!\\)\')', lambda x,t: (_Parser.LEX_CONST, t[1:-1])), # noqa
(r'\n#.*?(?:(?=\n)|$)', lambda x,t: _Parser.LEX_NEWLINE),
(r'\s', lambda x,t: _Parser.LEX_NEWLINE if t == '\n' else None),
(r'\n#.*?(?:(?=\n)|$)', lambda x,t: _Parser.LEX_NEWLINE), # noqa
(r'\s', lambda x,t: _Parser.LEX_NEWLINE if t == '\n' else None), # noqa
], flags=re.DOTALL)
def _eval_program(self, val, prog, column_name, global_vars, break_reporter):