section description

This commit is contained in:
hjoaquim
2024-05-07 09:58:48 +01:00
parent 380891de4e
commit 5bf2bbd76a
2 changed files with 28 additions and 4 deletions

View File

@@ -108,6 +108,15 @@ class MenuText:
"""Append raw text (without translation)."""
self.menu_text += text
def add_section(self, text: str, description: str = ""):
"""Append raw text (without translation)."""
spacing = (self.CMD_NAME_LENGTH - len(text) + self.SECTION_SPACING) * " "
left_spacing = self.SECTION_SPACING * " "
if description:
text = f"{left_spacing}{text}{spacing}{description}\n"
self.menu_text += "\n" + text
def add_custom(self, name: str):
"""Append custom text (after translation)."""
self.menu_text += f"{i18n.t(self.menu_path + name)}"