diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f68c3f5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "terminal_menu"] + path = terminal_menu + url = git@git.chauvet.pro:starnakin/terminal_menu.git diff --git a/menu.py b/menu.py index 578a2f1..8f957ff 100644 --- a/menu.py +++ b/menu.py @@ -2,6 +2,7 @@ from database import Database from scrapper import get_files, get_uri from utils import get_url, get import platform +from terminal_menu.Menu import Menu uri = "" @@ -9,21 +10,9 @@ preview_site = {} preview_database = "" def get_user_choice_by_menu(options: list, title = None, preview_command=None, preview_size: float = 0.3, show_search_hint: bool = False, skip_empty_entries = False): - - try: - from simple_term_menu import TerminalMenu - terminal_menu = TerminalMenu(options, - preview_command=preview_command, - title=title, - show_search_hint=show_search_hint, - preview_size=preview_size, - skip_empty_entries=skip_empty_entries); - response = terminal_menu.show(); - except: - import dumb_menu - response = dumb_menu.get_menu_choice(options); - - return (response); + menu = Menu(options, title, preview_body_function=preview_command, preview_ratio=preview_size, skip_empty_option=skip_empty_entries + ) + return (menu.show()); def add_site(database: Database) -> dict: print("add a site:") diff --git a/terminal_menu b/terminal_menu new file mode 160000 index 0000000..4d85721 --- /dev/null +++ b/terminal_menu @@ -0,0 +1 @@ +Subproject commit 4d85721b8ac1083701c11d711f78abffcb7df05d