UserMessageView
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
107846721689984["blocks.UserMessageView"]
107846719030608["_static.Static"]
107846718477920["widget.Widget"]
107846718489888["dom.DOMNode"]
107846718374032["message_pump.MessagePump"]
137699722799616["builtins.object"]
107846719030608 --> 107846721689984
107846718477920 --> 107846719030608
107846718489888 --> 107846718477920
107846718374032 --> 107846718489888
137699722799616 --> 107846718374032
🛈 DocStrings
Bases: Static
A message the user sent.
Source code in src/acptui/ui/widgets/blocks.py
| class UserMessageView(Static):
"""A message the user sent."""
DEFAULT_CSS = """
UserMessageView {
height: auto;
background: $boost;
border-left: thick $primary;
padding: 0 1;
margin: 1 0 1 0;
}
"""
def __init__(self, entry: MessageEntry, cwd: str) -> None:
super().__init__()
self.entry = entry
self.cwd = cwd
self.update(self._message_content())
def _message_content(self) -> Content:
lines: list[Content] = [Content(blocks_text(self.entry.blocks) or " ")]
lines.extend(
Content.assemble((" + ", "$text-muted"), (desc, "italic $text-muted"))
for block in self.entry.blocks
if (desc := describe_block(block, self.cwd)) is not None
)
return Content("\n").join(lines)
def refresh_entry(self) -> None:
"""Re-render after the entry changed."""
self.update(self._message_content())
|
refresh_entry
Re-render after the entry changed.
Source code in src/acptui/ui/widgets/blocks.py
| def refresh_entry(self) -> None:
"""Re-render after the entry changed."""
self.update(self._message_content())
|
:fa-brands-github: Show source on GitHub