Module userland.scripts.messages.view_screen

Message viewer screen

Classes

class ViewScreen (*args, message: Message, **kwargs)

Message viewer screen

Initialize the screen.

Args

name
The name of the screen.
id
The ID of the screen in the DOM.
classes
The CSS classes for the screen.
Expand source code
class ViewScreen(Screen):
    """Message viewer screen"""

    BINDINGS = [("escape", "app.pop_screen", "Exit")]

    message: Message

    def __init__(self, *args, message: Message, **kwargs):
        super().__init__(*args, **kwargs)
        self.message = message

    def compose(self):
        yield MarkdownViewer(
            markdown=self.message.content, show_table_of_contents=False
        )
        yield Footer()

Ancestors

  • textual.screen.Screen
  • typing.Generic
  • textual.widget.Widget
  • textual.dom.DOMNode
  • textual.message_pump.MessagePump

Class variables

var BINDINGS
var can_focus
var can_focus_children
var messageMessage

Methods

def compose(self)

Called by Textual to create child widgets.

This method is called when a widget is mounted or by setting recompose=True when calling [refresh()][textual.widget.Widget.refresh].

Note that you don't typically need to explicitly call this method.

Example

def compose(self) -> ComposeResult:
    yield Header()
    yield Label("Press the button below:")
    yield Button()
    yield Footer()