def _curses_should_update_all(): """Curses menu for should_update_all. Will be patched over should_update_all if needed.""" # Create a menu, show it, and get the user's choice. newmenu = Menu("Yes", "No", title="Update all existing repositories?") choice = newmenu.show() if choice: return choice == "Yes" # Choice is None, user pressed Q. print("Exiting.") quit()
def _curses_should_download_all(): """Curses menu for should_download_all.""" # Create a menu, show it, and get the user's choice. newmenu = Menu("Yes", "No", title="Download all repositories?") choice = newmenu.show() if choice: return choice == "Yes" # Choice is None, so the user pressed Q. print("Exiting.") quit()
def _curses_should_update_repository(repo_name): """Curses version of should_update_repository.""" # Create a menu, show it, and get the user's choice. menu_title = "Repository {} already exists. Update?".format(repo_name) menu = Menu("Yes", "No", title=menu_title) choice = menu.show() if choice: return choice == "Yes" # Choice is None, user pressed Q. print("Exiting.") quit()
def _curses_should_download_repository(repo): """Curses version of should_download_repo.""" # Create a menu, show it, and get the user's choice. menu = Menu("Download", "Skip", "Download All", title=repo['name'], subtitle=repo['description']) choice = menu.show() # Convert our menu choice into a program-readable single character. choice_dict = {"Download": "y", "Skip": "n", "Download All": "a"} if choice: return choice_dict[choice] # Choice is None, user pressed Q. quit()