since the setup is happening incredibly fast, loading bars or spinners are deemed unnecessary

pull/280/head
iaacornus 3 years ago
parent 70a34402d1
commit 8f1e2f18c7
No known key found for this signature in database
GPG Key ID: 281739AE7252598C

@ -14,15 +14,13 @@ console = Console()
def setup(): def setup():
if exists(".setup-done-before"): if exists(".setup-done-before"):
console.log( console.log(
"[bold red]Setup was already done before! Please" "[bold red]Setup was already done before! Please make"
+ " make sure you have to run this script again.[/bold red]" + " sure you have to run this script again.[/bold red]"
) )
# to run the setup script again, but in better and more convenient manner. # to run the setup script again, but in better and more convenient manner.
if input("\033[1mRun the script again? [y/N] > \033[0m") not in ["y", "Y"]: if input("\033[1mRun the script again? [y/N] > \033[0m") not in ["y", "Y"]:
raise SystemExit() raise SystemExit()
print_step("Setup Assistant")
print_markdown( print_markdown(
"### You're in the setup wizard. Ensure you're supposed to be here, " "### You're in the setup wizard. Ensure you're supposed to be here, "
+ "then type yes to continue. If you're not sure, type no to quit." + "then type yes to continue. If you're not sure, type no to quit."
@ -30,7 +28,7 @@ def setup():
# This Input is used to ensure the user is sure they want to continue. # This Input is used to ensure the user is sure they want to continue.
# Again, let them know they are about to erase all other setup data. # Again, let them know they are about to erase all other setup data.
console.log( console.print(
"Ensure you have the following ready to enter:\n" "Ensure you have the following ready to enter:\n"
+ "[bold green]Reddit Client ID\n" + "[bold green]Reddit Client ID\n"
+ "Reddit Client Secret\n" + "Reddit Client Secret\n"
@ -40,11 +38,9 @@ def setup():
+ "Opacity (range of 0-1, decimals are accepted.)\n" + "Opacity (range of 0-1, decimals are accepted.)\n"
+ "Subreddit (without r/ or /r/)\n" + "Subreddit (without r/ or /r/)\n"
+ "Theme (light or dark)[/bold green]" + "Theme (light or dark)[/bold green]"
) + "[bold]If you don't have these, please follow the instructions in the README.md file to"
console.print( + " set them up.\nIf you do have these, type y or Y to continue. If you don't, go ahead and"
"[bold]If you don't have these, please follow the instructions in the README.md file to " + " grab those quickly and come back.[/bold]"
+ "set them up.\nIf you do have these, type yes to continue. If you don't, go ahead and "
+ "grab those quickly and come back.[/bold]"
) )
"""Begin the setup process.""" """Begin the setup process."""
@ -57,13 +53,10 @@ def setup():
opacity = input("Opacity? (range of 0-1) > ") opacity = input("Opacity? (range of 0-1) > ")
subreddit = input("Subreddit (without r/) > ") subreddit = input("Subreddit (without r/) > ")
theme = input("Theme? (light or dark) > ") theme = input("Theme? (light or dark) > ")
console.log("Attempting to save your credentials...")
with console.status("[bold magenta]Saving credentials...[/bold magenta]"):
# you can also put a while loop here, e.g. while VideoIsBeingMade == True: ... # you can also put a while loop here, e.g. while VideoIsBeingMade == True: ...
console.log("Removing old .env file...") console.log("[bold]Saving details...[/bold]")
os.remove(".env") os.remove(".env")
console.log("Creating new .env file...")
with open('.env', 'a', encoding="utf-8") as f: with open('.env', 'a', encoding="utf-8") as f:
f.write(f'REDDIT_CLIENT_ID="{cliID}"\n') f.write(f'REDDIT_CLIENT_ID="{cliID}"\n')
f.write(f'REDDIT_CLIENT_SECRET="{cliSec}"\n') f.write(f'REDDIT_CLIENT_SECRET="{cliSec}"\n')
@ -79,4 +72,4 @@ def setup():
"This file will stop the setup assistant from running again." "This file will stop the setup assistant from running again."
) )
console.log("[bold green]Setup Complete![/bold green]") console.print("[bold green]Setup Complete![/bold green]")

Loading…
Cancel
Save