radboy 0.0.771__py3-none-any.whl → 0.0.854__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of radboy might be problematic. Click here for more details.

Files changed (39) hide show
  1. radboy/Comm/RxTx.py +4 -493
  2. radboy/Comm/__pycache__/RxTx.cpython-313.pyc +0 -0
  3. radboy/CookBook/CookBook.py +4 -0
  4. radboy/DB/ExerciseTracker.py +64 -27
  5. radboy/DB/GEMINI.py +146 -0
  6. radboy/DB/Prompt.py +150 -7
  7. radboy/DB/__pycache__/ExerciseTracker.cpython-313.pyc +0 -0
  8. radboy/DB/__pycache__/Prompt.cpython-313.pyc +0 -0
  9. radboy/DB/__pycache__/db.cpython-313.pyc +0 -0
  10. radboy/DB/db.py +141 -10
  11. radboy/DayLog/DayLogger.py +1 -1
  12. radboy/DayLog/__pycache__/DayLogger.cpython-313.pyc +0 -0
  13. radboy/FB/FBMTXT.py +48 -1
  14. radboy/FB/__pycache__/FBMTXT.cpython-313.pyc +0 -0
  15. radboy/HowDoYouDefineMe/CoreEmotions.py +268 -9
  16. radboy/Lookup2/Lookup2.py +31 -1
  17. radboy/Lookup2/__pycache__/Lookup2.cpython-313.pyc +0 -0
  18. radboy/RNE/RNE.py +7 -0
  19. radboy/RNE/__pycache__/RNE.cpython-313.pyc +0 -0
  20. radboy/TasksMode/SetEntryNEU.py +16 -2
  21. radboy/TasksMode/Tasks.py +546 -101
  22. radboy/TasksMode/__pycache__/SetEntryNEU.cpython-313.pyc +0 -0
  23. radboy/TasksMode/__pycache__/Tasks.cpython-313.pyc +0 -0
  24. radboy/Unified/BACKUP.py +443 -0
  25. radboy/Unified/Unified.py +2 -321
  26. radboy/Unified/__pycache__/Unified.cpython-313.pyc +0 -0
  27. radboy/Unified/__pycache__/bareCA.cpython-313.pyc +0 -0
  28. radboy/Unified/__pycache__/clearalll.cpython-313.pyc +0 -0
  29. radboy/Unified/bareCA.py +26 -2
  30. radboy/Unified/clearalll.py +6 -0
  31. radboy/__init__.py +1 -1
  32. radboy/__pycache__/__init__.cpython-313.pyc +0 -0
  33. radboy/code.png +0 -0
  34. radboy/preloader/preloader.py +70 -0
  35. radboy/preloader/preloader_func.py +688 -2
  36. {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/METADATA +1 -1
  37. {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/RECORD +39 -37
  38. {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/WHEEL +0 -0
  39. {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/top_level.txt +0 -0
radboy/Comm/RxTx.py CHANGED
@@ -22,6 +22,7 @@ import json,sys,math,re,calendar
22
22
  import smtplib
23
23
  from email.mime.text import MIMEText
24
24
  from email.mime.multipart import MIMEMultipart
25
+ from dataclasses import dataclass
25
26
 
26
27
  def today():
27
28
  dt=datetime.now()
@@ -77,497 +78,7 @@ class MailBox(BASE,Template):
77
78
  for k in kwargs.keys():
78
79
  if k in [s.name for s in self.__table__.columns]:
79
80
  setattr(self,k,kwargs.get(k))
80
-
81
-
81
+ @dataclass
82
82
  class RxTx:
83
- htext=f"""{Fore.light_red}To send a GMAIL, your MUST have a GMAIL and a GMAIL App-Password\n{Fore.cyan}Please Note Commands can be guessed from the first match of a partial so a doWhat == 'new c' will EQUAL doWhat == 'new contact'\nGMAIL app passwords @ {Fore.light_magenta}https://myaccount.google.com/apppasswords{Style.reset}\n"""
84
- def print_help(self):
85
- print(self.htext)
86
-
87
- def resend(self):
88
- print(f"{Fore.light_yellow}Re-Send Message General [From Email Address MUST be {Fore.orange_red_1}GMAIL{Fore.light_yellow}]{Style.reset}")
89
- nmb={}
90
- nmb['Addressed_To_email']=''
91
- nmb['Addressed_From_email']=''
92
-
93
- while nmb['Addressed_To_email'] == '':
94
- print(f"{Fore.light_yellow}Please Select your addressee(s)/{Fore.green}To{Fore.light_yellow} ['b' key key throws everything out and goes back a menu]{Style.reset}")
95
- Addressed_To_email=self.searchContact(returnable=True)
96
- if Addressed_To_email == None:
97
- print(f"{Fore.light_red}No Contacts to use!{Style.reset}")
98
- return
99
- if len(Addressed_To_email) < 1:
100
- print(f"{Fore.light_red}No Contacts to use!{Style.reset}")
101
- return
102
- with Session(ENGINE) as session:
103
- which=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}which contact {Fore.light_yellow}Number(s){Style.reset}",helpText="use a dash between numbers to specify a range,commas can be between numbers or ranges",data="list")
104
- if which in [None,'d']:
105
- return
106
- for i in which:
107
- try:
108
- val=int(i)
109
- if nmb['Addressed_To_email'].split(",") == ['',]:
110
- nmb['Addressed_To_email']=','.join(list((Addressed_To_email[val].Email_Address,)))
111
-
112
- else:
113
- nmb['Addressed_To_email']=list(nmb['Addressed_To_email'].split(","))
114
- nmb['Addressed_To_email'].append(Addressed_To_email[val].Email_Address)
115
- nmb['Addressed_To_email']=','.join(list((Addressed_To_email[val].Email_Address,)))
116
- except Exception as e:
117
- print(repr(e),e,f"couldn't use {i},try next...")
118
- print(Addressed_To_email)
119
- print(i,type(i),)
120
- ap=''
121
- while nmb['Addressed_From_email'] == '':
122
- print(f"{Fore.light_yellow}Please Select your addresser/{Fore.green}From{Fore.light_yellow} ['b' key throws everything out and goes back a menu]{Style.reset}")
123
- Addressed_From_email=self.searchContact(returnable=True)
124
- if Addressed_From_email == None:
125
- print(f"{Fore.light_red}No Contacts to use!{Style.reset}")
126
- return
127
- if len(Addressed_From_email) < 1:
128
- print(f"{Fore.light_red}No Contacts to use!{Style.reset}")
129
- return
130
- with Session(ENGINE) as session:
131
- which=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}which contact {Fore.light_yellow}Number(s){Style.reset}",helpText="use a dash between numbers to specify a range,commas can be between numbers or ranges",data="integer")
132
- if which in [None,'d']:
133
- return
134
-
135
- try:
136
- val=int(i)
137
- ap=Addressed_From_email[val].app_password
138
- if nmb['Addressed_From_email'].split(",") == ['',]:
139
- nmb['Addressed_From_email']=','.join(list((Addressed_From_email[val].Email_Address,)))
140
- else:
141
- nmb['Addressed_From_email']=list(nmb['Addressed_From_email'].split(","))
142
- nmb['Addressed_From_email'].append(Addressed_From_email[val].Email_Address)
143
- nmb['Addressed_From_email']=','.join(nmb['Addressed_From_email'])
144
- except Exception as e:
145
- print(repr(e),e,f"couldn't use {i},try next...")
146
- print(Addressed_From_email)
147
- print(i,type(i),)
148
- print(f"{Fore.orange_red_1}Let's look for that email to resend.")
149
- whiches=self.showSent(returnable=True)
150
- if whiches == None:
151
- print(f"{Fore.light_red}User canceled!{Style.reset}")
152
- return
153
- elif len(whiches) < 1:
154
- print(f"{Fore.light_red}No Results!{Style.reset}")
155
- return
156
- which=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}which MailBox {Fore.light_yellow}Number(s){Style.reset}",helpText="use a dash between numbers to specify a range,commas can be between numbers or ranges",data="integer")
157
- if which in [None,'d']:
158
- return
159
-
160
- try:
161
- val=int(which)
162
-
163
- print(nmb)
164
- NewMailBox=whiches[val]
165
- session.add(NewMailBox)
166
- session.commit()
167
- session.refresh(NewMailBox)
168
- print(NewMailBox)
169
- #time to make the email
170
- msg=MIMEMultipart()
171
- msg['Subject']=NewMailBox.Title
172
- msg['From']=NewMailBox.Addressed_From_email
173
- msg['To']=NewMailBox.Addressed_To_email
174
- body=MIMEText(NewMailBox.MsgText)
175
- msg.attach(body)
176
- msg.preamble=NewMailBox.MsgText
177
-
178
- s=smtplib.SMTP_SSL('smtp.gmail.com',465)
179
- app_password=Prompt.__init2__(self,func=FormBuilderMkText,ptext="Gmail App Password",helpText="type your app password from gmail",data="string")
180
- if app_password in [None,]:
181
- print(f"{Fore.light_red}No Password; No Msg Sent!")
182
- return
183
- elif app_password.lower() == 'd':
184
- app_password=ap
185
- print(app_password)
186
- s.login(NewMailBox.Addressed_From_email,app_password)
187
- s.sendmail(NewMailBox.Addressed_From_email,NewMailBox.Addressed_To_email,msg.as_string())
188
- s.quit()
189
- except Exception as e:
190
- print(e)
191
-
192
- def newEmail(self):
193
- print(f"{Fore.light_yellow}New Message General [From Email Address MUST be {Fore.orange_red_1}GMAIL{Fore.light_yellow}]{Style.reset}")
194
- data={
195
- 'Title':{
196
- 'type':'str',
197
- 'default':'',
198
- },
199
- 'MsgText':{
200
- 'type':'str+',
201
- 'default':'',
202
- },
203
- 'DUE_DTOE':{
204
- 'type':'datetime',
205
- 'default':datetime.now(),
206
- },
207
-
208
- }
209
- nmb=FormBuilder(data=data)
210
- nmb['DTOE']=datetime.now()
211
- nmb['Addressed_To_email']=''
212
- nmb['Addressed_From_email']=''
213
-
214
- while nmb['Addressed_To_email'] == '':
215
- print(f"{Fore.light_yellow}Please Select your addressee(s)/{Fore.green}To{Fore.light_yellow} ['b' key key throws everything out and goes back a menu]{Style.reset}")
216
- Addressed_To_email=self.searchContact(returnable=True)
217
- if Addressed_To_email == None:
218
- print(f"{Fore.light_red}No Contacts to use!{Style.reset}")
219
- return
220
- if len(Addressed_To_email) < 1:
221
- print(f"{Fore.light_red}No Contacts to use!{Style.reset}")
222
- return
223
- with Session(ENGINE) as session:
224
- which=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}which contact {Fore.light_yellow}Number(s){Style.reset}",helpText="use a dash between numbers to specify a range,commas can be between numbers or ranges",data="list")
225
- if which in [None,'d']:
226
- return
227
- for i in which:
228
- try:
229
- val=int(i)
230
- if nmb['Addressed_To_email'].split(",") == ['',]:
231
- nmb['Addressed_To_email']=','.join(list((Addressed_To_email[val].Email_Address,)))
232
-
233
- else:
234
- nmb['Addressed_To_email']=list(nmb['Addressed_To_email'].split(","))
235
- nmb['Addressed_To_email'].append(Addressed_To_email[val].Email_Address)
236
- nmb['Addressed_To_email']=','.join(list((Addressed_To_email[val].Email_Address,)))
237
- except Exception as e:
238
- print(repr(e),e,f"couldn't use {i},try next...")
239
- print(Addressed_To_email)
240
- print(i,type(i),)
241
- ap=''
242
- while nmb['Addressed_From_email'] == '':
243
- print(f"{Fore.light_yellow}Please Select your addresser/{Fore.green}From{Fore.light_yellow} ['b' key throws everything out and goes back a menu]{Style.reset}")
244
- Addressed_From_email=self.searchContact(returnable=True)
245
- if Addressed_From_email == None:
246
- print(f"{Fore.light_red}No Contacts to use!{Style.reset}")
247
- return
248
- if len(Addressed_From_email) < 1:
249
- print(f"{Fore.light_red}No Contacts to use!{Style.reset}")
250
- return
251
- with Session(ENGINE) as session:
252
- which=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}which contact {Fore.light_yellow}Number(s){Style.reset}",helpText="use a dash between numbers to specify a range,commas can be between numbers or ranges",data="integer")
253
- if which in [None,'d']:
254
- return
255
-
256
- try:
257
- val=int(i)
258
- ap=Addressed_From_email[val].app_password
259
- if nmb['Addressed_From_email'].split(",") == ['',]:
260
- nmb['Addressed_From_email']=','.join(list((Addressed_From_email[val].Email_Address,)))
261
- else:
262
- nmb['Addressed_From_email']=list(nmb['Addressed_From_email'].split(","))
263
- nmb['Addressed_From_email'].append(Addressed_From_email[val].Email_Address)
264
- nmb['Addressed_From_email']=','.join(nmb['Addressed_From_email'])
265
- except Exception as e:
266
- print(repr(e),e,f"couldn't use {i},try next...")
267
- print(Addressed_From_email)
268
- print(i,type(i),)
269
-
270
- print(nmb)
271
- NewMailBox=MailBox(**nmb)
272
- session.add(NewMailBox)
273
- session.commit()
274
- session.refresh(NewMailBox)
275
- print(NewMailBox)
276
- #time to make the email
277
- msg=MIMEMultipart()
278
- msg['Subject']=NewMailBox.Title
279
- msg['From']=NewMailBox.Addressed_From_email
280
- msg['To']=NewMailBox.Addressed_To_email
281
- body=MIMEText(NewMailBox.MsgText)
282
- msg.attach(body)
283
- msg.preamble=NewMailBox.MsgText
284
-
285
- s=smtplib.SMTP_SSL('smtp.gmail.com',465)
286
- app_password=Prompt.__init2__(self,func=FormBuilderMkText,ptext="Gmail App Password",helpText="type your app password from gmail",data="string")
287
- if app_password in [None,]:
288
- print(f"{Fore.light_red}No Password; No Msg Sent!")
289
- return
290
- elif app_password.lower() == 'd':
291
- app_password=ap
292
- print(app_password)
293
- s.login(NewMailBox.Addressed_From_email,app_password)
294
- s.sendmail(NewMailBox.Addressed_From_email,NewMailBox.Addressed_To_email,msg.as_string())
295
- s.quit()
296
-
297
-
298
-
299
- def newContact(self):
300
- data={
301
- 'FName':{
302
- 'type':'str',
303
- 'default':'',
304
- },
305
- 'MName':{
306
- 'type':'str',
307
- 'default':'',
308
- },
309
- 'LName':{
310
- 'type':'str',
311
- 'default':'',
312
- },
313
- 'Suffix':{
314
- 'type':'str',
315
- 'default':'',
316
- },
317
- 'Email_Address':{
318
- 'type':'str',
319
- 'default':'',
320
- },
321
- 'app_password':{
322
- 'type':'str',
323
- 'default':'',
324
- },
325
- 'Phone_Number':{
326
- 'type':'str',
327
- 'default':'',
328
- },
329
- }
330
- newContactDict=FormBuilder(data)
331
- newContactDict['DTOE']=datetime.now()
332
- with Session(ENGINE) as session:
333
- nc=MailBoxContacts(**newContactDict)
334
- session.add(nc)
335
- session.commit()
336
- session.flush()
337
- session.refresh(nc)
338
- print(nc)
339
-
340
- def searchContact(self,returnable=False):
341
- try:
342
- while True:
343
- results=[]
344
- dateSearch=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Date Search?",helpText="If this is a date search type the date, or 'y' for a date prompt",data='datetime')
345
- if dateSearch in [None,]:
346
- return
347
- elif dateSearch in ['d',]:
348
- search=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Search?",helpText="Search text in anything else",data="string")
349
- print(search)
350
- if search in [None,]:
351
- return
352
- elif search in ['d',]:
353
- continue
354
- elif search in ['*',' ']:
355
- with Session(ENGINE) as session:
356
- results=session.query(MailBoxContacts)
357
- results=results.order_by(MailBoxContacts.LName.asc()).all()
358
- else:
359
- with Session(ENGINE) as session:
360
- results=session.query(MailBoxContacts)
361
- results=results.filter(or_(
362
- MailBoxContacts.FName.icontains(search.lower()),
363
- MailBoxContacts.MName.icontains(search.lower()),
364
- MailBoxContacts.LName.icontains(search.lower()),
365
- MailBoxContacts.Suffix.icontains(search.lower()),
366
- MailBoxContacts.Email_Address.icontains(search.lower()),
367
- MailBoxContacts.Phone_Number.icontains(search.lower())
368
- )
369
- ).order_by(MailBoxContacts.LName.asc()).all()
370
- ct=len(results)
371
- for num,i in enumerate(results):
372
- msg=f'''{Fore.light_yellow}{num}/{Fore.light_green}{num+1}/{Fore.light_red}{ct}{Style.reset} -> {i}'''
373
- print(msg)
374
- if returnable:
375
- return results
376
- #ask for search details as user wants anything but date search
377
- else:
378
- with Session(ENGINE) as session:
379
- tmp=[]
380
- DATE=date(dateSearch.year,dateSearch.month,dateSearch.day)
381
- results=session.query(MailBoxContacts).all()
382
- for num,i in enumerate(results):
383
- DTC=date(i.DTOE.year,i.DTOE.month,i.DTOE.day)
384
- if DTC == DATE:
385
- tmp.append(i)
386
- for num,i in enumerate(tmp):
387
- msg=f'''{Fore.light_yellow}{num}/{Fore.light_green}{num+1}/{Fore.light_red}{len(tmp)}{Style.reset} -> {i}'''
388
- print(msg)
389
- if returnable:
390
- return tmp
391
-
392
- except Exception as e:
393
- print(e)
394
-
395
- def rmContact(self):
396
- try:
397
- toRm=self.searchContact(returnable=True)
398
- if toRm in [[],None,'d']:
399
- return
400
- else:
401
- with Session(ENGINE) as session:
402
- which=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}Remove {Fore.light_yellow}Number(s){Style.reset}",helpText="use a dash between numbers to specify a range,commas can be between numbers or ranges",data="list")
403
- for i in which:
404
- try:
405
- val=int(i)
406
- item=session.query(MailBoxContacts).filter(MailBoxContacts.mbcid==toRm[val].mbcid).first()
407
- session.delete(item)
408
- print(item,"Deleted!")
409
- session.commit()
410
- session.flush()
411
- except Exception as e:
412
- print(e,"moving on to next index...")
413
- except Exception as e:
414
- print(e)
415
-
416
- def editContact(self):
417
- try:
418
- excludes=['mbcid',]
419
- toEdit=self.searchContact(returnable=True)
420
- if toEdit in [[],None,'d']:
421
- return
422
- else:
423
- with Session(ENGINE) as session:
424
- which=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}Edit {Fore.light_yellow}Number(s){Style.reset}",helpText="use a dash between numbers to specify a range,commas can be between numbers or ranges",data="list")
425
- for i in which:
426
- try:
427
- val=int(i)
428
- item=session.query(MailBoxContacts).filter(MailBoxContacts.mbcid==toEdit[val].mbcid).first()
429
- print(item,"To Edit!")
430
- data={}
431
- for cols in item.__table__.columns:
432
- #print(cols.name)
433
- name=str(cols.name)
434
- if name in excludes:
435
- continue
436
- data[name]={}
437
- data[name]['type']=str(cols.type).lower()
438
- data[name]['default']=getattr(item,name)
439
- upd8=FormBuilder(data=data)
440
- session.query(MailBoxContacts).filter(MailBoxContacts.mbcid==toEdit[val].mbcid).update(upd8)
441
- session.commit()
442
- session.flush()
443
- session.refresh(item)
444
-
445
- print(item,"Updated!")
446
- except Exception as e:
447
- print(e,"moving on to next index...")
448
- except Exception as e:
449
- print(e)
450
-
451
- def showSent(self,returnable=True):
452
- try:
453
- while True:
454
- results=[]
455
- dateSearch=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Date Search?",helpText="If this is a date search type the date, or 'y' for a date prompt",data='datetime')
456
- if dateSearch in [None,]:
457
- return
458
- elif dateSearch in ['d',]:
459
- search=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Search?",helpText="Search text in anything else",data="string")
460
- print(search)
461
- if search in [None,]:
462
- return
463
- elif search in ['d',]:
464
- continue
465
- elif search in ['*',' ']:
466
- with Session(ENGINE) as session:
467
- results=session.query(MailBox)
468
- results=results.all()
469
- else:
470
- with Session(ENGINE) as session:
471
- results=session.query(MailBox)
472
- results=results.filter(or_(
473
- MailBox.Title.icontains(search.lower()),
474
- MailBox.MsgText.icontains(search.lower()),
475
- MailBox.Addressed_From_email.icontains(search.lower()),
476
- MailBox.Addressed_To_email.icontains(search.lower()),
477
- )
478
- ).all()
479
- ct=len(results)
480
- for num,i in enumerate(results):
481
- msg=f'''{Fore.light_yellow}{num}/{Fore.light_green}{num+1}/{Fore.light_red}{ct}{Style.reset} -> {i}'''
482
- print(msg)
483
- if returnable:
484
- return results
485
- #ask for search details as user wants anything but date search
486
- else:
487
- with Session(ENGINE) as session:
488
- tmp=[]
489
- DATE=date(dateSearch.year,dateSearch.month,dateSearch.day)
490
- results=session.query(MailBoxContacts).all()
491
- for num,i in enumerate(results):
492
- DTC=date(i.DTOE.year,i.DTOE.month,i.DTOE.day)
493
- if DTC == DATE:
494
- tmp.append(i)
495
- DTC=date(i.DUE_DTOE.year,i.DUE_DTOE.month,i.DUE_DTOE.day)
496
- if DTC == DATE:
497
- tmp.append(i)
498
- for num,i in enumerate(tmp):
499
- msg=f'''{Fore.light_yellow}{num}/{Fore.light_green}{num+1}/{Fore.light_red}{len(tmp)}{Style.reset} -> {i}'''
500
- print(msg)
501
- if returnable:
502
- return tmp
503
- except Exception as e:
504
- print(e)
505
-
506
-
507
- def rmMailBox(self):
508
- try:
509
- toRm=self.showSent(returnable=True)
510
- if toRm in [[],None,'d']:
511
- return
512
- else:
513
- with Session(ENGINE) as session:
514
- which=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}Remove {Fore.light_yellow}Number(s){Style.reset}",helpText="use a dash between numbers to specify a range,commas can be between numbers or ranges",data="list")
515
- for i in which:
516
- try:
517
- val=int(i)
518
- item=session.query(MailBox).filter(MailBox.mbid==toRm[val].mbid).first()
519
- session.delete(item)
520
- print(item,"Deleted!")
521
- session.commit()
522
- session.flush()
523
- except Exception as e:
524
- print(e,"moving on to next index...")
525
- except Exception as e:
526
- print(e)
527
-
528
- def addCmd(self,cmdName='',cmd=None,desc=''):
529
- self.cmds[cmdName]={}
530
- self.cmds[cmdName]['desc']=desc
531
- self.cmds[cmdName]['cmd']=cmd
532
- self.htext+=f"{Fore.light_yellow}{cmdName} - {Fore.light_steel_blue}{desc}{Style.reset}\n"
533
-
534
- def __init__(self):
535
- try:
536
- self.cmds={}
537
- self.addCmd(cmdName='help',cmd=self.print_help,desc='show help text')
538
- self.addCmd(cmdName='new contact',cmd=self.newContact,desc="make a new contact for the MailBox to use")
539
- self.addCmd(cmdName='search contact',cmd=self.searchContact,desc="look for a contact")
540
- self.addCmd(cmdName='rm contact',cmd=self.rmContact,desc="remove a contact(s)")
541
- self.addCmd(cmdName='rm mailbox',cmd=self.rmMailBox,desc="remove a MailBox Msg")
542
- self.addCmd(cmdName="edit contact",cmd=self.editContact,desc="edit a contact(s)")
543
- self.addCmd(cmdName="new mb",cmd=self.newEmail,desc="create and send a new email msg")
544
- self.addCmd(cmdName="show sent",cmd=self.showSent,desc="show sent emails")
545
- self.addCmd(cmdName="resend",cmd=self.resend,desc="resend a sent email")
546
- self.print_help()
547
- while True:
548
- keys=[i.lower() for i in self.cmds.keys()]
549
- real=[self.cmds[i]['cmd'] for i in self.cmds.keys()]
550
- fieldname='Menu'
551
- mode='RxTx'
552
- h=f'{Prompt.header.format(Fore=Fore,mode=mode,fieldname=fieldname,Style=Style)}'
553
- doWhat=Prompt.__init2__(self,func=FormBuilderMkText,ptext=f'{h} Do What? ',helpText=self.htext,data="string")
554
- if doWhat in [None,]:
555
- return
556
- elif doWhat in ['d',]:
557
- self.print_help()
558
- elif doWhat.lower() in keys:
559
- index=keys.index(doWhat.lower())
560
- real[index]()
561
- else:
562
- for num,i in enumerate(keys):
563
- if doWhat.lower() in i:
564
- real[num]()
565
- break
566
-
567
-
568
- except Exception as e:
569
- print(e,repr(e))
570
-
571
- MailBox.metadata.create_all(ENGINE)
572
- MailBoxContacts.metadata.create_all(ENGINE)
573
- #RxTx()
83
+ def __init__(self,*args,**kwargs):
84
+ print("This Class Has been depreacated and a new option will be designed. no more gmail. bleh!")
@@ -384,6 +384,10 @@ class CookBookUi:
384
384
  ct=len(results_2)
385
385
  for num,i in enumerate(results_2):
386
386
  print(std_colorize(i,num,ct))
387
+ page=Control(func=FormBuilderMkText,ptext="Next?",helpText="next result!",data="boolean")
388
+ if page in [None,'NaN']:
389
+ return
390
+
387
391
  except Exception as e:
388
392
  print(e)
389
393
 
@@ -41,7 +41,7 @@ class Exercise(BASE,Template):
41
41
  __tablename__="Exercise"
42
42
  exid=Column(Integer,primary_key=True)
43
43
  Name=Column(String,default=f'Generic Exercise Name [{nanoid.generate()}]')
44
- Note=Column(String,default='')
44
+ Note=Column(String,default=json.dumps({'completed':0}))
45
45
  Reps=Column(Integer,default=1) # 8 reps of 30 repcounts NAME
46
46
  RepCount=Column(Integer,default=30) #30 times rep
47
47
  CurrentRep=Column(Integer,default=0)
@@ -255,10 +255,6 @@ class ExerciseTracker:
255
255
  'default':'',
256
256
  'type':'string',
257
257
  },
258
- 'Note':{
259
- 'default':'',
260
- 'type':'string',
261
- },
262
258
  }
263
259
  routine=FormBuilder(data=data_r)
264
260
  while True:
@@ -280,13 +276,37 @@ class ExerciseTracker:
280
276
  nt=gethpv(routine)
281
277
  #print(nt)
282
278
  nt+=1
283
- rts=Routine(Name=routine.get("Name"),Note=routine.get("Note"),exid=i.exid,precedence=nt,doe=doe,dtoe=dtoe,toe=toe)
279
+ rts=Routine(Name=routine.get("Name"),Note=json.dumps({'completed':0}),exid=i.exid,precedence=nt,doe=doe,dtoe=dtoe,toe=toe)
284
280
  session.add(rts)
285
281
  session.commit()
282
+ session.refresh(rts)
283
+ '''
284
+ self.clearRoutine(rts)
286
285
  #print(gethpv(routine))
286
+ rout[num].Note=json.dumps({'completed':0})
287
+ session.commit()
288
+ session.flush()
289
+ session.refresh(rout[num])
290
+ '''
287
291
  else:
288
292
  pass
293
+ def reset_routine(self):
294
+ if not shield(self,mode='ExerciseTracker',fieldname='Routine',action_text='Delete All Routines'):
295
+ with Session(ENGINE) as session:
296
+ session.query(Routine).delete()
297
+ session.commit()
298
+ print(f"Remaining Routines: {session.query(Routine).count()}")
289
299
 
300
+ def reset_exercises(self):
301
+ if not shield(self,mode='ExerciseTracker',fieldname='Exercise',action_text='Delete All Exercises'):
302
+ with Session(ENGINE) as session:
303
+ session.query(Exercise).delete()
304
+ session.commit()
305
+ print(f"Remaining Exercises: {session.query(Exercise).count()}")
306
+
307
+ def reset_er(self):
308
+ self.reset_exercises()
309
+ self.reset_routine()
290
310
 
291
311
  def Add2Routine(self):
292
312
  with Session(ENGINE) as session:
@@ -519,7 +539,7 @@ class ExerciseTracker:
519
539
  name,note,exid=ex.Name,ex.Note,ex.exid
520
540
  else:
521
541
  name,note,exid="NotFound?","NotFound?","NotFound?"
522
- msg=f"{Fore.light_yellow}{num}/{Fore.light_red}{ct}{Style.reset}{Fore.light_steel_blue} -> {r.Name} (roid={r.roid}) Exercise(Name='{name}',Note='{note}',exid='{exid}'){Style.reset}"
542
+ msg=f"{Fore.light_yellow}{num}/{Fore.light_red}{ct}{Style.reset}{Fore.light_steel_blue} -> {r.Name} (roid={r.roid},exid={exid}) Exercise(Name='{name}',Note='{note}',exid='{exid}'){Style.reset}"
523
543
  print(msg)
524
544
  if returnable:
525
545
  lite.append(r.Name)
@@ -532,21 +552,25 @@ class ExerciseTracker:
532
552
 
533
553
  def useRoutine(self,reset_only=False,reset_note=False):
534
554
  try:
555
+
535
556
  logMe=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Log a comment in HealthLog(hl[default=True/Yes])?",helpText="yes or no/boolean",data="boolean")
536
557
  if logMe is None:
537
558
  return
538
559
  elif logMe in ['d',]:
539
560
  logMe=True
540
-
561
+
541
562
  start=datetime.now()
542
563
  rs=self.viewRoutine(returnable=True)
543
564
  if rs == None:
544
565
  return
566
+
567
+
545
568
  whichList=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Which Routine would you like to use?",helpText="first number of a line",data="list")
546
569
  if whichList in ['d']:
547
570
  whichList=[]
548
571
  elif whichList in [None,]:
549
572
  return
573
+
550
574
  for which in whichList:
551
575
  try:
552
576
  which=int(which)
@@ -584,10 +608,10 @@ class ExerciseTracker:
584
608
 
585
609
  if reset_note:
586
610
  for num, i in enumerate(rout):
587
- rout[num].Note=json.dumps({'completed':0})
588
- session.commit()
589
- session.flush()
590
- session.refresh(rout[num])
611
+ rout[num].Note=json.dumps({'completed':0})
612
+ session.commit()
613
+ session.flush()
614
+ session.refresh(rout[num])
591
615
  if reset_only:
592
616
  #resume
593
617
  if logMe:
@@ -717,20 +741,27 @@ class ExerciseTracker:
717
741
  h=f'{Prompt.header.format(Fore=Fore,mode=mode,fieldname=fieldname,Style=Style)}'
718
742
  header='{Fore.grey_70}[{Fore.light_steel_blue}{mode}{Fore.medium_violet_red}@{Fore.light_green}{fieldname}{Fore.grey_70}]{Style.reset}{Fore.light_yellow} '
719
743
 
720
- helpText=f'''
721
- ne,NewExercise - create a new exercise
722
- re,RemoveExercise - delete an exercise
723
- se,SearchExercise - search for an exercise from it's Note,Name, or ID
724
- ee,EditExercise - edit an exercise
725
- nr,NewRoutine - a new routine of exercises
726
- vr,ViewRoutines - show available routines
727
- vrl,ViewRoutines - show available routines and their exercises as a list
728
- a2r,add2routine - add an exercise to a routine specified by RID
729
- ur,UseRoutine - use a set routine
730
- rr,RemoveRoutine - delete a routine
731
- cr,ClearRoutine - reset routine CurrentRep
732
- su,summarize,Summarize - show the contents of a specified Routine
733
- '''
744
+ helpText=f'''{Fore.light_green}Exercises{Fore.grey_70}
745
+ ** ne,NewExercise - create a new exercise
746
+ ** re,RemoveExercise - delete an exercise
747
+ ** se,SearchExercise - search for an exercise from it's Note,Name, or ID
748
+ ** ee,EditExercise - edit an exercise
749
+ {Fore.dark_goldenrod}Routines{Fore.grey_70}
750
+ ** nr,NewRoutine - a new routine of exercises
751
+ ** vr,ViewRoutines - show available routines
752
+ ** vrl,ViewRoutines - show available routines and their exercises as a list
753
+ ** a2r,add2routine - add an exercise to a routine specified by RID
754
+ ** ur,UseRoutine - use a set routine
755
+ ** rr,RemoveRoutine - delete a routine
756
+ ** cr,ClearRoutine - reset routine CurrentRep
757
+ ** su,summarize,Summarize - show the contents of a specified Routine
758
+ {Fore.orange_red_1}DANGER{Fore.grey_70}
759
+ ** rst rtn,reset routine,reset-routine - delete all routines {Fore.light_red}ONLY{Fore.grey_70}
760
+ ** rst ex,reset exercises,reset-exercises - delete all exercises {Fore.light_red}ONLY{Fore.grey_70}
761
+ ** rst a,reset all,reset-all - delete {Fore.dark_goldenrod}<{Fore.orange_red_1}<<{Fore.medium_violet_red}<<{Fore.light_cyan}Everything{Fore.medium_violet_red}>>{Fore.orange_red_1}>>{Fore.dark_goldenrod}> {Fore.cyan} in the ExerciseTracker!
762
+ {Fore.light_salmon_1}WARNING{Fore.grey_70}
763
+ ignore '**' ; this is not part of the cmd; it's just a bullet point representation.
764
+ {Style.reset}'''
734
765
  while True:
735
766
  doWhat=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{h} Do what?",helpText=helpText,data="string")
736
767
  if doWhat in [None,]:
@@ -763,4 +794,10 @@ class ExerciseTracker:
763
794
  elif doWhat.lower() in "su,summarize".split(","):
764
795
  self.summarize()
765
796
  elif doWhat.lower() in 'a2r,add2routine'.split(","):
766
- self.Add2Routine()
797
+ self.Add2Routine()
798
+ elif doWhat.lower() in 'rst rtn,reset routine,reset-routine'.split(','):
799
+ self.reset_routine()
800
+ elif doWhat.lower() in 'rst ex,reset exercises,reset-exercises'.split(','):
801
+ self.reset_exercises()
802
+ elif doWhat.lower() in 'rst a,reset all,reset-all'.split(','):
803
+ self.reset_er()