include spinners or loading bar from console that people would know if the program is stuck or not

this would help issues like #358, that they would not be waiting for nothing
pull/280/head
iaacornus 3 years ago
parent 81bb39fecc
commit cce278ab83
No known key found for this signature in database
GPG Key ID: 281739AE7252598C

@ -3,6 +3,7 @@ from pathlib import Path
from playwright.sync_api import sync_playwright, ViewportSize from playwright.sync_api import sync_playwright, ViewportSize
from rich.progress import track from rich.progress import track
from rich.console import Console
from utils.console import print_step, print_substep from utils.console import print_step, print_substep
@ -14,12 +15,14 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme):
reddit_object: The Reddit Object you received in askreddit.py reddit_object: The Reddit Object you received in askreddit.py
screenshot_num: The number of screenshots you want to download. screenshot_num: The number of screenshots you want to download.
""" """
console = Console()
print_step("Downloading Screenshots of Reddit Posts 📷") print_step("Downloading Screenshots of Reddit Posts 📷")
# ! Make sure the reddit screenshots folder exists # ! Make sure the reddit screenshots folder exists
Path("assets/png").mkdir(parents=True, exist_ok=True) Path("assets/png").mkdir(parents=True, exist_ok=True)
print_substep("Launching Headless Browser...") with console.status("[bold]Launching Headless Browser ...", spinner="simpleDots"):
with sync_playwright() as browser_: with sync_playwright() as browser_:
browser = browser_.chromium.launch() browser = browser_.chromium.launch()
context = browser.new_context() context = browser.new_context()

Loading…
Cancel
Save