Skip to content

Configuration

elva.widgets.config

Textual widgets for displaying a configuration parameter mapping.

Classes:

  • Key

    Widget holding a configuration parameter's key.

  • Value

    Widget holding a configuration parameter's value.

  • ConfigView

    Containers representing all configuration parameter key-value pairs.

Key

Bases: Static

Widget holding a configuration parameter's key.

Value

Bases: Static

Widget holding a configuration parameter's value.

ConfigView

Bases: VerticalScroll

Containers representing all configuration parameter key-value pairs.

Methods:

  • compose

    Hook adding child widgets.

Attributes:

BORDER_TITLE = 'Configuration' class-attribute instance-attribute

Default border title.

DEFAULT_CSS = '\n ConfigView {\n layout: grid;\n grid-size: 2;\n grid-columns: auto 1fr;\n grid-gutter: 0 1;\n height: auto;\n }\n ' class-attribute instance-attribute

Default CSS.

config = reactive(tuple, recompose=True) class-attribute instance-attribute

Configuration parameters alongside their respective values.

This attribute causes a recompose of this widget on being changed.

compose()

Hook adding child widgets.

Source code in src/elva/widgets/config.py
def compose(self):
    """
    Hook adding child widgets.
    """
    for key, value in self.config:
        yield Key(str(key))

        # don't rely on the string representation of list items,
        # get the string conversion individually instead
        if isinstance(value, list):
            value = "\n".join(str(v) for v in value)

        yield Value(str(value))