INNER CODE UNIT · Python

BuildMenu

loxy0devlp/RedTiger-Tools · redtiger.py:174

def BuildMenu(option_names, option_categories, options_list):
    categories = []
    max_lines       = 0
    col_width       = 45
    empty_col_width = 30 

    for category, indexes in option_categories.items():
        lines = [option_names[i] for i in indexes if options_list[i][3] is not None]
        if lines:
            categories.append((category, lines))
            max_lines = max(max_lines, len(lines))

    output  = f"  {BEFORE}H{AFTER + white} Help\n"
    output += f"  {BEFORE}V{AFTER + white} Version\n"
    output += f"  {BEFORE}S{AFTER + white} Settings\n\n"
    title_line = "  "

    for category, _ in categories: title_line += f"{BEFORE + category + AFTER:<{col_width}}"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…