Upload files to "Modules"
This commit is contained in:
@ -1 +1 @@
|
||||
VERSION = "1.0.3"
|
||||
VERSION = "1.0.4"
|
24
Modules/global_commands.py
Normal file
24
Modules/global_commands.py
Normal file
@ -0,0 +1,24 @@
|
||||
from Modules.Submenus.about import *
|
||||
from Modules.Submenus.analyst_notebook import *
|
||||
|
||||
def global_command_handler(command):
|
||||
if command.lower() == "note":
|
||||
analyst_notebook_submenu()
|
||||
elif command.lower() == "about":
|
||||
about_submenu()
|
||||
else:
|
||||
print(f"{Fore.RED}Invalid global command: {command}{Style.RESET_ALL}")
|
||||
|
||||
def redirect_to_analyst_notebook():
|
||||
analyst_notebook_submenu()
|
||||
|
||||
def redirect_to_about():
|
||||
about_submenu()
|
||||
|
||||
def global_command_handler(command):
|
||||
if command.lower() in ["an","note","notebook","analyst","analyst notebook"]:
|
||||
redirect_to_analyst_notebook()
|
||||
elif command.lower() == "about":
|
||||
redirect_to_about()
|
||||
else:
|
||||
print("Invalid global command.")
|
@ -1,5 +1,8 @@
|
||||
import sys # For exiting the program
|
||||
from Modules.wrappers import *
|
||||
from Modules.Submenus.analyst_notebook import analyst_notebook_submenu
|
||||
from Modules.Submenus.about import about_submenu
|
||||
|
||||
|
||||
# Global action status to persist across all submenus and their nested submenus
|
||||
GLOBAL_ACTION_STATUS = {}
|
||||
@ -74,12 +77,18 @@ def build_submenu(menu_title, actions=None, module=None):
|
||||
else:
|
||||
print(f"{Style.RESET_ALL}[{key}] {status} {action['description']}")
|
||||
|
||||
print("[0] Return to Main Menu")
|
||||
print("[0] Return to Previous Menu")
|
||||
print("[q] EXIT\n")
|
||||
|
||||
|
||||
# Get user choice
|
||||
choice = input("Enter your choice: ").strip().upper()
|
||||
|
||||
# Handle global commands
|
||||
if choice in ["NOTE", "ABOUT"]:
|
||||
global_command_handler(choice)
|
||||
continue
|
||||
|
||||
# Handle highlighting (toggle with "!")
|
||||
if choice.endswith("!") and choice[:-1] in numbered_actions:
|
||||
key_to_toggle = choice[:-1]
|
||||
|
@ -4,6 +4,7 @@ from colorama import Fore, Style
|
||||
|
||||
from Assets.ascii_text_prompts import ascii_art, full_ascii_art, infinitei
|
||||
from Assets.random_tip import get_random_tip_with_color
|
||||
from Modules.global_commands import *
|
||||
|
||||
def clear_screen():
|
||||
# Check the system platform and use the appropriate command
|
||||
@ -30,10 +31,16 @@ def display_menu(menu_options):
|
||||
header(is_main_menu=True) # Show full details on main menu
|
||||
for key, value in menu_options.items():
|
||||
print(f"[{key}] {value['name'].upper()}")
|
||||
print("[0] Logout\n")
|
||||
print("[0] Logout")
|
||||
print("[NOTE] Analyst Notebook | [ABOUT] About Page\n") # Add global command options
|
||||
|
||||
choice = input("Enter your choice: ").strip().lower()
|
||||
|
||||
# Handle global commands
|
||||
if choice in ["note", "about"]:
|
||||
global_command_handler(choice) # Call the global command handler
|
||||
continue # Restart the loop after handling global commands
|
||||
|
||||
# Match the choice to a menu option
|
||||
if choice in menu_options:
|
||||
menu_options[choice]["submenu"]() # Call the submenu without arguments
|
||||
@ -43,6 +50,8 @@ def display_menu(menu_options):
|
||||
else:
|
||||
print("Invalid choice. Please try again.")
|
||||
|
||||
|
||||
|
||||
def print_info(title, content):
|
||||
header()
|
||||
print("=" * 40)
|
||||
|
Reference in New Issue
Block a user