diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index b5813eee8a..84b135abba 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -461,8 +461,10 @@ gui_view_history_size = 15 #: Change the font size of the Book details panel in the interface # Change the font size at which book details are rendered in the side panel and # comments are rendered in the metadata edit dialog. Set it to a positive or -# negative number to increase or decrease the font size. +# negative number to increase or decrease the font size. Similarly, change the +# font size of the widget used to converse with AI. change_book_details_font_size_by = 0 +change_ai_chat_font_size_by = 0 #: What format to default to when using the "Unpack book" feature # The "Unpack book" feature of calibre allows direct editing of a book format. diff --git a/src/calibre/gui2/chat_widget.py b/src/calibre/gui2/chat_widget.py index 64eb599ad2..0c9ec6baac 100644 --- a/src/calibre/gui2/chat_widget.py +++ b/src/calibre/gui2/chat_widget.py @@ -5,8 +5,26 @@ from html import escape from math import ceil from typing import NamedTuple -from qt.core import QFrame, QHBoxLayout, QIcon, QPalette, QSize, QSizePolicy, Qt, QTextBrowser, QTextEdit, QToolButton, QUrl, QVBoxLayout, QWidget, pyqtSignal +from qt.core import ( + QFont, + QFontInfo, + QFrame, + QHBoxLayout, + QIcon, + QPalette, + QSize, + QSizePolicy, + Qt, + QTextBrowser, + QTextEdit, + QToolButton, + QUrl, + QVBoxLayout, + QWidget, + pyqtSignal, +) +from calibre.utils.config_base import tweaks from calibre.utils.logging import INFO, WARN from calibre.utils.resources import get_image_path @@ -21,6 +39,10 @@ class Browser(QTextBrowser): self.setContentsMargins(0, 0, 0, 0) self.document().setDocumentMargin(0) self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) + if tweaks['change_ai_chat_font_size_by']: + font = QFont(self.font()) + font.setPixelSize(QFontInfo(font).pixelSize() + tweaks['change_ai_chat_font_size_by']) + self.setFont(font) def sizeHint(self) -> QSize: return QSize(600, 500)