Skip to content

display

dev_tool.tui.display

DisplayInterface

Bases: BaseInterface

A class for displaying scrollable content in the TUI.

This class extends BaseInterface to provide a dedicated display view that can show content with scrolling support and navigation controls.

The constructor for the DisplayInterface class.

Parameters:

  • terminal (Terminal) –

    The blessed Terminal instance.

Source code in dev_tool/tui/display.py
def __init__(self, terminal: Terminal) -> None:
    """
    The constructor for the DisplayInterface class.

    :param terminal: The blessed Terminal instance.
    """

    super().__init__(terminal)

draw_display

A method that draws the display view with the provided content.

Parameters:

  • content (str) –

    The content to display.

Source code in dev_tool/tui/display.py
def draw_display(self, content: str) -> None:
    """
    A method that draws the display view with the provided content.

    :param content: The content to display.
    """

    self._display(content)

handle_input

A method that handles input for the display interface.

Parameters:

  • key (str) –

    The key name.

Returns:

  • str | None

    The navigation result or None to continue.

Source code in dev_tool/tui/display.py
def handle_input(self, key: str) -> str | None:
    """
    A method that handles input for the display interface.

    :param key: The key name.
    :return: The navigation result or None to continue.
    """

    match key:
        case Key.UP:
            self.offset = max(0, self.offset - 1)
            return MenuAction.REDRAW
        case Key.DOWN:
            self.offset = self.offset + 1
            return MenuAction.REDRAW
        case _ if key in (Key.BACKSPACE, Key.DELETE, Key.ESCAPE):
            return MenuAction.MAIN_MENU
        case _ if key.lower() == Key.QUIT:
            return MenuAction.QUIT
        case _:
            return None