This repository has been archived by the owner on Oct 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
guide.py
463 lines (442 loc) · 18.4 KB
/
guide.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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
from datetime import datetime, timedelta
import os, json, io, sys, re , progress
from uptils import foldermaker, colors
from uptils.clearterminal import clear_terminal
from estimations import estimation, freeplanner, xestimation, bookplanner, lectureplanner, goalplanner
from modules import (activity, calendar, daycalculator, endeavor,
flashcard, newbook, notes, project, tasks,
repetition, subjects, weighttracker , videolecture,
streaks, schedule, tgbot, personalplanner)
start_file = os.path.join(colors.notes_file, 'start.json')
def telegram_status_print():
original_stdout = sys.stdout
sys.stdout = io.StringIO()
goalplanner.tracker_greedy(rint=True)
estimation.tracker_greedy(rint=True)
xestimation.tracker_greedy(rint=True)
lectureplanner.tracker_greedy(rint=True)
freeplanner.tracker_greedy()
bookplanner.tracker_greedy(rint=True)
print("#work🏮🎈")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
repetition.show_reminders()
print("#spaced_repetition #repetition #reminders🕐🕠🕘")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
today_index = (datetime.today().weekday() + 2) % 7
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
endeavor.show_endeavors()
print("#endeavors #routine🌀🧘♂️")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
schedule.todaysboxes(addrem=False)
print("#boxes📦🐍")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
streaks.show_streaks()
print("#goals #subgoals #streaks🎯⭐️")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
tasks.taskfile(show=False)
print("#tasks #deadline ⚠️⚠️")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
current_date = datetime.now().strftime('%d-%m-%Y')
calendar.display_calendar(current_date,printtrue=False)
print("#calendar 🗓📅")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
schedule.show_tasks()
print("#tasks #jobdb 📔🎸")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
schedule.sum_and_show_tag_percentages()
print("#work #hours ⏰ 🕒 ")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
tgbot.pytelbot("Have a Great day✨🕊🙏🏻")
except:
pass
def main():
try:
tgbot.check_and_update_json()
except:
pass
activity.check_work_finished()
start_time = None
if os.path.exists(start_file):
with open(start_file, "r") as file:
start_data = json.load(file)
start_time = datetime.strptime(start_data["start_time"], "%Y-%m-%d %H:%M:%S")
if start_time:
if start_time.date() != datetime.now().date():
start_time = None
os.remove(start_file)
clear_terminal()
while True:
#print("{:+^80}\n".format(""))
print(colors.WWITE+"\n")
print(colors.space*9+"{:^80}".format("VISION GUIDE"))
#print("{:+^84}".format(""))
print(colors.space*7+colors.plus*42)
print(colors.space*7+"‖{:<39}‖{:<42}‖".format(" a. activity - activity log", " t. project - project estimation(t/tfbv)"))
print(colors.space*7+"‖{:<39}‖{:<42}‖".format(" y. streaks - streak tracker", " tg. goals - macro-goal setting"))
print(colors.space*7+"‖{:<39}‖{:<42}‖".format(" d. Endeavor - daily planner", " k. tasks - kanban board"))
print(colors.space*7+"‖{:<39}‖{:<42}‖".format(" s. schedule - weekly schedule", " r. remind - spaced repetition"))
print(colors.space*7+colors.plus+colors.line*19+" "+colors.line*21+colors.plus)
print(colors.space*7+"‖{:<39}‖{:<42}‖".format(" b. books - current books repo(n)", " m. flashcard - language flashcard"))
print(colors.space*7+"‖{:<39}‖{:<42}‖".format(" v. video - video lecture", " p. project - project automation"))
print(colors.space*7+"‖{:<39}‖{:<42}‖".format(" u. subject - subject selector", " w. weight - weight tracker"))
print(colors.space*7+colors.plus+colors.line*19+" "+colors.line*21+colors.plus)
print(colors.space*7+"‖{:<39}‖{:<42}‖".format(" c. calendar - calendar program", " e. task - show active task(f)"))
print(colors.space*7+"‖{:<39}‖{:<42}‖".format(" j. date - change cycle date", " d. old Endeavor "))
print(colors.space*7+"‖"+colors.plus*19+" "+colors.plus*21+"‖")
print("")
print(colors.space*7+"{:<50}{:>30}".format(f"{daycalculator.days} days left {daycalculator.tldata()}", f"Today is {daycalculator.weektoday}"))
#print(f"hours in a week is {daycalculator.sum_values}, estimated work is {daycalculator.todayhours} hour and {round(books.pages_per_today)} pages.")
try:
if activity.work_finished == False:
print()
schedule.print_first_entry_from_json()
if start_time:
time_elapsed = str(datetime.now() - start_time).split('.')[0]
print(f"{colors.space*7}{colors.CYAN}Start Time: {colors.WWITE}{start_time.strftime('%H:%M:%S')}{colors.CYAN} - Elapsed Time: {colors.WWITE}{str(time_elapsed)}{colors.RESET}")
else:
print(f"{colors.space*7}{colors.RED}Start Button{colors.RESET} - {colors.YELLOW}Press [sa] {colors.RESET}{colors.YELLOW}to start the button.{colors.RESET}")
#activity.calculate_activity_rating()
activity.check_work_finished()
else:
activity.check_work_finished()
progress.check_trackers()
print(colors.space*7+colors.cline*15)
print(colors.space*7+colors.folder+"(tr) trackers"+colors.space*7+colors.folder+"(re) reminders")
print(colors.space*7+colors.folder+"(ta) tasks"+colors.space*10+colors.folder2+"(sf) streaks")
print(colors.space*7+colors.folder2+"(sc/fpc) schedule"+colors.space*3+colors.folder2+"(ro) routine")
print(colors.space*7+colors.folder2+"(nn) notes"+colors.space*10+"🚪"+"(q) quit")
except:
print("\n\nERROR: PROCESS UNIDENTIFIED")
print(f"\n{colors.space*7}time left till end of the day: {daycalculator.hours} hours, {daycalculator.minutes} minutes.")
select = input(colors.space*7+"what you wanna do(cc to clock out/show/push)?: ")
if select == "show":
clear_terminal()
print("-"*98)
schedule.show_schedule_by_time(print_output=True)
schedule.calculate_and_print_free_hours()
schedule.schedleft()
clear_terminal()
try:
goalplanner.tracker_greedy(rint=True)
estimation.tracker_greedy(rint=True)
xestimation.tracker_greedy(rint=True)
lectureplanner.tracker_greedy(rint=True)
freeplanner.tracker_greedy()
bookplanner.tracker_greedy(rint=True)
except:
print("\n\nERROR: PROCESS UNIDENTIFIED")
input(f"\n\n{colors.space*3}{colors.YELLOW}press any key to continue...{colors.RESET}")
clear_terminal()
print("-"*98)
current_date = datetime.now().strftime('%d-%m-%Y')
calendar.display_calendar(current_date,printtrue=False)
input(f"\n\n{colors.space*3}{colors.YELLOW}press any key to continue...{colors.RESET}")
clear_terminal()
print("-"*98)
streaks.show_streaks()
schedule.show_tasks()
input(f"\n\n{colors.space*3}{colors.YELLOW}press any key to continue...{colors.RESET}")
clear_terminal()
print("-"*98)
schedule.todaysboxes(addrem=False)
input(f"{colors.YELLOW}\n\nPress any key to continue...{colors.RESET}")
clear_terminal()
print("-"*98)
endeavor.show_endeavors()
input(f"{colors.YELLOW}Press any key to continue...{colors.RESET}")
clear_terminal()
print("-"*98)
repetition.show_reminders()
input(f"\n\n{colors.space*3}{colors.YELLOW}press any key to continue...{colors.RESET}")
clear_terminal()
tasks.taskfile(show=False)
input("\n\nPress any key to continue...")
clear_terminal()
elif select == "push":
telegram_status_print()
clear_terminal()
elif select == "d":
clear_terminal()
personalplanner.main()
elif select == "dd":
clear_terminal()
endeavor.main()
elif select == "k":
clear_terminal()
tasks.main()
elif select == "teleg":
clear_terminal()
tgbot.check_and_update_json()
elif select == "e":
clear_terminal()
schedule.select_task_from_jobs()
clear_terminal()
elif select == "fd":
clear_terminal()
schedule.show_and_mark_tasks()
clear_terminal()
elif select == "f":
schedule.swap_tasks_in_jobdb()
clear_terminal()
elif select == "sc":
clear_terminal()
print(f"\n\n{schedule.get_schedule_output(lastl=False)}")
input(f"\n{colors.space*3}{colors.YELLOW}press any key to continue...{colors.RESET}")
clear_terminal()
elif select == "scp":
clear_terminal()
schedule.plot_schedule()
clear_terminal()
elif select == "scc":
clear_terminal()
schedule.schedleft()
clear_terminal()
elif select == "scf":
clear_terminal()
schedule.calculate_and_print_free_hours()
input(f"\n{colors.space*2}{colors.YELLOW}Press any key to continue...{colors.RESET}")
clear_terminal()
elif select == "sf":
clear_terminal()
streaks.show_streaks()
input(f"{colors.YELLOW}\n\n{colors.space*5}Press any key to continue...")
clear_terminal()
elif select == "re":
clear_terminal()
repetition.show_reminders()
input(f"\n\n{colors.space*3}{colors.YELLOW}press any key to continue...{colors.RESET}")
clear_terminal()
elif select == "s":
clear_terminal()
schedule.main()
clear_terminal()
elif select == "ro":
clear_terminal()
endeavor.show_endeavors()
input(f"{colors.YELLOW}Press any key to continue...{colors.RESET}")
clear_terminal()
elif select == "sa":
clear_terminal()
try:
tgbot.pytelbot("🔥 Good Day! May you Seize the day with confidence and purpose! 💪✨")
except:
pass
todaysch = "\n\n"+"your today's schedule is:\n"+schedule.remove_color_codes(schedule.get_schedule_output(lastl=True))
try:
tgbot.pytelbot(todaysch)
except:
pass
telegram_status_print()
start_time = datetime.now()
start_data = {"start_time": start_time.strftime("%Y-%m-%d %H:%M:%S")}
with open(start_file, "w") as file:
json.dump(start_data, file)
elif select == "ta":
clear_terminal()
tasks.taskfile(show=False)
input("\n\nPress any key to continue...")
clear_terminal()
elif select == "cc":
choices = input(colors.space*7+"Are you sure(y/n)? ")
if choices.lower() == 'y':
try:
activity.calculate_and_save_activity_rating()
original_stdout = sys.stdout
sys.stdout = io.StringIO()
activity.calculate_activity_rating()
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
try:
tgbot.pytelbot(function_output)
tgbot.pytelbot("Congrats! what a day to be alive💫💫")
except:
pass
original_stdout = sys.stdout
sys.stdout = io.StringIO()
schedule.sum_and_show_tag_percentages()
print("#work #hours ⏰ 🕒 ")
function_output = sys.stdout.getvalue()
sys.stdout = original_stdout
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
function_output_cleaned = ansi_escape.sub('', function_output)
try:
tgbot.pytelbot(function_output_cleaned)
except:
pass
except:
clear_terminal()
else:
clear_terminal()
elif select == "tr":
clear_terminal()
try:
goalplanner.tracker_greedy(rint=True)
estimation.tracker_greedy(rint=True)
xestimation.tracker_greedy(rint=True)
lectureplanner.tracker_greedy(rint=True)
freeplanner.tracker_greedy()
bookplanner.tracker_greedy(rint=True)
except:
print("\n\nERROR: PROCESS UNIDENTIFIED")
input(f"\n\n{colors.space*3}{colors.YELLOW}press any key to continue...{colors.RESET}")
clear_terminal()
elif select == "p":
clear_terminal()
project.main()
elif select == "t":
clear_terminal()
estimation.main()
elif select == "tt":
clear_terminal()
xestimation.main()
elif select == "tb":
clear_terminal()
bookplanner.main()
elif select == "tv":
clear_terminal()
lectureplanner.main()
elif select == "tg":
clear_terminal()
goalplanner.main()
elif select == "tf":
clear_terminal()
freeplanner.main()
elif select == "v":
clear_terminal()
videolecture.main()
clear_terminal()
elif select =="td":
clear_terminal()
progress.check_today()
input(f"\n{colors.space*3}{colors.YELLOW}press any key to continue...{colors.RESET}")
clear_terminal()
elif select == "a":
clear_terminal()
activity.main()
elif select == "nn":
clear_terminal()
schedule.edit_notes(files=True)
clear_terminal()
elif select == "r":
clear_terminal()
repetition.main()
elif select == "u":
clear_terminal()
subjects.main()
elif select == "b":
clear_terminal()
newbook.main()
elif select == "m":
clear_terminal()
flashcard.main()
elif select == "c":
clear_terminal()
calendar.main()
elif select == "j":
clear_terminal()
daycalculator.save_date_to_json()
daycalculator.save_tilldata()
clear_terminal()
print("!day changed, please reload the program\n")
elif select == "n":
clear_terminal()
notes.main()
elif select == "w":
clear_terminal()
weighttracker.main()
elif select == "y":
clear_terminal()
streaks.main()
elif select == "q":
clear_terminal()
break
else:
clear_terminal()
if __name__ == '__main__':
main()