Skip to content

Commit

Permalink
Catch the colorama import problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ahMADASSadi committed Jan 28, 2025
1 parent d36d741 commit 704e22b
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/menu.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from colorama import Fore, Style, init as colorama_init
import os

colorama_init()
logo = """
█████ █████ █████████ ███████████
░░███ ░░███ ███░░░░░███░█░░░███░░░█
Expand All @@ -27,22 +25,29 @@ def center_text(text: str) -> str:


def display_menu():
"""Displays a menu of options to the user."""
# Display the logo
print(f"{Fore.CYAN}{center_text(logo)}{Style.RESET_ALL}")

# Display the menu options
"""
Displays a menu of options to the user.
"""

menu_text = """
Welcome to the Ubuntu Configuration Tool
Please choose an option:
0: See and Update the configuration file
1: Install apps
2: Test ping of the VPN servers
q: Exit
"""
print(f"{Fore.MAGENTA}{menu_text}{Style.RESET_ALL}")
Welcome to the Ubuntu Configuration Tool
Please choose an option:
0: See and Update the configuration file
1: Install apps
2: Test ping of the VPN servers
q: Exit
"""

try:
from colorama import Fore, Style, init as colorama_init
colorama_init()
print(f"{Fore.CYAN}{center_text(logo)}{Style.RESET_ALL}")
print(f"{Fore.MAGENTA}{menu_text}{Style.RESET_ALL}")

except ImportError:
print(f"{center_text(logo)}")
print(f"{menu_text}")

def get_user_choice() -> int:
"""Gets the user's choice from the menu.
Expand Down

0 comments on commit 704e22b

Please sign in to comment.