-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
148 lines (129 loc) · 5.37 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import time
import sys
import pyperclip
from colorama import init
import os
from assets.colors import (
cyberpunk_text,
menu_option_text,
error_text,
highlight_text,
important_text,
cyan_text
)
# Initialize colorama
init()
def clear_screen():
"""Clear the terminal screen."""
os.system('cls' if os.name == 'nt' else 'clear')
def copy_to_clipboard(text):
"""Copy given text to clipboard."""
pyperclip.copy(text)
print(cyan_text("Copied to clipboard!"))
def beep():
"""Trigger a terminal beep sound."""
print('\a')
def show_splash_screen():
"""Display the splash screen with a delay."""
clear_screen()
print(cyberpunk_text("Welcome to the Cyberpunk Terminal Resume!"))
time.sleep(2) # Pause for 2 seconds before moving on
def print_main_menu():
"""Display the main menu options."""
clear_screen()
print(cyberpunk_text("=== Cyberpunk Resume ===")) # Display a simple title
print(menu_option_text("1. About Me"))
print(menu_option_text("2. Skills"))
print(menu_option_text("3. Projects"))
print(menu_option_text("4. Contact"))
print(menu_option_text("5. Exit"))
def typing_effect(text, delay=0.02): # Reduce delay to speed up typing
"""Simulate typing effect for the given text."""
for char in text:
sys.stdout.write(char)
sys.stdout.flush()
time.sleep(delay)
print() # Move to the next line after typing is done
def load_content(file_path):
"""Load content from a text file."""
try:
with open(file_path, 'r', encoding='utf-8') as file:
return file.read()
except FileNotFoundError:
print(error_text("Error: File not found. Please check the file path and try again."))
input(cyan_text("\nPress Enter to return to the main menu..."))
return None
except Exception as e:
print(error_text(f"An unexpected error occurred: {e}"))
input(cyan_text("\nPress Enter to return to the main menu..."))
return None
def display_section(content):
"""Display a specific section of the resume."""
if content:
clear_screen()
typing_effect(important_text(content), delay=0.01) # Using typing effect with faster speed
input(cyan_text("\nPress Enter to go back to the main menu...")) # Wait for user input
else:
print(error_text("No content to display."))
input(cyan_text("\nPress Enter to go back to the main menu..."))
def easter_egg():
"""Enhanced Easter egg feature."""
clear_screen()
typing_effect(cyberpunk_text("You've unlocked a hidden feature! 🌌"))
time.sleep(1)
typing_effect(important_text("\n\"The future is already here — it's just not evenly distributed.\" - William Gibson"))
time.sleep(1)
# Mini-Quiz
print(menu_option_text("\nCyberpunk Trivia Time!"))
quiz_questions = {
"What is the name of the famous Cyberpunk novel by William Gibson?": "Neuromancer",
"Which movie is considered a Cyberpunk classic starring Harrison Ford?": "Blade Runner",
"What is the name of the dystopian mega-corporation in 'Cyberpunk 2077'?": "Arasaka"
}
correct_answers = 0
for question, answer in quiz_questions.items():
user_answer = input(cyan_text(f"\n{question} ")).strip()
if user_answer.lower() == answer.lower():
print(highlight_text("Correct!"))
correct_answers += 1
else:
print(error_text(f"Incorrect! The correct answer was '{answer}'."))
print(cyan_text(f"\nYou answered {correct_answers} out of {len(quiz_questions)} questions correctly!"))
# Hidden information
time.sleep(1)
typing_effect(important_text("\nHere's a secret: I built this terminal resume because I love merging creativity with code. Stay curious, traveler!"))
# Wait for user to exit Easter egg
input(cyan_text("\nPress Enter to exit the secret mode and return to the main menu..."))
def main():
"""Main function to control the flow of the program."""
show_splash_screen() # Display splash screen at the start
while True:
print_main_menu()
choice = input(cyan_text("Select an option (or type '77' for a surprise): ")) # Updated hint for easter egg
if choice == '1':
about_content = load_content('content/about.txt')
if about_content:
display_section(about_content)
elif choice == '2':
skills_content = load_content('content/skills.txt')
if skills_content:
display_section(skills_content)
elif choice == '3':
projects_content = load_content('content/projects.txt')
if projects_content:
display_section(projects_content)
elif choice == '4':
contact_content = load_content('content/contact.txt')
if contact_content:
display_section(contact_content)
copy_choice = input(cyan_text("\nWould you like to copy your email to clipboard? (y/n): "))
if copy_choice.lower() == 'y':
copy_to_clipboard("[email protected]")
elif choice == '77': # Easter egg condition (updated to match the hint)
easter_egg() # Enhanced Easter egg feature
elif choice == '5':
break
else:
print(error_text("Invalid choice. Please try again."))
if __name__ == "__main__":
main()