radboy 0.0.825__py3-none-any.whl → 0.0.827__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.
- radboy/Comm/RxTx.py +4 -493
- radboy/Comm/__pycache__/RxTx.cpython-313.pyc +0 -0
- radboy/TasksMode/Tasks.py +2 -0
- radboy/TasksMode/__pycache__/Tasks.cpython-313.pyc +0 -0
- radboy/Unified/BACKUP.py +436 -0
- radboy/Unified/Unified.py +2 -328
- radboy/Unified/__pycache__/Unified.cpython-313.pyc +0 -0
- radboy/__init__.py +1 -1
- radboy/__pycache__/__init__.cpython-313.pyc +0 -0
- {radboy-0.0.825.dist-info → radboy-0.0.827.dist-info}/METADATA +1 -1
- {radboy-0.0.825.dist-info → radboy-0.0.827.dist-info}/RECORD +13 -12
- {radboy-0.0.825.dist-info → radboy-0.0.827.dist-info}/WHEEL +0 -0
- {radboy-0.0.825.dist-info → radboy-0.0.827.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
|
-
|
|
84
|
-
|
|
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!")
|
|
Binary file
|
radboy/TasksMode/Tasks.py
CHANGED
|
@@ -52,6 +52,7 @@ from radboy.DB.NW.NetWorth import *
|
|
|
52
52
|
from decimal import Decimal as DEC
|
|
53
53
|
from radboy.DB.lsToday import *
|
|
54
54
|
from radboy.DB.GEMINI import *
|
|
55
|
+
from radboy.Unified.BACKUP import *
|
|
55
56
|
|
|
56
57
|
def today():
|
|
57
58
|
dt=datetime.now()
|
|
@@ -6124,6 +6125,7 @@ where:
|
|
|
6124
6125
|
'''
|
|
6125
6126
|
self.clear_all=lambda self=self:clear_all(self)
|
|
6126
6127
|
if not init_only:
|
|
6128
|
+
BACKUP.daemon(None)
|
|
6127
6129
|
while True:
|
|
6128
6130
|
def mkT(text,self):
|
|
6129
6131
|
return text
|
|
Binary file
|