pyqt_reactive.core.rich_text_appender
Utility for appending HTML content to QTextEdit with proper cursor/scroll handling.
Classes
|
Utility for appending HTML content to QTextEdit with proper cursor/scroll handling. |
- class pyqt_reactive.core.rich_text_appender.RichTextAppender(text_edit: QTextEdit, color_scheme: ColorScheme = None)[source]
Utility for appending HTML content to QTextEdit with proper cursor/scroll handling.
- Usage:
appender = RichTextAppender(self.chat_history, color_scheme=self.color_scheme) appender.append_html(“<b>User:</b> Hello”) appender.append_code(“def foo(): pass”) appender.append_error(“Something went wrong”)
- __init__(text_edit: QTextEdit, color_scheme: ColorScheme = None)[source]
- append_html(html_content: str, add_spacing: bool = True)[source]
Append HTML content at end, scroll to bottom.
- Parameters:
html_content – HTML string to append
add_spacing – Whether to add blank line after
- append_text(text: str, bold: bool = False, color: str | None = None)[source]
Append plain text (escaped) with optional styling.
- Parameters:
text – Plain text to append
bold – Whether to make text bold
color – Optional text color (hex)