From 938b0b440fbbeb7eb311841cd36dbcd82ff22abd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 8 Apr 2025 21:01:38 +0530 Subject: [PATCH] Use our improved plain text edit class in the comments editor --- src/calibre/gui2/comments_editor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 1132528b4c..8fb2919e77 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -34,7 +34,6 @@ from qt.core import ( QLineEdit, QMenu, QPalette, - QPlainTextEdit, QPointF, QPushButton, QSize, @@ -78,6 +77,7 @@ from calibre.gui2 import ( from calibre.gui2.book_details import resolved_css from calibre.gui2.dialogs.progress import ProgressDialog from calibre.gui2.flow_toolbar import create_flow_toolbar +from calibre.gui2.tweak_book.widgets import PlainTextEdit from calibre.gui2.widgets import LineEditECM from calibre.gui2.widgets2 import to_plain_text from calibre.startup import connect_lambda @@ -1438,7 +1438,7 @@ class Editor(QWidget): # {{{ self.tabs = QTabWidget(self) self.tabs.setTabPosition(QTabWidget.TabPosition.South) self.wyswyg = QWidget(self.tabs) - self.code_edit = QPlainTextEdit(self.tabs) + self.code_edit = PlainTextEdit(self.tabs) self.code_edit.setTabChangesFocus(True) self.source_dirty = False self.wyswyg_dirty = True @@ -1593,8 +1593,8 @@ if __name__ == '__main__': w.html = '''

Test Heading

Test blockquote

He hadn't set out to have an affair, much less a long-term, devoted one.

hello''' - w.html = '

Testing a link.

\xa0

ss

' i = 'file:///home/kovid/work/calibre/resources/images/' w.html = f'

Testing img and another file

' + w.html = '

Testing a link.

 

ss

' app.exec() - # print(w.html) + print(repr(w.html))