SessionMessageView
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
107846721669648["blocks.SessionMessageView"]
107846719030608["_static.Static"]
107846718477920["widget.Widget"]
107846718489888["dom.DOMNode"]
107846718374032["message_pump.MessagePump"]
137699722799616["builtins.object"]
107846719030608 --> 107846721669648
107846718477920 --> 107846719030608
107846718489888 --> 107846718477920
107846718374032 --> 107846718489888
137699722799616 --> 107846718374032
🛈 DocStrings
Bases: Static
A message sent to or received from another session.
Source code in src/acptui/ui/widgets/blocks.py
| class SessionMessageView(Static):
"""A message sent to or received from another session."""
DEFAULT_CSS = """
SessionMessageView {
height: auto;
border-left: wide $secondary;
padding: 0 1;
margin: 0 0 1 0;
}
"""
def __init__(self, entry: MessageEntry, state: SessionState) -> None:
super().__init__()
self.entry = entry
self.state = state
self.refresh_entry()
def _session_label(self, session_id: str | None) -> str:
if session_id is None:
return "?"
if session_id == self.state.session_id:
return "this session"
child = self.state.subagents.get(session_id)
return child.display_title if child is not None else session_id
def refresh_entry(self) -> None:
"""Re-render."""
entry = self.entry
sender = self._session_label(entry.sender_session_id)
recipient = self._session_label(entry.recipient_session_id)
header = f"✉ {sender} → {recipient}"
body = content_markdown(entry.blocks, self.state.cwd)
self.update(Content.assemble((header, "bold $secondary"), "\n", body))
|
refresh_entry
Re-render.
Source code in src/acptui/ui/widgets/blocks.py
| def refresh_entry(self) -> None:
"""Re-render."""
entry = self.entry
sender = self._session_label(entry.sender_session_id)
recipient = self._session_label(entry.recipient_session_id)
header = f"✉ {sender} → {recipient}"
body = content_markdown(entry.blocks, self.state.cwd)
self.update(Content.assemble((header, "bold $secondary"), "\n", body))
|
:fa-brands-github: Show source on GitHub