Skip to content

Rendering Module

Visual rendering services for icons, stylesheets, and documents.

Subpackages

Package Purpose
icons/ SVG and font icon rendering with caching
stylesheets/ QSS theme management and dynamic styling
documents/ Markdown and document rendering

Quick Start

Icons

from src.shared_services.rendering.icons.api import render_svg
from src.shared_services.rendering.icons.icon_paths import Icons

# Render an icon
icon = render_svg(Icons.Action.Save, size=24)
button.setIcon(icon)

# With custom color
icon = render_svg(Icons.Status.Warning, size=16, color="#ff9800")

Stylesheets

from src.shared_services.rendering.stylesheets.api import get_stylesheet_manager

# Register widget for automatic theme updates
manager = get_stylesheet_manager()
manager.register(widget, [StylesheetPaths.Main, StylesheetPaths.Buttons])

# Change theme
manager.set_theme("dark")

Documents

from src.shared_services.rendering.documents.api import MarkdownView

view = MarkdownView(parent=self)
view.set_markdown("# Hello World")

Architecture

All rendering services follow these patterns:

  1. Caching: Rendered assets are cached for performance
  2. Theme-Aware: Components update automatically on theme changes
  3. Path Constants: Asset paths defined in constants/ subpackages

What Belongs Here

Put in rendering: - Icon rendering and management - Stylesheet/theme management - Document/text rendering - Visual asset caching

Do NOT put here: - Business logic - Data processing - Non-visual utilities