From 1a92e86704a23d0e50c3f3f0b5cd127b70ddbbbf Mon Sep 17 00:00:00 2001 From: OVERLORD7F Date: Thu, 11 Sep 2025 16:27:26 +0300 Subject: [PATCH] - added random splash screen on startup (testing) - branding changes in menus - ver. now stored in variable --- main.py | 7 +++-- splash-screens.txt | 76 ++++++++++++++++++++++++++++++++++++++++++++++ splash_screen.py | 47 ++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 splash-screens.txt create mode 100644 splash_screen.py diff --git a/main.py b/main.py index 478a0b6..b1b6e6c 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,5 @@ import os +from splash_screen import * from config_data_import import * from cluster_api import * from domain_api import * @@ -6,6 +7,7 @@ from data_pools_api import * from disk_edit_mode import * from rich.panel import Panel from rich.console import Console , Align +SVMU_ver="0.3-dev" config_relative_path = os.path.join(os.getcwd() , 'SpaceVM_Utility.conf') #config in the same directory with main.py @@ -15,7 +17,8 @@ if not os.path.exists(config_relative_path): menu_choice=0 console = Console() -os.system('cls' if os.name=='nt' else 'clear') +os.system('cls' if os.name=='nt' else 'clear') +show_startup_logo(SVMU_ver) #shows startup splash (ASCII art) while(menu_choice != ""): #main menu loop check_config(config_relative_path) base_url, api_key, data_pool_uuid, data_pool_name, vm_uuids, vm_names, disk1_size, disk2_size, disk3_size = config_import(config_relative_path) #importing API-KEY / IP / DATA POOL UUID / VM-UUIDs from config @@ -29,7 +32,7 @@ while(menu_choice != ""): #main menu loop [bold grey53]Connected to Controller: [bright_yellow]{base_url}[/]\n Selected Data Pool: [bright_yellow]{data_pool_name}[/]\n Selected VMs:\n [bright_yellow]{vm_names}" menu_options=Align.center(menu_options, vertical="middle") menu_subtitle = "[blue bold][link=https://github.com/OVERLORD7F/SpaceVM_VM_Utility]:wrench: Project_GitHub[/link] [yellow]| [magenta bold][link=https://spacevm.ru/docs/]:books: SpaceVM_Docs[/link] [yellow]| [red bold][link=https://comptek.ru]:briefcase: Comptek[/link]" - console.print(Panel(menu_options, title="[bold magenta]SpaceVM Utility - Main Menu" , subtitle = menu_subtitle, subtitle_align="right" , style="yellow" , width=150 , padding = 2)) + console.print(Panel(menu_options, title=f"[bold magenta]SpaceVM Utility {SVMU_ver} - Main Menu" , subtitle = menu_subtitle, subtitle_align="right" , style="yellow" , width=150 , padding = 2)) menu_choice=str(input("\n>>> ")) if menu_choice == "1": config_menu(base_url, api_key, config_relative_path) diff --git a/splash-screens.txt b/splash-screens.txt new file mode 100644 index 0000000..bc52bb0 --- /dev/null +++ b/splash-screens.txt @@ -0,0 +1,76 @@ + +================================================================================================================================================================ + .dMMMb dMMMMb .aMMMb .aMMMb dMMMMMP dMP dMP dMMMMMMMMb dMP dMP dMMMMMMP dMP dMP dMP dMMMMMMP dMP dMP + dMP" VP dMP.dMP dMP"dMP dMP"VMP dMP dMP dMP dMP"dMP"dMP dMP dMP dMP amr dMP amr dMP dMP.dMP + VMMMb dMMMMP" dMMMMMP dMP dMMMP dMP dMP dMP dMP dMP dMP dMP dMP dMP dMP dMP dMP VMMMMP +dP .dMP dMP dMP dMP dMP.aMP dMP YMvAP" dMP dMP dMP dMP.aMP dMP dMP dMP dMP dMP dA .dMP +VMMMP" dMP dMP dMP VMMMP" dMMMMMP VP" dMP dMP dMP VMMMP" dMP dMP dMMMMMP dMP dMP VMMMP" +================================================================================================================================================================ + .d8888b. 888 888 888b d888 888 888 888 d8b 888 d8b 888 +d88P Y88b 888 888 8888b d8888 888 888 888 Y8P 888 Y8P 888 +Y88b. 888 888 88888b.d88888 888 888 888 888 888 + "Y888b. 88888b. 8888b. .d8888b .d88b. Y88b d88P 888Y88888P888 888 888 888888 888 888 888 888888 888 888 + "Y88b. 888 "88b "88b d88P" d8P Y8b Y88b d88P 888 Y888P 888 888 888 888 888 888 888 888 888 888 + "888 888 888 .d888888 888 88888888 Y88o88P 888 Y8P 888 888 888 888 888 888 888 888 888 888 +Y88b d88P 888 d88P 888 888 Y88b. Y8b. Y888P 888 " 888 Y88b. .d88P Y88b. 888 888 888 Y88b. Y88b 888 + "Y8888P" 88888P" "Y888888 "Y8888P "Y8888 Y8P 888 888 "Y88888P" "Y888 888 888 888 "Y888 "Y88888 + 888 888 + 888 Y8b d88P + 888 "Y88P" +================================================================================================================================================================ + oooooooo8 ooooo oooo oooo oooo ooooo oooo o8 o88 o888 o88 o8 +888 ooooooooo ooooooo ooooooo ooooooooo8 888 88 8888o 888 888 88 o888oo oooo 888 oooo o888oo oooo oooo + 888oooooo 888 888 ooooo888 888 888 888oooooo8 888 88 88 888o8 88 888 88 888 888 888 888 888 888 888 + 888 888 888 888 888 888 888 88888 88 888 88 888 88 888 888 888 888 888 888 888 +o88oooo888 888ooo88 88ooo88 8o 88ooo888 88oooo888 888 o88o 8 o88o 888oo88 888o o888o o888o o888o 888o 8888 + o888 o8o888 +================================================================================================================================================================ + ______ __ __ __ __ __ __ __ __ __ __ __ + / \ | \ | \| \ / \ | \ | \ | \ | \| \| \ | \ +| $$$$$$\ ______ ______ _______ ______ | $$ | $$| $$\ / $$ | $$ | $$ _| $$_ \$$| $$ \$$ _| $$_ __ __ +| $$___\$$ / \ | \ / \ / \| $$ | $$| $$$\ / $$$ | $$ | $$| $$ \ | \| $$| \| $$ \ | \ | \ + \$$ \ | $$$$$$\ \$$$$$$\| $$$$$$$| $$$$$$\\$$\ / $$| $$$$\ $$$$ | $$ | $$ \$$$$$$ | $$| $$| $$ \$$$$$$ | $$ | $$ + _\$$$$$$\| $$ | $$ / $$| $$ | $$ $$ \$$\ $$ | $$\$$ $$ $$ | $$ | $$ | $$ __ | $$| $$| $$ | $$ __ | $$ | $$ +| \__| $$| $$__/ $$| $$$$$$$| $$_____ | $$$$$$$$ \$$ $$ | $$ \$$$| $$ | $$__/ $$ | $$| \| $$| $$| $$ | $$| \| $$__/ $$ + \$$ $$| $$ $$ \$$ $$ \$$ \ \$$ \ \$$$ | $$ \$ | $$ \$$ $$ \$$ $$| $$| $$| $$ \$$ $$ \$$ $$ + \$$$$$$ | $$$$$$$ \$$$$$$$ \$$$$$$$ \$$$$$$$ \$ \$$ \$$ \$$$$$$ \$$$$ \$$ \$$ \$$ \$$$$ _\$$$$$$$ + | $$ | \__| $$ + | $$ \$$ $$ + \$$ \$$$$$$ +================================================================================================================================================================ + ______ ______ ______ ______ ______ __ __ __ __ __ __ ______ __ __ __ ______ __ __ +/\ ___\ /\ == \ /\ __ \ /\ ___\ /\ ___\ /\ \ / / /\ "-./ \ /\ \/\ \ /\__ _\ /\ \ /\ \ /\ \ /\__ _\ /\ \_\ \ +\ \___ \ \ \ _-/ \ \ __ \ \ \ \____ \ \ __\ \ \ \'/ \ \ \-./\ \ \ \ \_\ \ \/_/\ \/ \ \ \ \ \ \____ \ \ \ \/_/\ \/ \ \____ \ + \/\_____\ \ \_\ \ \_\ \_\ \ \_____\ \ \_____\ \ \__| \ \_\ \ \_\ \ \_____\ \ \_\ \ \_\ \ \_____\ \ \_\ \ \_\ \/\_____\ + \/_____/ \/_/ \/_/\/_/ \/_____/ \/_____/ \/_/ \/_/ \/_/ \/_____/ \/_/ \/_/ \/_____/ \/_/ \/_/ \/_____/ + +================================================================================================================================================================ +███████╗██████╗ █████╗ ██████╗███████╗██╗ ██╗███╗ ███╗ ██╗ ██╗████████╗██╗██╗ ██╗████████╗██╗ ██╗ +██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝██║ ██║████╗ ████║ ██║ ██║╚══██╔══╝██║██║ ██║╚══██╔══╝╚██╗ ██╔╝ +███████╗██████╔╝███████║██║ █████╗ ██║ ██║██╔████╔██║ ██║ ██║ ██║ ██║██║ ██║ ██║ ╚████╔╝ +╚════██║██╔═══╝ ██╔══██║██║ ██╔══╝ ╚██╗ ██╔╝██║╚██╔╝██║ ██║ ██║ ██║ ██║██║ ██║ ██║ ╚██╔╝ +███████║██║ ██║ ██║╚██████╗███████╗ ╚████╔╝ ██║ ╚═╝ ██║ ╚██████╔╝ ██║ ██║███████╗██║ ██║ ██║ +╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ +================================================================================================================================================================ + #### ##### # # # ##### #### # # # # ##### # # ##### # # ##### #### +# # # # # # # # # # ## ## # # # # ## # # # ## # # # +# # # ##### #### #### #### # # # # # # # # # # # # # # #### +# # # # # # # # # # # # # ## # # # ## # # # # + #### # # # # # ##### #### # # # # # # # # # # # # # +================================================================================================================================================================ + + ____ + .--.--. ,' , `. ___ ,--, ___ + / / '. ,-.----. ,---. ,-+-,.' _ | ,--, ,--.'|_ ,--, ,--.'| ,--, ,--.'|_ +| : /`. / \ / \ /__./| ,-+-. ; , || ,'_ /| | | :,' ,--.'| | | : ,--.'| | | :,' +; | |--` | : | ,---.; ; | ,--.'|' | ;| .--. | | : : : ' : | |, : : ' | |, : : ' : +| : ;_ | | .\ : ,--.--. ,---. ,---./___/ \ | || | ,', | ': ,'_ /| : . |.;__,' / `--'_ | ' | `--'_ .;__,' / .--, + \ \ `. . : |: | / \ / \ / \ ; \ ' || | / | | || | ' | | . .| | | ,' ,'| ' | | ,' ,'| | | | /_ ./| + `----. \| | \ :.--. .-. | / / ' / / \ \ \: |' | : | : |, | | ' | | |:__,'| : ' | | | | : ' | | :__,'| : , ' , ' : + __ \ \ || : . | \__\/: . .. ' / . ' / |; \ ' .; . | ; |--' : | | : ' ; ' : |__ | | : ' : |__ | | : ' : |__/___/ \: | + / /`--' /: |`-' ," .--.; |' ; :__ ' ; /| \ \ '| : | | , | ; ' | | ' | | '.'|' : |__ | | '.'|' : |__ | | '.'|. \ ' | +'--'. / : : : / / ,. |' | '.'|' | / | \ ` ;| : ' |/ : | : ; ; | ; : ;| | '.'|; : ;| | '.'|; : ; \ ; : + `--'---' | | : ; : .' \ : :| : | : \ |; | |`-' ' : `--' \ | , / ; : ;| , / ; : ;| , / \ \ ; + `---'.| | , .-./\ \ / \ \ / '---" | ;/ : , .-./ ---`-' | , / ---`-' | , / ---`-' : \ \ + `---` `--`---' `----' `----' '---' `--`----' ---`-' ---`-' \ ' ; + `--` \ No newline at end of file diff --git a/splash_screen.py b/splash_screen.py new file mode 100644 index 0000000..fd239bf --- /dev/null +++ b/splash_screen.py @@ -0,0 +1,47 @@ +import os +import random +import time +from rich.console import Console +from rich.panel import Panel +from rich.progress import Progress, SpinnerColumn, TextColumn + +console = Console() + +def show_startup_logo(SVMU_ver): + splash_file = os.path.join(os.path.dirname(__file__), "splash-screens.txt") + if not os.path.exists(splash_file): + console.print("[bold red]Splash screens file not found![/bold red]") + return + + with open(splash_file, "r", encoding="utf-8") as f: + content = f.read() + + # Split ASCII art blocks by lines of '=' (at least 160 in a row) + blocks = [block.strip() for block in content.split("\n" + "="*160) if block.strip()] + if not blocks: + console.print("[bold red]No splash screens found![/bold red]") + return + + art = random.choice(blocks) + + # Animated spinner while showing splash + with Progress( + SpinnerColumn(), + TextColumn("[bold cyan]Loading SpaceVM Utility...[/bold cyan]"), + transient=True, + console=console, + ) as progress: + task = progress.add_task("startup", total=None) + # Simulate loading + import time + time.sleep(1.5) + progress.remove_task(task) + + # Show the ASCII art in a pretty panel + console.print(Panel.fit(art, subtitle=f"[bold magenta]{SVMU_ver}[/bold magenta]", subtitle_align="right", border_style="grey53" , width=200 , padding = 2)) + time.sleep(2) #pause for 2 sec + os.system('cls' if os.name=='nt' else 'clear') #clears screen before returning + + +# Example usage: +# show_startup_logo()