All core features aviable

This commit is contained in:
Mr Finchum 2024-12-17 11:25:44 +00:00
parent 7965b55302
commit bc69b077b0
9 changed files with 579 additions and 14 deletions

58
tui.py Normal file
View file

@ -0,0 +1,58 @@
from simple_term_menu import TerminalMenu
class SimpleTUI:
"""TUI parts using library simple_term_menu"""
def __init__(self):
pass
def choose_menu(self, menu_title, choices):
""" Dynamic function to display content of a list and returnes which was selected."""
menu_options = choices
menu = TerminalMenu(
menu_entries = menu_options,
title = menu_title,
menu_cursor = "> ",
menu_cursor_style = ("fg_gray", "bold"),
menu_highlight_style = ("bg_gray", "fg_black"),
cycle_cursor = True,
clear_screen = False
)
menu.show()
return menu.chosen_menu_entry
def multi_select_menu(self, menu_title, choices):
""" Dynamic function to display content of a list and returnes which was selected."""
menu_options = choices
menu = TerminalMenu(
menu_entries = menu_options,
title = menu_title,
multi_select=True,
show_multi_select_hint=True,
menu_cursor_style = ("fg_gray", "bold"),
menu_highlight_style = ("bg_gray", "fg_black"),
cycle_cursor = True,
clear_screen = False
)
menu.show()
choisen_values = menu.chosen_menu_entries
if choisen_values == None:
print("Exiting...")
exit()
else:
return menu.chosen_menu_entries
def yes_no_menu(self, message): # oh
menu_options = ["[y] yes", "[n] no"]
menu = TerminalMenu(menu_entries = menu_options,
title = f"{message}",
menu_cursor = "> ",
menu_cursor_style = ("fg_red", "bold"),
menu_highlight_style = ("bg_gray", "fg_black"),
cycle_cursor = True,
clear_screen = False)
menu_entry_index = menu.show()
if menu_entry_index == 0:
return True
elif menu_entry_index == 1:
return False