refactor: Removed tui leftover.
This commit is contained in:
parent
09025105ea
commit
d608156206
2 changed files with 0 additions and 85 deletions
|
@ -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
|
|
|
@ -90,28 +90,3 @@ class Utilities:
|
||||||
ending_number = current_image
|
ending_number = current_image
|
||||||
ending = f"{ending_number:0{total_digits}}"
|
ending = f"{ending_number:0{total_digits}}"
|
||||||
return f"{base_name}_{ending}"
|
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("")
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue