[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
This commit is contained in:
El Laggron 2018-05-28 05:30:35 +02:00 committed by Kowlin
parent 5ec25959df
commit f275c6e5e7

View File

@ -310,16 +310,20 @@ def extras_selector():
return selected return selected
def development_choice(reinstall=False): def development_choice(reinstall=False, can_go_back=True):
while True: while True:
print("\n") print("\n")
print("Do you want to install stable or development version?") print("Do you want to install stable or development version?")
print("1. Stable version") print("1. Stable version")
print("2. Development version") print("2. Development version")
if can_go_back:
print("\n")
print("0. Go back")
choice = user_choice() choice = user_choice()
print("\n") print("\n")
selected = extras_selector()
if choice == "1": if choice == "1":
selected = extras_selector()
update_red( update_red(
dev=False, dev=False,
reinstall=reinstall, reinstall=reinstall,
@ -330,6 +334,7 @@ def development_choice(reinstall=False):
) )
break break
elif choice == "2": elif choice == "2":
selected = extras_selector()
update_red( update_red(
dev=True, dev=True,
reinstall=reinstall, reinstall=reinstall,
@ -339,6 +344,10 @@ def development_choice(reinstall=False):
mongo=True if "mongo" in selected else False, mongo=True if "mongo" in selected else False,
) )
break break
elif choice == "0" and can_go_back:
return False
clear_screen()
return True
def debug_info(): def debug_info():
@ -396,7 +405,7 @@ def main_menu():
run_red(instance, autorestart=False, cliflags=cli_flags) run_red(instance, autorestart=False, cliflags=cli_flags)
wait() wait()
elif choice == "3": elif choice == "3":
development_choice() if development_choice():
wait() wait()
elif choice == "4": elif choice == "4":
basic_setup() basic_setup()
@ -420,14 +429,14 @@ def main_menu():
print("0. Back") print("0. Back")
choice = user_choice() choice = user_choice()
if choice == "1": if choice == "1":
development_choice(reinstall=True) if development_choice(reinstall=True):
wait() wait()
elif choice == "2": elif choice == "2":
loop.run_until_complete(reset_red()) loop.run_until_complete(reset_red())
wait() wait()
elif choice == "3": elif choice == "3":
loop.run_until_complete(reset_red()) loop.run_until_complete(reset_red())
development_choice(reinstall=True) development_choice(reinstall=True, can_go_back=False)
wait() wait()
elif choice == "0": elif choice == "0":
break break