diff --git a/src/OptimaLab35/ui/simple_tui.py b/src/OptimaLab35/ui/simple_tui.py deleted file mode 100644 index f8abd32..0000000 --- a/src/OptimaLab35/ui/simple_tui.py +++ /dev/null @@ -1,60 +0,0 @@ -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 diff --git a/src/OptimaLab35/utils/utility.py b/src/OptimaLab35/utils/utility.py index f604656..25990c5 100644 --- a/src/OptimaLab35/utils/utility.py +++ b/src/OptimaLab35/utils/utility.py @@ -90,28 +90,3 @@ class Utilities: ending_number = current_image ending = f"{ending_number:0{total_digits}}" return f"{base_name}_{ending}" - - def yes_no(self, str): - """Ask user y/n question""" - while True: - choice = input(f"{str} (y/n): ") - if choice == "y": - return True - elif choice == "n": - return False - else: - print("Not a valid option, try again.") - - def progress_bar(self, current, total, barsize = 50): - if current > total: - print("\033[91mThis bar has exceeded its limits!\033[0m Maybe the current value needs some restraint?") - return - progress = int((barsize / total) * current) - rest = barsize - progress - if rest <= 2: rest = 0 - # Determine the number of digits in total - total_digits = len(str(total)) - # Format current with leading zeros - current_formatted = f"{current:0{total_digits}}" - print(f"{current_formatted}|{progress * '-'}>{rest * ' '}|{total}", end="\r") - if current == total: print("")