better_launch.tui.footer_menu module

class better_launch.tui.footer_menu.FooterMenu(*args: Any, **kwargs: Any)

Bases: FormattedTextControl

get_selected_item() str | tuple

Return the currently selected item data. If the item is a tuple it will have formatting in the first slot, its string representation in the second, and any additional information in subsequent slots.

Returns

str | tuple

The item as it was passed to this menu.

render()
select(idx: int) None

Select the specified existing menu item. No modulo operation is performed on the passed index, so it must be valid.

Parameters

idxint

The index of the item to be selected.

Raises

ValueError

If the provided index is outside the range of items in this menu.

select_next() None

Select the next menu item, wrapping around.

select_prev() None

Select the previous menu item, wrapping around.

set_items(items: list[str | tuple[str, str]], default: int = 0) None

Replace the items currently in this menu.

Parameters

itemslist[str | tuple[str, str]]

The new items to use. If an item is a tuple, its first slot must be a formatting string and the second its string information. Any subsequent slots are kept, but ignored.

defaultint, optional

Index of the item to select.

update_items(items: list[str | tuple[str, str]]) None

Like [FooterMenu.set_items][], except that it keeps the currently selected index intact if it is contained within the new list of items.

Parameters

itemslist[str | tuple[str, str]]

The new items to use. If an item is a tuple, its first slot must be a formatting string and the second its string information. Any subsequent slots are kept, but ignored.