Skip to content

NoticeView

Base classes

Name Children Inherits
Static
textual.widgets._static
A widget to display simple static content, or use as a base class for more complex widgets.

⋔ Inheritance diagram

graph TD
  107846720492304["blocks.NoticeView"]
  107846719030608["_static.Static"]
  107846718477920["widget.Widget"]
  107846718489888["dom.DOMNode"]
  107846718374032["message_pump.MessagePump"]
  137699722799616["builtins.object"]
  107846719030608 --> 107846720492304
  107846718477920 --> 107846719030608
  107846718489888 --> 107846718477920
  107846718374032 --> 107846718489888
  137699722799616 --> 107846718374032

🛈 DocStrings

Bases: Static

A notice: info, warning or error.

Source code in src/acptui/ui/widgets/blocks.py
class NoticeView(Static):
    """A notice: info, warning or error."""

    DEFAULT_CSS = """
    NoticeView {
        height: auto;
        padding: 0 1;
        margin: 0 0 1 0;
        border-left: wide $primary;
        &.-warning { border-left: wide $warning; color: $text-warning; }
        &.-error { border-left: wide $error; color: $text-error; background: $error 10%; }
    }
    """

    def __init__(self, entry: NoticeEntry) -> None:
        super().__init__(classes=f"-{entry.severity}")
        self.entry = entry
        text = Content.assemble((entry.title, "bold"))
        if entry.description:
            text = Content.assemble(text, "\n", entry.description)
        self.update(text)

:fa-brands-github: Show source on GitHub