pyqt_reactive.core.rich_text_appender

Utility for appending HTML content to QTextEdit with proper cursor/scroll handling.

Classes

RichTextAppender(text_edit[, color_scheme])

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)

append_code(code: str, language: str = None)[source]

Append code block with border styling.

Parameters:
  • code – Code string to display

  • language – Optional language hint (for future syntax highlighting)

append_error(message: str)[source]

Append error message in red.

append_success(message: str)[source]

Append success message in green.

clear()[source]

Clear all content.