Karana.KUtils.MultibodyTUI.dialog#
Classes for controlling dialog in TUIs.
Classes#
Base class for a user text input TUI. |
|
Dialog for searching. |
|
Simple class to track the value of a flag. |
|
TUI for controlling a set of flags. |
|
Class with data needed for a TUI menu. |
|
TUI for a menu. |
|
Data associated with a ChoiceTUI. |
|
A TUI for controlling choices. |
Module Contents#
- class Karana.KUtils.MultibodyTUI.dialog.EntryDialog(prompt: list[str] | None = None, entry: str = '')[source]#
Base class for a user text input TUI.
- prompt = None#
- entry = ''#
- isValid() bool[source]#
Check if the user entered content is valid.
- Returns:
Always returns True.
- Return type:
bool
Return the footer message.
- Returns:
The footer message.
- Return type:
list[str]
- class Karana.KUtils.MultibodyTUI.dialog.SearchDialog(universe: list[str], prompt=list[str] | None)[source]#
Bases:
EntryDialogDialog for searching.
- universe#
- matches() list[str][source]#
Return a list of matches.
- Returns:
A list of matches from the users search.
- Return type:
list[str]
- isValid() bool[source]#
Check if matches were found.
- Returns:
True if matches were found, False otherwise.
- Return type:
bool
- static boldMatch(string: str, substr: str) str[source]#
Make part of a string bold.
- Parameters:
string (str) – The full string.
substr (str) – The substring to make bold.
- Returns:
A string with the substr bolded.
- Return type:
str
Return the footer message.
- Returns:
The footer message.
- Return type:
list[str]
- class Karana.KUtils.MultibodyTUI.dialog.FlagData[source]#
Simple class to track the value of a flag.
- brief: str#
- enabled: bool#
- class Karana.KUtils.MultibodyTUI.dialog.FlagsTUI(header: list[str], flags: list[FlagData])[source]#
Bases:
Karana.KUtils.MultibodyTUI.base.TUIBaseTUI for controlling a set of flags.
- property confirmed#
Return true if confirmed.
- Returns:
True if confirmed, False otherwise.
- Return type:
bool
- class Karana.KUtils.MultibodyTUI.dialog.MenuEntry[source]#
Class with data needed for a TUI menu.
- brief: str#
- callback: collections.abc.Callable | None = None#
- description: str = ''#
- done: bool = False#
- class Karana.KUtils.MultibodyTUI.dialog.MenuTUI(header: list[str], entries: list[MenuEntry], index: int = 0)[source]#
Bases:
Karana.KUtils.MultibodyTUI.base.TUIBaseTUI for a menu.
Return footer message.
- Returns:
The footer message.
- Return type:
list[str]
- class Karana.KUtils.MultibodyTUI.dialog.ChoiceData[source]#
Data associated with a ChoiceTUI.
- brief: str#
- value: Any#
- description: str = ''#
- class Karana.KUtils.MultibodyTUI.dialog.ChoiceTUI(header: list[str], choices: list[ChoiceData], index: int = 0)[source]#
Bases:
Karana.KUtils.MultibodyTUI.base.TUIBaseA TUI for controlling choices.
- property choice: ChoiceData | None#
The currently selected choice.
- Returns:
The currently selected choice.
- Return type:
ChoiceData | None