From f275c6e5e7a81ce898e61bfae4b16b1c0f7b8ed4 Mon Sep 17 00:00:00 2001 From: El Laggron Date: Mon, 28 May 2018 05:30:35 +0200 Subject: [PATCH] [V3 Launcher] Fixed issue with update choice (#1649) * [V3 Launcher] Fixed issue with update choice extras_selectors() was run even if what the user did input for the development choice (stable/dev) was wrong * [V3 Launcher] Option to go back when updating * [V3 Launcher] Fixed coding style --- redbot/launcher.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/redbot/launcher.py b/redbot/launcher.py index 081ef3e34..de463016c 100644 --- a/redbot/launcher.py +++ b/redbot/launcher.py @@ -310,16 +310,20 @@ def extras_selector(): return selected -def development_choice(reinstall=False): +def development_choice(reinstall=False, can_go_back=True): while True: print("\n") print("Do you want to install stable or development version?") print("1. Stable version") print("2. Development version") + if can_go_back: + print("\n") + print("0. Go back") choice = user_choice() print("\n") - selected = extras_selector() + if choice == "1": + selected = extras_selector() update_red( dev=False, reinstall=reinstall, @@ -330,6 +334,7 @@ def development_choice(reinstall=False): ) break elif choice == "2": + selected = extras_selector() update_red( dev=True, reinstall=reinstall, @@ -339,6 +344,10 @@ def development_choice(reinstall=False): mongo=True if "mongo" in selected else False, ) break + elif choice == "0" and can_go_back: + return False + clear_screen() + return True def debug_info(): @@ -396,8 +405,8 @@ def main_menu(): run_red(instance, autorestart=False, cliflags=cli_flags) wait() elif choice == "3": - development_choice() - wait() + if development_choice(): + wait() elif choice == "4": basic_setup() wait() @@ -420,14 +429,14 @@ def main_menu(): print("0. Back") choice = user_choice() if choice == "1": - development_choice(reinstall=True) - wait() + if development_choice(reinstall=True): + wait() elif choice == "2": loop.run_until_complete(reset_red()) wait() elif choice == "3": loop.run_until_complete(reset_red()) - development_choice(reinstall=True) + development_choice(reinstall=True, can_go_back=False) wait() elif choice == "0": break