Skip to content

header

dev_tool.tui.components.header

HeaderComponent

A component for rendering the header.

The constructor for the HeaderComponent class.

Parameters:

  • terminal (Terminal) –

    The blessed Terminal instance.

  • theme (Default) –

    The theme instance for styling.

Source code in dev_tool/tui/components/header.py
def __init__(self, terminal: Terminal, theme: Default) -> None:
    """
    The constructor for the HeaderComponent class.

    :param terminal: The blessed Terminal instance.
    :param theme: The theme instance for styling.
    """

    self.project = CONTEXT.configuration.get_project_name() or 'Unknown'
    self.terminal = terminal
    self.theme = theme

project = CONTEXT.configuration.get_project_name() or 'Unknown' instance-attribute

terminal = terminal instance-attribute

theme = theme instance-attribute

draw

A method that draws the header with the project title.

Parameters:

  • output (list) –

    The list to append terminal output strings to.

Source code in dev_tool/tui/components/header.py
def draw(self, output: list) -> None:
    """
    A method that draws the header with the project title.

    :param output: The list to append terminal output strings to.
    """

    background = ' ' * self.terminal.width
    output.append(self.terminal.move(0, 0) + self.theme.header_background(background))

    title = f' {self.project}'
    output.append(self.terminal.move(0, 0) + self.theme.header_background(title))