Skip to content

Screens

elva.widgets.screens

Textual screens for ELVA apps.

Classes:

  • Dashboard

    Screen for displaying session information.

  • InputScreen

    A plain modal screen with a single input field.

  • ErrorScreen

    Modal screen displaying an exception message.

Dashboard

Bases: Screen

Screen for displaying session information.

It features a ConfigView widget for displaying the current configuration parameters as well as an AwarenessView widget showing the active clients in the current session.

Methods:

  • compose

    Hook adding child widgets.

  • key_escape

    Hook executed on pressing the Esc key.

compose()

Hook adding child widgets.

Source code in src/elva/widgets/screens.py
def compose(self):
    """
    Hook adding child widgets.
    """
    yield ConfigView()
    yield AwarenessView()

key_escape()

Hook executed on pressing the Esc key.

It dismisses the screen.

Source code in src/elva/widgets/screens.py
def key_escape(self):
    """
    Hook executed on pressing the `Esc` key.

    It dismisses the screen.
    """
    self.dismiss()

InputScreen

Bases: ModalScreen

A plain modal screen with a single input field.

Methods:

compose()

Hook adding child widgets.

Source code in src/elva/widgets/screens.py
def compose(self):
    """
    Hook adding child widgets.
    """
    yield Input()

on_input_submitted(event)

Hook executed on an Input.Submitted message.

Parameters:

  • event (Message) –

    the message containing the submitted value.

Source code in src/elva/widgets/screens.py
def on_input_submitted(self, event: Message):
    """
    Hook executed on an [`Input.Submitted`][textual.widgets.Input.Submitted] message.

    Arguments:
        event: the message containing the submitted value.
    """
    self.dismiss(event.value)

key_escape()

Hook executed on pressing the Esc key.

It dismisses the screen.

Source code in src/elva/widgets/screens.py
def key_escape(self):
    """
    Hook executed on pressing the `Esc` key.

    It dismisses the screen.
    """
    self.dismiss()

ErrorScreen(exc, *args, **kwargs)

Bases: ModalScreen

Modal screen displaying an exception message.

Parameters:

  • exc (str) –

    the exception message to display.

  • args (tuple, default: () ) –

    positional arguments passed to ModalScreen

  • kwargs (dict, default: {} ) –

    keyword arguments passed to ModalScreen

Methods:

Attributes:

  • exc (str) –

    The exception message to display.

Source code in src/elva/widgets/screens.py
def __init__(self, exc: str, *args: tuple, **kwargs: dict):
    """
    Arguments:
        exc: the exception message to display.
        args: positional arguments passed to [`ModalScreen`][textual.screen.ModalScreen]
        kwargs: keyword arguments passed to [`ModalScreen`][textual.screen.ModalScreen]
    """
    super().__init__(*args, **kwargs)
    self.exc = exc

exc = exc instance-attribute

The exception message to display.

compose()

Hook arranging child widgets.

Source code in src/elva/widgets/screens.py
def compose(self):
    """
    Hook arranging child widgets.
    """
    yield Static("The following error occured and the app will close now:")
    yield Static(self.exc)
    yield Static("Press any key or click to continue.")

on_button_pressed()

Hook called on a button pressed event.

It dismisses the screen.

Source code in src/elva/widgets/screens.py
def on_button_pressed(self):
    """
    Hook called on a button pressed event.

    It dismisses the screen.
    """
    self.dismiss(self.exc)

on_key()

Hook called on a pressed key.

It dismisses the screen.

Source code in src/elva/widgets/screens.py
def on_key(self):
    """
    Hook called on a pressed key.

    It dismisses the screen.
    """
    self.dismiss(self.exc)

on_mouse_up()

Hook called on a released mouse button.

It dismisses the screen.

Source code in src/elva/widgets/screens.py
def on_mouse_up(self):
    """
    Hook called on a released mouse button.

    It dismisses the screen.
    """
    self.dismiss(self.exc)