-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
445 lines (373 loc) · 13.8 KB
/
setup.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
import os
import sys
from pathlib import Path
import subprocess
# Define the GUI code content
entry_point_content = '''
import customtkinter as ctk
from PIL import Image, ImageTk
class DetoxApp(ctk.CTk):
def __init__(self):
super().__init__()
# Configure window
self.title("5P Transformation - Your Journey to Thriving in 2025")
self.geometry("1400x900")
# Set theme colors
self.colors = {
"primary": "#004d40", # Dark emerald
"secondary": "#ffd700", # Yellow
"text_light": "#ffffff",
"text_dark": "#333333",
"background": "#001f1a", # Darker emerald
"accent": "#00796b" # Medium emerald
}
# Set theme
ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("dark-blue")
# Initialize pages dictionary
self.pages = {}
self.current_page = None
# Create UI
self.setup_ui()
def setup_ui(self):
# Configure grid
self.grid_columnconfigure(1, weight=1)
self.grid_rowconfigure(0, weight=1)
# Create sidebar
self.create_sidebar()
# Create main content
self.create_main_content()
# Create pages
self.create_pages()
# Show welcome page by default
self.show_page("🏠 Welcome")
def create_pages(self):
"""Create all application pages"""
self.pages = {
"🏠 Welcome": self.create_welcome_page,
"👥 People Detox": self.create_people_page,
"🏠 Places Detox": self.create_places_page,
"👤 Personal Growth": self.create_personal_page,
"💼 Professional Growth": self.create_professional_page,
"🎯 Purpose Discovery": self.create_purpose_page,
"📝 Journal": self.create_journal_page,
"📊 Progress": self.create_progress_page
}
def create_sidebar(self):
# Sidebar frame
self.sidebar = ctk.CTkFrame(
self,
fg_color=self.colors["primary"],
width=250
)
self.sidebar.grid(row=0, column=0, sticky="nsew")
self.sidebar.grid_propagate(False)
# App title
title = ctk.CTkLabel(
self.sidebar,
text="5P Transformation",
font=("Helvetica", 24, "bold"),
text_color=self.colors["secondary"]
)
title.pack(pady=30)
# Navigation buttons
nav_items = [
"🏠 Welcome",
"👥 People Detox",
"🏠 Places Detox",
"👤 Personal Growth",
"💼 Professional Growth",
"🎯 Purpose Discovery",
"📝 Journal",
"📊 Progress"
]
for item in nav_items:
btn = ctk.CTkButton(
self.sidebar,
text=item,
fg_color="transparent",
text_color=self.colors["text_light"],
hover_color=self.colors["accent"],
anchor="w",
command=lambda x=item: self.show_page(x)
)
btn.pack(pady=5, padx=20, fill="x")
def create_main_content(self):
# Main content frame
self.main_frame = ctk.CTkFrame(self)
self.main_frame.grid(row=0, column=1, sticky="nsew", padx=20, pady=20)
self.main_frame.grid_columnconfigure(0, weight=1)
self.main_frame.grid_rowconfigure(0, weight=1)
def show_page(self, page_name):
"""Switch to the selected page"""
# Clear current page
if self.current_page:
self.current_page.destroy()
# Create new page
if page_name in self.pages:
self.current_page = self.pages[page_name]()
self.current_page.grid(row=0, column=0, sticky="nsew", padx=20, pady=20)
print(f"Showing page: {page_name}")
def create_welcome_page(self):
"""Create welcome page"""
page = ctk.CTkFrame(self.main_frame)
# Welcome message
welcome = ctk.CTkLabel(
page,
text="Welcome to Your 2025 Transformation Journey",
font=("Helvetica", 32, "bold"),
text_color=self.colors["secondary"]
)
welcome.pack(pady=50)
# Motivation quote
quote = ctk.CTkLabel(
page,
text="'We're not just surviving, we're thriving in 2025'",
font=("Helvetica", 18, "italic"),
text_color=self.colors["text_light"]
)
quote.pack(pady=20)
# Get Started button
start_btn = ctk.CTkButton(
page,
text="Begin Your Journey",
font=("Helvetica", 16, "bold"),
fg_color=self.colors["accent"],
hover_color=self.colors["primary"],
command=self.start_journey
)
start_btn.pack(pady=30)
return page
def create_people_page(self):
"""Create people detox page"""
page = ctk.CTkFrame(self.main_frame)
title = ctk.CTkLabel(
page,
text="People Detox",
font=("Helvetica", 32, "bold"),
text_color=self.colors["secondary"]
)
title.pack(pady=30)
description = ctk.CTkLabel(
page,
text="Transform your relationships and social connections",
font=("Helvetica", 16),
text_color=self.colors["text_light"]
)
description.pack(pady=20)
return page
def create_places_page(self):
"""Create places detox page"""
page = ctk.CTkFrame(self.main_frame)
title = ctk.CTkLabel(
page,
text="Places Detox",
font=("Helvetica", 32, "bold"),
text_color=self.colors["secondary"]
)
title.pack(pady=30)
description = ctk.CTkLabel(
page,
text="Optimize your environment for success",
font=("Helvetica", 16),
text_color=self.colors["text_light"]
)
description.pack(pady=20)
return page
def create_personal_page(self):
"""Create personal growth page"""
page = ctk.CTkFrame(self.main_frame)
title = ctk.CTkLabel(
page,
text="Personal Growth",
font=("Helvetica", 32, "bold"),
text_color=self.colors["secondary"]
)
title.pack(pady=30)
return page
def create_professional_page(self):
"""Create professional growth page"""
page = ctk.CTkFrame(self.main_frame)
title = ctk.CTkLabel(
page,
text="Professional Growth",
font=("Helvetica", 32, "bold"),
text_color=self.colors["secondary"]
)
title.pack(pady=30)
return page
def create_purpose_page(self):
"""Create purpose discovery page"""
page = ctk.CTkFrame(self.main_frame)
title = ctk.CTkLabel(
page,
text="Purpose Discovery",
font=("Helvetica", 32, "bold"),
text_color=self.colors["secondary"]
)
title.pack(pady=30)
return page
def create_journal_page(self):
"""Create journal page"""
page = ctk.CTkFrame(self.main_frame)
title = ctk.CTkLabel(
page,
text="Journal",
font=("Helvetica", 32, "bold"),
text_color=self.colors["secondary"]
)
title.pack(pady=30)
# Add journal entry field
journal_entry = ctk.CTkTextbox(
page,
width=800,
height=400,
font=("Helvetica", 14)
)
journal_entry.pack(pady=20)
# Save button
save_btn = ctk.CTkButton(
page,
text="Save Entry",
font=("Helvetica", 16),
fg_color=self.colors["accent"],
hover_color=self.colors["primary"]
)
save_btn.pack(pady=20)
return page
def create_progress_page(self):
"""Create progress page"""
page = ctk.CTkFrame(self.main_frame)
title = ctk.CTkLabel(
page,
text="Progress Tracking",
font=("Helvetica", 32, "bold"),
text_color=self.colors["secondary"]
)
title.pack(pady=30)
return page
def start_journey(self):
"""Start the transformation journey"""
self.show_page("👥 People Detox")
if __name__ == "__main__":
app = DetoxApp()
app.mainloop()
'''
class ProjectSetup:
def __init__(self):
self.base_dir = Path.cwd()
self.project_name = "5p_transformation"
self.project_dir = self.base_dir / self.project_name
self.requirements = [
"customtkinter==5.2.2",
"pillow==10.2.0",
"ttkthemes==3.2.2",
"matplotlib==3.7.2" # Added for analytics
]
def create_directories(self):
"""Create project directory structure"""
directories = [
"utils",
"pages",
"data",
"config",
"resources",
"docs",
"tests",
"integrations",
"widgets",
"logs"
]
for directory in directories:
dir_path = self.project_dir / directory
dir_path.mkdir(exist_ok=True)
print(f"Created directory: {directory}")
def create_entry_point(self):
"""Create the main entry point file"""
# Your existing entry_point_content here
entry_file = self.project_dir / "app.py" # Changed to app.py
with open(entry_file, 'w', encoding='utf-8') as f:
f.write(entry_point_content.strip())
print(f"Created main application file: {entry_file}")
# Create run.py
run_content = '''from app import DetoxApp
if __name__ == "__main__":
app = DetoxApp()
app.mainloop()
'''
run_file = self.project_dir / "run.py"
with open(run_file, 'w', encoding='utf-8') as f:
f.write(run_content)
print(f"Created launcher script: {run_file}")
def create_launcher(self):
"""Create launcher script"""
bat_content = '''@echo off
echo Installing requirements...
pip install -r requirements.txt
echo Starting 5P Transformation App...
python run.py
pause
'''
launcher = self.project_dir / "start.bat"
with open(launcher, 'w', newline='\r\n') as f:
f.write(bat_content)
print(f"Created launcher: {launcher}")
def install_requirements(self):
"""Install required packages"""
print("\nInstalling required packages...")
requirements_file = self.project_dir / "requirements.txt"
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", str(requirements_file)])
print("Package installation completed successfully!")
except subprocess.CalledProcessError as e:
print(f"Error installing packages: {e}")
return False
return True
def launch_app(self):
"""Launch the application"""
try:
os.chdir(self.project_dir)
if os.name == 'nt': # Windows
subprocess.Popen(["start", "cmd", "/c", "python run.py"], shell=True)
else: # Unix/Linux/Mac
subprocess.Popen(["python3", "run.py"])
print("\nApplication launched successfully!")
except Exception as e:
print(f"\nError launching app: {e}")
print("\nYou can manually launch the app by:")
print("1. Double-clicking start.bat")
print("2. Running 'python run.py'")
print("3. Running 'python app.py'")
def setup(self):
"""Run the complete setup process"""
print("\nStarting 5P Transformation App setup...")
print("=====================================")
try:
if self.project_dir.exists():
print(f"Warning: {self.project_dir} already exists.")
response = input("Do you want to continue and overwrite files? (y/n): ")
if response.lower() != 'y':
print("Setup cancelled.")
return
# Create project directory and structure
self.project_dir.mkdir(parents=True, exist_ok=True)
self.create_directories()
# Create files
self.create_entry_point()
self.create_launcher()
# Create requirements.txt
with open(self.project_dir / "requirements.txt", 'w') as f:
f.write("\n".join(self.requirements))
# Install requirements
if self.install_requirements():
print("\nSetup completed successfully!")
# Launch the app
self.launch_app()
except Exception as e:
print("\n=====================================")
print(f"Error during setup: {str(e)}")
print("Setup failed!")
sys.exit(1)
if __name__ == "__main__":
setup = ProjectSetup()
setup.setup()