radboy 0.0.714__py3-none-any.whl → 0.0.715__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/TasksMode/Tasks.py +162 -159
- radboy/TasksMode/__pycache__/Tasks.cpython-313.pyc +0 -0
- radboy/__init__.py +1 -1
- radboy/__pycache__/__init__.cpython-313.pyc +0 -0
- radboy/preloader/preloader.py +27 -364
- radboy/preloader/preloader_func.py +531 -10
- {radboy-0.0.714.dist-info → radboy-0.0.715.dist-info}/METADATA +1 -1
- {radboy-0.0.714.dist-info → radboy-0.0.715.dist-info}/RECORD +10 -10
- {radboy-0.0.714.dist-info → radboy-0.0.715.dist-info}/WHEEL +0 -0
- {radboy-0.0.714.dist-info → radboy-0.0.715.dist-info}/top_level.txt +0 -0
radboy/TasksMode/Tasks.py
CHANGED
|
@@ -365,178 +365,181 @@ class Formulae:
|
|
|
365
365
|
def __init__(self):
|
|
366
366
|
pass
|
|
367
367
|
def formulaeu(self):
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
368
|
+
with localcontext() as ctx:
|
|
369
|
+
ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
|
|
370
|
+
while True:
|
|
371
|
+
try:
|
|
372
|
+
def timedecimal_to_ampm():
|
|
373
|
+
dayHours=Prompt.__init2__(None,func=FormBuilderMkText,ptext="How many hours in a day?: ",helpText="how many hours make a day? default is 24 ",data="dec.dec")
|
|
374
|
+
if dayHours is None:
|
|
375
|
+
return
|
|
376
|
+
elif dayHours in ['d',]:
|
|
377
|
+
dayHours=Decimal('24')
|
|
378
|
+
halfday=dayHours/2
|
|
377
379
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
380
|
+
result=None
|
|
381
|
+
time_Dec=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Time Decimal: ",helpText="time of day as a decimal to convert to 12H ",data="dec.dec")
|
|
382
|
+
if time_Dec is None:
|
|
383
|
+
return
|
|
384
|
+
elif time_Dec in ['d',]:
|
|
385
|
+
time_Dec=0.0
|
|
386
|
+
ampm='am'
|
|
387
|
+
if time_Dec >= 0 and time_Dec <= dayHours:
|
|
388
|
+
if time_Dec <= halfday:
|
|
389
|
+
hours=int(time_Dec)
|
|
390
|
+
else:
|
|
391
|
+
hours=int(time_Dec-halfday)
|
|
392
|
+
ampm='pm'
|
|
393
|
+
minutes=time_Dec-int(time_Dec)
|
|
394
|
+
|
|
395
|
+
try:
|
|
396
|
+
minutes=int(minutes*60)
|
|
397
|
+
except Exception as e:
|
|
398
|
+
print(e)
|
|
399
|
+
minutes=0
|
|
400
|
+
result=f"{hours}[12H]/{int(time_Dec)}[24]:{minutes} {ampm}"
|
|
401
|
+
|
|
402
|
+
return result
|
|
400
403
|
return result
|
|
401
|
-
return result
|
|
402
404
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
405
|
+
def invert_value():
|
|
406
|
+
result=None
|
|
407
|
+
value=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Value to Invert: ",helpText="make user provided value, or formula negative (value*-1='-value')",data="dec.dec")
|
|
408
|
+
if value is None:
|
|
409
|
+
return
|
|
410
|
+
elif value in ['d',]:
|
|
411
|
+
value=0
|
|
412
|
+
result=value*-1
|
|
413
|
+
return result
|
|
412
414
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
415
|
+
def tax_rate_decimal():
|
|
416
|
+
result=None
|
|
417
|
+
tax_percent=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Tax Rate Percent: ",helpText="percent to convert to decimal (Percent/100=Rate)",data="dec.dec")
|
|
418
|
+
if tax_percent is None:
|
|
419
|
+
return
|
|
420
|
+
elif tax_percent in ['d',]:
|
|
421
|
+
tax_percent=default_taxrate/100
|
|
422
|
+
result=tax_percent/100
|
|
423
|
+
return result
|
|
422
424
|
|
|
423
|
-
|
|
425
|
+
|
|
424
426
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
for i in preloader:
|
|
449
|
-
self.options[i]=preloader[i]
|
|
450
|
-
defaults_msg=f'''
|
|
451
|
-
'''
|
|
452
|
-
'''must be last for user to always see'''
|
|
453
|
-
self.options[f'{uuid1()}']={
|
|
454
|
-
'cmds':['fcmd','findcmd','find cmd'],
|
|
455
|
-
'desc':f'Find {Fore.light_yellow}cmd{Fore.medium_violet_red} and excute for return{Style.reset}',
|
|
456
|
-
'exec':self.findAndUse2
|
|
427
|
+
self.options={
|
|
428
|
+
f'{uuid1()}':{
|
|
429
|
+
'cmds':['invert','-value','iv-val'],
|
|
430
|
+
'desc':f'{Fore.light_yellow}value{Fore.medium_violet_red} is multiplied by -1 to make inverse{Style.reset}',
|
|
431
|
+
'exec':invert_value
|
|
432
|
+
},
|
|
433
|
+
f'{uuid1()}':{
|
|
434
|
+
'cmds':['time dec to clock','t2c','time to clock'],
|
|
435
|
+
'desc':f'{Fore.light_yellow}value{Fore.medium_violet_red} convert decimal time to clock time{Style.reset}',
|
|
436
|
+
'exec':timedecimal_to_ampm
|
|
437
|
+
},
|
|
438
|
+
f'{uuid1()}':{
|
|
439
|
+
'cmds':['percent to decimal','p2d','prcnt2decimal','prcnt 2 dec'],
|
|
440
|
+
'desc':f'{Fore.light_yellow}decimal (0.02) {Fore.medium_violet_red} from percent (2%->2){Style.reset}',
|
|
441
|
+
'exec':tax_rate_decimal
|
|
442
|
+
},
|
|
443
|
+
f'{uuid1()}':{
|
|
444
|
+
'cmds':['basic counter','bcounter','countto','count to'],
|
|
445
|
+
'desc':f'{Fore.light_yellow}decimal (0.02) {Fore.medium_violet_red} from percent (2%->2){Style.reset}',
|
|
446
|
+
'exec':OAR.CountTo
|
|
447
|
+
},
|
|
457
448
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
self.options[i][
|
|
461
|
-
|
|
449
|
+
|
|
450
|
+
for i in preloader:
|
|
451
|
+
self.options[i]=preloader[i]
|
|
452
|
+
defaults_msg=f'''
|
|
453
|
+
'''
|
|
454
|
+
'''must be last for user to always see'''
|
|
455
|
+
self.options[f'{uuid1()}']={
|
|
456
|
+
'cmds':['fcmd','findcmd','find cmd'],
|
|
457
|
+
'desc':f'Find {Fore.light_yellow}cmd{Fore.medium_violet_red} and excute for return{Style.reset}',
|
|
458
|
+
'exec':self.findAndUse2
|
|
459
|
+
}
|
|
460
|
+
for num,i in enumerate(self.options):
|
|
461
|
+
if str(num) not in self.options[i]['cmds']:
|
|
462
|
+
self.options[i]['cmds'].append(str(num))
|
|
463
|
+
options=copy(self.options)
|
|
462
464
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
result=None
|
|
475
|
-
for i in options:
|
|
476
|
-
els=[ii.lower() for ii in options[i]['cmds']]
|
|
477
|
-
if cmd.lower() in els:
|
|
478
|
-
result=options[i]['exec']()
|
|
479
|
-
break
|
|
480
|
-
print(f"{result}")
|
|
481
|
-
returnResult=Prompt.__init2__(None,func=FormBuilderMkText,ptext="[Formula] Return Result?[y/n]",helpText=f"result to return is '{result}'",data="boolean")
|
|
482
|
-
if returnResult in [True,]:
|
|
483
|
-
if result is None:
|
|
465
|
+
while True:
|
|
466
|
+
helpText=[]
|
|
467
|
+
zt=len(options)
|
|
468
|
+
for num,i in enumerate(options):
|
|
469
|
+
msg=f"{Fore.light_green}{options[i]['cmds']}{Fore.light_red} -> {options[i]['desc']}{Style.reset}"
|
|
470
|
+
helpText.append(std_colorize(msg,num,zt))
|
|
471
|
+
helpText='\n'.join(helpText)
|
|
472
|
+
print(helpText)
|
|
473
|
+
print(defaults_msg)
|
|
474
|
+
cmd=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Quick Formulas|Do What?:",helpText=helpText,data="string")
|
|
475
|
+
if cmd is None:
|
|
484
476
|
return None
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
elif returnType in ['d',]:
|
|
505
|
-
if not strOnly:
|
|
506
|
-
returnType=1
|
|
507
|
-
else:
|
|
508
|
-
returnType=-1
|
|
509
|
-
break
|
|
510
|
-
#return str(result)
|
|
511
|
-
try:
|
|
512
|
-
if returnTypes[returnType] == 'float':
|
|
513
|
-
try:
|
|
514
|
-
return returnActor[returnType](result)
|
|
515
|
-
except Exception as e:
|
|
516
|
-
print(e)
|
|
517
|
-
continue
|
|
518
|
-
elif returnTypes[returnType] == 'Decimal':
|
|
519
|
-
try:
|
|
520
|
-
return returnActor[returnType](result)
|
|
521
|
-
except Exception as e:
|
|
522
|
-
print(e)
|
|
523
|
-
continue
|
|
524
|
-
elif returnTypes[returnType] == 'string':
|
|
477
|
+
result=None
|
|
478
|
+
for i in options:
|
|
479
|
+
els=[ii.lower() for ii in options[i]['cmds']]
|
|
480
|
+
if cmd.lower() in els:
|
|
481
|
+
result=options[i]['exec']()
|
|
482
|
+
break
|
|
483
|
+
print(f"{result}")
|
|
484
|
+
returnResult=Prompt.__init2__(None,func=FormBuilderMkText,ptext="[Formula] Return Result?[y/n]",helpText=f"result to return is '{result}'",data="boolean")
|
|
485
|
+
if returnResult in [True,]:
|
|
486
|
+
if result is None:
|
|
487
|
+
return None
|
|
488
|
+
else:
|
|
489
|
+
returnTypes=["float","Decimal","string","string"]
|
|
490
|
+
returnActor=[lambda x:round(float(x),4),lambda x:Decimal(x),lambda x: f"{x:.4f}",lambda x:str(x)]
|
|
491
|
+
ct=len(returnTypes)
|
|
492
|
+
returnType=None
|
|
493
|
+
htext=[]
|
|
494
|
+
strOnly=False
|
|
495
|
+
for num,i in enumerate(returnTypes):
|
|
525
496
|
try:
|
|
526
|
-
|
|
497
|
+
htext.append(std_colorize(f"{i} - {returnActor[num](result)} ",num,ct))
|
|
527
498
|
except Exception as e:
|
|
499
|
+
strOnly=True
|
|
528
500
|
print(e)
|
|
529
|
-
|
|
530
|
-
|
|
501
|
+
htext='\n'.join(htext)
|
|
502
|
+
while returnType not in range(0,ct+1):
|
|
503
|
+
print(htext)
|
|
504
|
+
returnType=Prompt.__init2__(self,func=FormBuilderMkText,ptext="Return the value as?",helpText=f"{htext}\nwhich index?",data="integer")
|
|
505
|
+
if returnType is None:
|
|
506
|
+
return None
|
|
507
|
+
elif returnType in ['d',]:
|
|
508
|
+
if not strOnly:
|
|
509
|
+
returnType=1
|
|
510
|
+
else:
|
|
511
|
+
returnType=-1
|
|
512
|
+
break
|
|
513
|
+
#return str(result)
|
|
514
|
+
try:
|
|
515
|
+
if returnTypes[returnType] == 'float':
|
|
516
|
+
try:
|
|
517
|
+
return returnActor[returnType](result)
|
|
518
|
+
except Exception as e:
|
|
519
|
+
print(e)
|
|
520
|
+
continue
|
|
521
|
+
elif returnTypes[returnType] == 'Decimal':
|
|
522
|
+
try:
|
|
523
|
+
return returnActor[returnType](result)
|
|
524
|
+
except Exception as e:
|
|
525
|
+
print(e)
|
|
526
|
+
continue
|
|
527
|
+
elif returnTypes[returnType] == 'string':
|
|
528
|
+
try:
|
|
529
|
+
return returnActor[returnType](result)
|
|
530
|
+
except Exception as e:
|
|
531
|
+
print(e)
|
|
532
|
+
continue
|
|
533
|
+
else:
|
|
534
|
+
return result
|
|
535
|
+
except Exception as e:
|
|
536
|
+
print(e)
|
|
537
|
+
print("returning as a string")
|
|
531
538
|
return result
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
return result
|
|
537
|
-
except Exception as e:
|
|
538
|
-
print(e,str(e),repr(e))
|
|
539
|
-
return None
|
|
539
|
+
return result
|
|
540
|
+
except Exception as e:
|
|
541
|
+
print(e,str(e),repr(e))
|
|
542
|
+
return None
|
|
540
543
|
|
|
541
544
|
|
|
542
545
|
def pricing(self):
|
|
Binary file
|
radboy/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION='0.0.
|
|
1
|
+
VERSION='0.0.715'
|
|
Binary file
|