Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/textual/widgets/_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,13 @@

from typing import TYPE_CHECKING

from rich.protocol import is_renderable

if TYPE_CHECKING:
from textual.app import RenderResult

from textual.errors import RenderError
from textual.visual import Visual, VisualType, visualize
from textual.widget import Widget


def _check_renderable(renderable: object):
"""Check if a renderable conforms to the Rich Console protocol
(https://rich.readthedocs.io/en/latest/protocol.html)

Args:
renderable: A potentially renderable object.

Raises:
RenderError: If the object can not be rendered.
"""
if not is_renderable(renderable) and not hasattr(renderable, "visualize"):
raise RenderError(
f"unable to render {renderable.__class__.__name__!r} type; must be a str, Text, Rich renderable oor Textual Visual instance"
)


class Static(Widget, inherit_bindings=False):
"""A widget to display simple static content, or use as a base class for more complex widgets.

Expand Down
Loading