radboy 0.0.713__py3-none-any.whl → 0.0.714__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.

@@ -20,6 +20,9 @@ def CountTo():
20
20
  }
21
21
  start=datetime.now()
22
22
  data=FormBuilder(data=fd)
23
+ if data is None:
24
+ print("bad parameters!")
25
+ return
23
26
  absolute_start=False
24
27
  useLast=False
25
28
  while True:
@@ -41,6 +44,9 @@ def CountTo():
41
44
  }
42
45
  start=datetime.now()
43
46
  data=FormBuilder(data=fd)
47
+ if data is None:
48
+ print("bad parameters!")
49
+ return
44
50
  absolute_start=False
45
51
  if useLast:
46
52
  print("using last setup!")
radboy/DB/Prompt.py CHANGED
@@ -26,7 +26,7 @@ import lzma,base64
26
26
  from Crypto.Cipher import AES
27
27
  #from Cryptodome.Cipher import AES
28
28
  from Crypto.Util.Padding import pad, unpad
29
- from decimal import Decimal,localcontext
29
+ from decimal import Decimal,localcontext,getcontext
30
30
  import biip
31
31
  import itertools
32
32
  from inputimeout import inputimeout, TimeoutOccurred
@@ -2469,6 +2469,18 @@ class Prompt(object):
2469
2469
  print(helpText)
2470
2470
  continue
2471
2471
  elif cmd.lower() in generate_cmds(startcmd=['precision','prcsn'],endCmd=['set','st','=']):
2472
+ toplvl=Control(func=FormBuilderMkText,ptext="Is this for everything globally(False)?",helpText="boolean",data="boolean")
2473
+ if toplvl in ['NaN',None]:
2474
+ continue
2475
+ elif toplvl in ['d',]:
2476
+ toplvl=False
2477
+
2478
+ saveIt=Control(func=FormBuilderMkText,ptext="Save to settings(False)?",helpText="boolean",data="boolean")
2479
+ if saveIt in ['NaN',None]:
2480
+ continue
2481
+ elif saveIt in ['d',]:
2482
+ saveIt=False
2483
+
2472
2484
  value=Control(func=FormBuilderMkText,ptext="How many digits of precision?",helpText=f"1-{decimal.MAX_PREC}",data="integer")
2473
2485
  if value in ['NaN',None]:
2474
2486
  continue
@@ -2477,7 +2489,12 @@ class Prompt(object):
2477
2489
  elif value < 1:
2478
2490
  print("invalid value")
2479
2491
  continue
2480
- PROMPT_CONTEXT.prec=value
2492
+ if not toplvl:
2493
+ PROMPT_CONTEXT.prec=value
2494
+ else:
2495
+ getcontext().prec=value
2496
+ if saveIt:
2497
+ PROMPT_CONTEXT.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",value,setValue=True,literal=False))
2481
2498
  continue
2482
2499
  elif cmd.lower() in generate_cmds(startcmd=['simple','smpl'],endCmd=['scanner','scanr','scnnr','scnr']):
2483
2500
  TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).simple_scanner()
radboy/FB/FormBuilder.py CHANGED
@@ -13,6 +13,7 @@ from datetime import date,time,datetime
13
13
  from radboy.FB.FBMTXT import *
14
14
  from copy import copy
15
15
  from radboy.DB import db as DB
16
+ from decimal import localcontext
16
17
 
17
18
  def findAndSelectKey(options=None):
18
19
  if options is None:
@@ -64,309 +65,311 @@ def findAndSelectKey(options=None):
64
65
  print(e)
65
66
 
66
67
  def FormBuilder(data,extra_tooling=False,passThruText=None):
67
- if passThruText != None:
68
- passThruText=f"{Fore.light_green}{passThruText}: {Fore.light_yellow}"
69
- GOTOK=None
70
- def keys_index(data):
71
- for num,k in enumerate(data.keys()):
72
- msg=f"{Fore.light_cyan}{num}/{Fore.light_magenta}{num+1}{Fore.light_steel_blue} of {Fore.light_red}{len(data.keys())}{Fore.medium_violet_red} as {Fore.light_green}{k}:{Fore.cyan}{data[k]['type']}={Fore.magenta}{data[k]['default']}{Style.reset}"
73
- print(msg)
68
+ with localcontext() as ctx:
69
+ ctx.prec=ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
70
+ if passThruText != None:
71
+ passThruText=f"{Fore.light_green}{passThruText}: {Fore.light_yellow}"
72
+ GOTOK=None
73
+ def keys_index(data):
74
+ for num,k in enumerate(data.keys()):
75
+ msg=f"{Fore.light_cyan}{num}/{Fore.light_magenta}{num+1}{Fore.light_steel_blue} of {Fore.light_red}{len(data.keys())}{Fore.medium_violet_red} as {Fore.light_green}{k}:{Fore.cyan}{data[k]['type']}={Fore.magenta}{data[k]['default']}{Style.reset}"
76
+ print(msg)
74
77
 
75
- def setGOTOK(GOTOK):
76
- gotoi=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What index do you wish to goto?",helpText=f"please type an integer between 0 to {len(data.keys())-1}",data="integer")
77
- if gotoi in [None,]:
78
- return
79
- elif gotoi in ['d',]:
80
- pass
81
- else:
82
- try:
83
- keys=data.keys()
84
- GOTOK=list(keys)[gotoi]
85
- print(GOTOK)
86
- return GOTOK
87
- except Exception as e:
88
- print(e)
89
- print(f"Index {gotoi} not found in {data} in its keys-list indexes: {data.keys()}")
90
-
91
- def setGOTOK_str(data):
92
- while True:
93
- gotoi=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What key do you wish to goto?",helpText=f"please type the key you want to goto",data="string")
78
+ def setGOTOK(GOTOK):
79
+ gotoi=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What index do you wish to goto?",helpText=f"please type an integer between 0 to {len(data.keys())-1}",data="integer")
94
80
  if gotoi in [None,]:
95
81
  return
96
82
  elif gotoi in ['d',]:
97
83
  pass
98
84
  else:
99
85
  try:
100
- test=data[gotoi]
101
- return gotoi
86
+ keys=data.keys()
87
+ GOTOK=list(keys)[gotoi]
88
+ print(GOTOK)
89
+ return GOTOK
102
90
  except Exception as e:
103
91
  print(e)
104
- print(f"Key {gotoi} not found in {data} in its keys {data.keys()}")
105
- index=None
106
- item={}
107
- for num,k in enumerate(data.keys()):
108
- item[k]=data[k]['default']
109
- review=False
110
- finalize=False
111
- finish=False
112
- while True:
113
- if finalize:
114
- break
92
+ print(f"Index {gotoi} not found in {data} in its keys-list indexes: {data.keys()}")
93
+
94
+ def setGOTOK_str(data):
95
+ while True:
96
+ gotoi=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What key do you wish to goto?",helpText=f"please type the key you want to goto",data="string")
97
+ if gotoi in [None,]:
98
+ return
99
+ elif gotoi in ['d',]:
100
+ pass
101
+ else:
102
+ try:
103
+ test=data[gotoi]
104
+ return gotoi
105
+ except Exception as e:
106
+ print(e)
107
+ print(f"Key {gotoi} not found in {data} in its keys {data.keys()}")
108
+ index=None
109
+ item={}
110
+ for num,k in enumerate(data.keys()):
111
+ item[k]=data[k]['default']
112
+ review=False
113
+ finalize=False
114
+ finish=False
115
115
  while True:
116
116
  if finalize:
117
117
  break
118
- for num,k in enumerate(data.keys()):
119
- if GOTOK != None:
120
- print(k,GOTOK)
121
- if k != GOTOK:
122
- continue
123
- else:
124
- GOTOK=None
125
- if isinstance(index,int):
126
- if num < index:
127
- continue
118
+ while True:
119
+ if finalize:
120
+ break
121
+ for num,k in enumerate(data.keys()):
122
+ if GOTOK != None:
123
+ print(k,GOTOK)
124
+ if k != GOTOK:
125
+ continue
126
+ else:
127
+ GOTOK=None
128
+ if isinstance(index,int):
129
+ if num < index:
130
+ continue
131
+ else:
132
+ index=None
133
+ ht=''
134
+ if data[k]['type'].lower() in ['date','datetime','time']:
135
+ ht="type 'y' or 'n' to start"
136
+ elif data[k]['type'].lower() in ['list']:
137
+ ht="type your $DELIMITED list, the you will be asked for $DELIMITED character to use!"
138
+ elif data[k]['type'].lower() in ['bool','boolean']:
139
+ ht="type y|yes|t|true|1 for yes/True, and n|no|0|false|f for no/False"
140
+ ht2=f"""{Style.bold}{Fore.dark_blue}{Back.grey_70} FormBuilder {Fore.dark_red_1}Options {Style.reset}
141
+ {Fore.light_yellow}#b{Fore.light_green} will restart {Fore.light_red}[If it is wired to, might be reverse of 'b']{Style.reset}
142
+ {Fore.light_yellow}b{Fore.light_green} will return to previous menu{Fore.light_red}[If it is wired to, might be reverse of '#b']{Style.reset}
143
+ {Fore.light_yellow}f{Fore.light_green} will proceeds to review, where 'f' finishes,'y/yes/1' will review,'<Enter>/<Return>/n/f/0' will act as finish{Style.reset}
144
+ {Fore.light_yellow}p{Fore.light_green} at field filling lines goes to previous field{Style.reset}
145
+ {Fore.light_yellow}d{Fore.light_green} use default{Style.reset}
146
+ {Fore.light_yellow}m{Fore.light_green} use manually entered data present under m key option{Style.reset}
147
+ {Fore.light_yellow}#done#{Fore.light_green} to finish a str+(MultiLine) Input{Style.reset}
148
+ {Fore.grey_70}*{Fore.light_cyan}{num}/{Fore.light_magenta}{num+1}{Fore.light_steel_blue} of {Fore.light_red}{len(data.keys())}{Fore.medium_violet_red} as {Fore.light_green}{k}:{Fore.cyan}{data[k]['type']}={Fore.magenta}{data[k]['default']}{Style.reset}
149
+ {Fore.grey_70}*{Fore.light_yellow}goto {Fore.light_cyan}i{Fore.light_yellow}/goto{Fore.light_cyan}i{Fore.light_green} - go to {Fore.light_cyan}index{Style.reset}
150
+ {Fore.grey_70}*{Fore.light_yellow}goto{Fore.light_cyan}k{Fore.light_yellow},goto {Fore.light_cyan}k{Fore.light_green} goto {Fore.light_cyan}key{Fore.light_green} for field in Form {Style.reset}
151
+ {Fore.grey_70}*{Fore.light_yellow}showkeys{Fore.light_green} to see indexes refering to form keys{Style.reset}
152
+ {Fore.grey_70}*{Fore.light_yellow}'schk','search keys','sch ky{Fore.light_green} to search select and goto key{Style.reset}
153
+ {Fore.grey_70}* {Fore.grey_50}These cmds only work with fields that return str/VARCHAR/TEXT/str+/list of str's, i.e. [str,]
154
+ {Fore.grey_70}*{Fore.grey_50}['na','not_a_number','nan']{Fore.light_green}set a field to None{Style.reset}
155
+ {Style.reset}"""
156
+ print(ht2)
157
+ FormBuilderHelpText()
158
+ cmd=None
159
+ if data[k]['type']=='str+':
160
+ done=False
161
+ while not done:
162
+ lines=[]
163
+ skip_review=False
164
+ while True:
165
+ line=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}You(m):{item.get(k)}|Default(d):{data[k]['default']} Field:{str(k)}",helpText=f'{ht}\nuse {Fore.light_red}{Style.bold}{Back.grey_50}#done#{Style.reset} to stop.',data=data[k]['type'][:-1])
166
+ if line in [None,]:
167
+ return
168
+ elif line.lower() in ['#done#',]:
169
+ break
170
+ elif isinstance(line,list) and [i.lower() for i in line] in [['gotoi',],['goto i']]:
171
+ GOTOK=setGOTOK(data)
172
+ while GOTOK not in list(data.keys()):
173
+ GOTOK=setGOTOK(data)
174
+ if GOTOK in [None,]:
175
+ return
176
+ done=True
177
+ finalize=True
178
+ skip_review=True
179
+ break
180
+ elif isinstance(line,list) and [i.lower() for i in line] in [['gotok',],['goto k']]:
181
+ GOTOK=setGOTOK_str(data)
182
+ while GOTOK not in list(data.keys()):
183
+ GOTOK=setGOTOK_str(data)
184
+ if GOTOK in [None,]:
185
+ return
186
+ done=True
187
+ finalize=True
188
+ skip_review=True
189
+ break
190
+ elif isinstance(line,str) and line.lower() in ['gotoi','goto i']:
191
+ GOTOK=setGOTOK(GOTOK)
192
+ while GOTOK not in list(data.keys()):
193
+ GOTOK=setGOTOK(GOTOK)
194
+ if GOTOK in [None,]:
195
+ return
196
+ done=True
197
+ finalize=True
198
+ skip_review=True
199
+ break
200
+ elif isinstance(line,str) and line.lower() in ['gotok','goto k']:
201
+ GOTOK=setGOTOK_str(data)
202
+ while GOTOK not in list(data.keys()):
203
+ GOTOK=setGOTOK(GOTOK)
204
+ if GOTOK in [None,]:
205
+ return
206
+ done=True
207
+ finalize=True
208
+ skip_review=True
209
+ break
210
+ elif isinstance(line,str) and line.lower() in ['schk','search keys','sch ky']:
211
+ DATA={str(i):{'cmds':[i,],'desc':''} for i in data}
212
+ GOTOK=findAndSelectKey(options=DATA)
213
+ while GOTOK not in list(data.keys()):
214
+ GOTOK=setGOTOK_str(GOTOK)
215
+ if GOTOK in [None,]:
216
+ return
217
+ done=True
218
+ finalize=True
219
+ skip_review=True
220
+ break
221
+ elif isinstance(line,str) and line.lower() in ['showkeys','show keys']:
222
+ keys_index(data)
223
+ '''
224
+ done=True
225
+ finalize=True
226
+ skip_review=True
227
+ '''
228
+ continue
229
+ elif line.lower() == 'd':
230
+ line='\n'
231
+ else:
232
+ if len(line) in [i for i in range(7,14)]:
233
+ with Session(ENGINE) as session:
234
+ possible=session.query(Entry).filter(or_(Entry.Barcode==line,Entry.Barcode.icontains(line),Entry.Code==line,Entry.Code.icontains(line))).all()
235
+ if len(possible) > 0:
236
+ line+="\nBarcode/Code Matches found Below\n"+f"{'-'*len('Barcode/Code Matches found Below')}\n"
237
+ for num,i in enumerate(possible):
238
+ line+=i.seeShortRaw()+"\n"
239
+
240
+ lines.append(line)
241
+ cmd='\n'.join(lines)
242
+ if not skip_review:
243
+ use=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}{cmd}\nUse? [y/n]",helpText="type something that can be represented as a boolean, this includes boolean formulas used in if/if-then statements(True=y/1/t/true/yes/1==1,False=n/no/0/f/false/1==0)",data="boolean")
244
+ if use in [None,]:
245
+ return
246
+ elif use:
247
+ done=True
248
+ finalize=True
249
+ break
250
+ else:
251
+ continue
128
252
  else:
129
- index=None
130
- ht=''
131
- if data[k]['type'].lower() in ['date','datetime','time']:
132
- ht="type 'y' or 'n' to start"
133
- elif data[k]['type'].lower() in ['list']:
134
- ht="type your $DELIMITED list, the you will be asked for $DELIMITED character to use!"
135
- elif data[k]['type'].lower() in ['bool','boolean']:
136
- ht="type y|yes|t|true|1 for yes/True, and n|no|0|false|f for no/False"
137
- ht2=f"""{Style.bold}{Fore.dark_blue}{Back.grey_70} FormBuilder {Fore.dark_red_1}Options {Style.reset}
138
- {Fore.light_yellow}#b{Fore.light_green} will restart {Fore.light_red}[If it is wired to, might be reverse of 'b']{Style.reset}
139
- {Fore.light_yellow}b{Fore.light_green} will return to previous menu{Fore.light_red}[If it is wired to, might be reverse of '#b']{Style.reset}
140
- {Fore.light_yellow}f{Fore.light_green} will proceeds to review, where 'f' finishes,'y/yes/1' will review,'<Enter>/<Return>/n/f/0' will act as finish{Style.reset}
141
- {Fore.light_yellow}p{Fore.light_green} at field filling lines goes to previous field{Style.reset}
142
- {Fore.light_yellow}d{Fore.light_green} use default{Style.reset}
143
- {Fore.light_yellow}m{Fore.light_green} use manually entered data present under m key option{Style.reset}
144
- {Fore.light_yellow}#done#{Fore.light_green} to finish a str+(MultiLine) Input{Style.reset}
145
- {Fore.grey_70}*{Fore.light_cyan}{num}/{Fore.light_magenta}{num+1}{Fore.light_steel_blue} of {Fore.light_red}{len(data.keys())}{Fore.medium_violet_red} as {Fore.light_green}{k}:{Fore.cyan}{data[k]['type']}={Fore.magenta}{data[k]['default']}{Style.reset}
146
- {Fore.grey_70}*{Fore.light_yellow}goto {Fore.light_cyan}i{Fore.light_yellow}/goto{Fore.light_cyan}i{Fore.light_green} - go to {Fore.light_cyan}index{Style.reset}
147
- {Fore.grey_70}*{Fore.light_yellow}goto{Fore.light_cyan}k{Fore.light_yellow},goto {Fore.light_cyan}k{Fore.light_green} goto {Fore.light_cyan}key{Fore.light_green} for field in Form {Style.reset}
148
- {Fore.grey_70}*{Fore.light_yellow}showkeys{Fore.light_green} to see indexes refering to form keys{Style.reset}
149
- {Fore.grey_70}*{Fore.light_yellow}'schk','search keys','sch ky{Fore.light_green} to search select and goto key{Style.reset}
150
- {Fore.grey_70}* {Fore.grey_50}These cmds only work with fields that return str/VARCHAR/TEXT/str+/list of str's, i.e. [str,]
151
- {Fore.grey_70}*{Fore.grey_50}['na','not_a_number','nan']{Fore.light_green}set a field to None{Style.reset}
152
- {Style.reset}"""
153
- print(ht2)
154
- FormBuilderHelpText()
155
- cmd=None
156
- if data[k]['type']=='str+':
157
- done=False
158
- while not done:
159
- lines=[]
160
- skip_review=False
253
+ if_continue=False
161
254
  while True:
162
- line=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}You(m):{item.get(k)}|Default(d):{data[k]['default']} Field:{str(k)}",helpText=f'{ht}\nuse {Fore.light_red}{Style.bold}{Back.grey_50}#done#{Style.reset} to stop.',data=data[k]['type'][:-1])
163
- if line in [None,]:
255
+ passThru=['gotoi','goto i','gotok','goto k','showkeys','show keys','ff','finalize','finish','schk','search keys','sch ky']
256
+ cmd=Prompt.__init2__(None,func=lambda text,data:FormBuilderMkText(text,data,passThru=passThru,PassThru=True),ptext=f"{passThruText} You(m):{item.get(k)}|Default(d):{data[k]['default']} Field:{str(k)}",helpText=f'{ht}',data=data[k]['type'])
257
+ if cmd in [None,]:
164
258
  return
165
- elif line.lower() in ['#done#',]:
166
- break
167
- elif isinstance(line,list) and [i.lower() for i in line] in [['gotoi',],['goto i']]:
259
+ elif isinstance(cmd,list) and [i.lower() for i in cmd] in [['gotoi',],['goto i']]:
168
260
  GOTOK=setGOTOK(data)
169
261
  while GOTOK not in list(data.keys()):
170
262
  GOTOK=setGOTOK(data)
171
- if GOTOK in [None,]:
172
- return
173
- done=True
174
- finalize=True
175
- skip_review=True
263
+ if_continue=True
176
264
  break
177
- elif isinstance(line,list) and [i.lower() for i in line] in [['gotok',],['goto k']]:
265
+
266
+ elif isinstance(cmd,list) and [i.lower() for i in cmd] in [['gotok',],['goto k']]:
178
267
  GOTOK=setGOTOK_str(data)
179
268
  while GOTOK not in list(data.keys()):
180
269
  GOTOK=setGOTOK_str(data)
181
- if GOTOK in [None,]:
182
- return
183
- done=True
184
- finalize=True
185
- skip_review=True
270
+ if_continue=True
186
271
  break
187
- elif isinstance(line,str) and line.lower() in ['gotoi','goto i']:
272
+
273
+ elif isinstance(cmd,str) and cmd.lower() in ['gotoi','goto i']:
188
274
  GOTOK=setGOTOK(GOTOK)
189
275
  while GOTOK not in list(data.keys()):
190
276
  GOTOK=setGOTOK(GOTOK)
191
- if GOTOK in [None,]:
192
- return
193
- done=True
194
- finalize=True
195
- skip_review=True
277
+ if_continue=True
196
278
  break
197
- elif isinstance(line,str) and line.lower() in ['gotok','goto k']:
279
+
280
+ elif isinstance(cmd,str) and cmd.lower() in ['gotok','goto k']:
198
281
  GOTOK=setGOTOK_str(data)
199
282
  while GOTOK not in list(data.keys()):
200
- GOTOK=setGOTOK(GOTOK)
201
- if GOTOK in [None,]:
202
- return
203
- done=True
204
- finalize=True
205
- skip_review=True
283
+ GOTOK=setGOTOK_str(data)
284
+ if_continue=True
206
285
  break
207
- elif isinstance(line,str) and line.lower() in ['schk','search keys','sch ky']:
286
+ elif isinstance(cmd,str) and cmd.lower() in ['schk','search keys','sch ky']:
208
287
  DATA={str(i):{'cmds':[i,],'desc':''} for i in data}
209
288
  GOTOK=findAndSelectKey(options=DATA)
289
+ print(GOTOK)
210
290
  while GOTOK not in list(data.keys()):
211
- GOTOK=setGOTOK_str(GOTOK)
291
+ GOTOK=findAndSelectKey(options=DATA)
292
+ #GOTOK=setGOTOK_str(GOTOK)
212
293
  if GOTOK in [None,]:
213
294
  return
214
- done=True
215
- finalize=True
216
- skip_review=True
295
+ if_continue=True
217
296
  break
218
- elif isinstance(line,str) and line.lower() in ['showkeys','show keys']:
297
+ elif isinstance(cmd,str) and cmd.lower() in ['showkeys','show keys']:
219
298
  keys_index(data)
220
- '''
221
- done=True
222
- finalize=True
223
- skip_review=True
224
- '''
225
- continue
226
- elif line.lower() == 'd':
227
- line='\n'
228
- else:
229
- if len(line) in [i for i in range(7,14)]:
230
- with Session(ENGINE) as session:
231
- possible=session.query(Entry).filter(or_(Entry.Barcode==line,Entry.Barcode.icontains(line),Entry.Code==line,Entry.Code.icontains(line))).all()
232
- if len(possible) > 0:
233
- line+="\nBarcode/Code Matches found Below\n"+f"{'-'*len('Barcode/Code Matches found Below')}\n"
234
- for num,i in enumerate(possible):
235
- line+=i.seeShortRaw()+"\n"
236
-
237
- lines.append(line)
238
- cmd='\n'.join(lines)
239
- if not skip_review:
240
- use=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}{cmd}\nUse? [y/n]",helpText="type something that can be represented as a boolean, this includes boolean formulas used in if/if-then statements(True=y/1/t/true/yes/1==1,False=n/no/0/f/false/1==0)",data="boolean")
241
- if use in [None,]:
242
- return
243
- elif use:
244
- done=True
245
- finalize=True
246
- break
247
- else:
248
299
  continue
249
- else:
250
- if_continue=False
251
- while True:
252
- passThru=['gotoi','goto i','gotok','goto k','showkeys','show keys','ff','finalize','finish','schk','search keys','sch ky']
253
- cmd=Prompt.__init2__(None,func=lambda text,data:FormBuilderMkText(text,data,passThru=passThru,PassThru=True),ptext=f"{passThruText} You(m):{item.get(k)}|Default(d):{data[k]['default']} Field:{str(k)}",helpText=f'{ht}',data=data[k]['type'])
254
- if cmd in [None,]:
255
- return
256
- elif isinstance(cmd,list) and [i.lower() for i in cmd] in [['gotoi',],['goto i']]:
257
- GOTOK=setGOTOK(data)
258
- while GOTOK not in list(data.keys()):
259
- GOTOK=setGOTOK(data)
260
- if_continue=True
261
300
  break
262
-
263
- elif isinstance(cmd,list) and [i.lower() for i in cmd] in [['gotok',],['goto k']]:
264
- GOTOK=setGOTOK_str(data)
265
- while GOTOK not in list(data.keys()):
266
- GOTOK=setGOTOK_str(data)
267
- if_continue=True
301
+ if if_continue:
302
+ continue
303
+ if cmd in [None,]:
304
+ return
305
+ elif isinstance(cmd,str):
306
+ if cmd.lower() in ['p',]:
307
+ if num == 0:
308
+ index=len(data.keys())-1
309
+ else:
310
+ index=num-1
268
311
  break
269
-
270
- elif isinstance(cmd,str) and cmd.lower() in ['gotoi','goto i']:
271
- GOTOK=setGOTOK(GOTOK)
272
- while GOTOK not in list(data.keys()):
273
- GOTOK=setGOTOK(GOTOK)
274
- if_continue=True
312
+ elif cmd.lower() in ['d',]:
313
+ item[k]=data[k]['default']
314
+ elif cmd.lower() in ['f','finalize']:
315
+ finalize=True
275
316
  break
276
-
277
- elif isinstance(cmd,str) and cmd.lower() in ['gotok','goto k']:
278
- GOTOK=setGOTOK_str(data)
279
- while GOTOK not in list(data.keys()):
280
- GOTOK=setGOTOK_str(data)
281
- if_continue=True
317
+ elif cmd.lower() in ['ff','finish']:
318
+ finalize=True
319
+ finish=True
282
320
  break
283
- elif isinstance(cmd,str) and cmd.lower() in ['schk','search keys','sch ky']:
284
- DATA={str(i):{'cmds':[i,],'desc':''} for i in data}
285
- GOTOK=findAndSelectKey(options=DATA)
286
- print(GOTOK)
287
- while GOTOK not in list(data.keys()):
288
- GOTOK=findAndSelectKey(options=DATA)
289
- #GOTOK=setGOTOK_str(GOTOK)
290
- if GOTOK in [None,]:
291
- return
292
- if_continue=True
293
- break
294
- elif isinstance(cmd,str) and cmd.lower() in ['showkeys','show keys']:
295
- keys_index(data)
296
- continue
297
- break
298
- if if_continue:
299
- continue
300
- if cmd in [None,]:
301
- return
302
- elif isinstance(cmd,str):
303
- if cmd.lower() in ['p',]:
304
- if num == 0:
305
- index=len(data.keys())-1
321
+ elif cmd.lower() in ['na','not_a_number','nan']:
322
+ item[k]=None
323
+ elif cmd.lower() in ['m',]:
324
+ print(f"Not changing User set value '{k}':'{item.get(k)}'")
325
+ pass
306
326
  else:
307
- index=num-1
308
- break
309
- elif cmd.lower() in ['d',]:
310
- item[k]=data[k]['default']
311
- elif cmd.lower() in ['f','finalize']:
312
- finalize=True
313
- break
314
- elif cmd.lower() in ['ff','finish']:
315
- finalize=True
316
- finish=True
317
- break
318
- elif cmd.lower() in ['na','not_a_number','nan']:
319
- item[k]=None
320
- elif cmd.lower() in ['m',]:
321
- print(f"Not changing User set value '{k}':'{item.get(k)}'")
322
- pass
327
+ item[k]=cmd
323
328
  else:
324
329
  item[k]=cmd
330
+ if not finish:
331
+ review=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}review?",helpText="",data="bool")
332
+ #print(review)
333
+ if review in ['f',]:
334
+ review=False
335
+ if review in [None,]:
336
+ return
337
+ elif review in [True,'d']:
338
+ finalize=False
339
+ continue
325
340
  else:
326
- item[k]=cmd
327
- if not finish:
328
- review=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}review?",helpText="",data="bool")
329
- #print(review)
330
- if review in ['f',]:
331
- review=False
332
- if review in [None,]:
333
- return
334
- elif review in [True,'d']:
335
- finalize=False
336
- continue
341
+ break
337
342
  else:
343
+ review=False
338
344
  break
339
- else:
340
- review=False
341
- break
342
345
 
343
- if extra_tooling == True:
344
- tmp_item={str(num):item[i] for num,i in enumerate(item)}
345
- #ask if extra data is needed
346
- count=len(tmp_item)
347
- while True:
348
- nkv=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}New Key:Value Pair",helpText="yes or no",data="boolean")
349
- if nkv in ['d',True]:
350
- key=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}default[{count}] Key",helpText="yes or no",data="string")
351
- if key in [None,]:
352
- continue
353
- elif key in ['d',]:
354
- key=str(count)
355
- value=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}Value",helpText="data text",data="string")
356
- if value in [None,]:
357
- continue
358
- tmp_item[key]=value
359
- count+=1
360
- else:
361
- break
362
- #loop through lines for removal
363
- final_result={}
364
- for k in tmp_item:
365
- keep=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}['{tmp_item[k]}'] keep?",helpText="yes or no",data="boolean")
366
- if keep in ['d',True]:
367
- final_result[k]=tmp_item[k]
368
- return final_result
369
- return item
346
+ if extra_tooling == True:
347
+ tmp_item={str(num):item[i] for num,i in enumerate(item)}
348
+ #ask if extra data is needed
349
+ count=len(tmp_item)
350
+ while True:
351
+ nkv=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}New Key:Value Pair",helpText="yes or no",data="boolean")
352
+ if nkv in ['d',True]:
353
+ key=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}default[{count}] Key",helpText="yes or no",data="string")
354
+ if key in [None,]:
355
+ continue
356
+ elif key in ['d',]:
357
+ key=str(count)
358
+ value=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}Value",helpText="data text",data="string")
359
+ if value in [None,]:
360
+ continue
361
+ tmp_item[key]=value
362
+ count+=1
363
+ else:
364
+ break
365
+ #loop through lines for removal
366
+ final_result={}
367
+ for k in tmp_item:
368
+ keep=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{passThruText}['{tmp_item[k]}'] keep?",helpText="yes or no",data="boolean")
369
+ if keep in ['d',True]:
370
+ final_result[k]=tmp_item[k]
371
+ return final_result
372
+ return item
370
373
 
371
374
  '''
372
375
  form=FormBuilder(data=fm_data)
radboy/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION='0.0.713'
1
+ VERSION='0.0.714'
Binary file
@@ -462,6 +462,40 @@ Here:
462
462
  'desc':f'multiply a (price+crv) times its tax rate plus (price+crv) and return the total',
463
463
  'exec':lambda: price_plus_crv_by_tax(total=True),
464
464
  },
465
+ f'{uuid1()}':{
466
+ 'cmds':['cylinder volume radius','cylvolrad','cyl vol rad'],
467
+ 'desc':f'obtain the volume of a cylinder using radius',
468
+ 'exec':lambda: volumeCylinderRadius(),
469
+ },
470
+ f'{uuid1()}':{
471
+ 'cmds':['cylinder volume diameter','cylvoldiam','cyl vol diam'],
472
+ 'desc':f'obtain the volume of a cylinder using diameter',
473
+ 'exec':lambda: volumeCylinderDiameter(),
474
+ },
475
+ f'{uuid1()}':{
476
+ 'cmds':['cone volume radius','conevolrad','cone vol rad'],
477
+ 'desc':f'obtain the volume of a cone using radius, a code is 1/3 of a cylinder at the same height and radius',
478
+ 'exec':lambda: volumeConeRadius(),
479
+ },
480
+ f'{uuid1()}':{
481
+ 'cmds':['cone volume diameter','conevoldiam','cone vol diam'],
482
+ 'desc':f'obtain the volume of a cone using diameter, a code is 1/3 of a cylinder at the same height and diameter',
483
+ 'exec':lambda: volumeConeDiameter(),
484
+ },
485
+ f'{uuid1()}':{
486
+ 'cmds':['herons formula','hrns fmla'],
487
+ 'desc':f'''
488
+ Heron's formula calculates the area of any
489
+ triangle given only the lengths of its
490
+ three sides (a, b, and c). The formula is:
491
+ Area = √(s(s-a)(s-b)(s-c)). To use it, first
492
+ calculate the semi-perimeter, s = (a + b
493
+ + c) / 2, and then substitute this value
494
+ and the side lengths into the formula to
495
+ find the area.
496
+ ''',
497
+ 'exec':lambda: heronsFormula(),
498
+ },
465
499
  f'{uuid1()}':{
466
500
  'cmds':['tax add',],
467
501
  'desc':'''AddNewTaxRate() -> None
@@ -25,65 +25,69 @@ import json,sys,math,re,calendar,hashlib,haversine
25
25
  from time import sleep
26
26
  import itertools
27
27
  import decimal
28
+ from decimal import localcontext,Decimal
28
29
  unit_registry=pint.UnitRegistry()
30
+ import math
29
31
  def area_triangle():
30
- height=None
31
- base=None
32
- '''
33
- A=hbb/2
34
- '''
35
- while True:
36
- try:
37
- base=Control(func=FormBuilderMkText,ptext="base",helpText="base width",data="string")
38
- if base is None:
39
- return
40
- elif base in ['d',]:
41
- base=unit_registry.Quantity('1')
42
- else:
43
- base=unit_registry.Quantity(base)
44
- break
45
- except Exception as e:
46
- print(e)
32
+ with localcontext() as ctx:
33
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
34
+ height=None
35
+ base=None
36
+ '''
37
+ A=hbb/2
38
+ '''
39
+ while True:
47
40
  try:
48
- base=Control(func=FormBuilderMkText,ptext="base no units",helpText="base width,do not include units",data="dec.dec")
41
+ base=Control(func=FormBuilderMkText,ptext="base",helpText="base width",data="string")
49
42
  if base is None:
50
43
  return
51
44
  elif base in ['d',]:
52
- base=decc(1)
45
+ base=unit_registry.Quantity('1')
46
+ else:
47
+ base=unit_registry.Quantity(base)
53
48
  break
54
49
  except Exception as e:
55
- continue
50
+ print(e)
51
+ try:
52
+ base=Control(func=FormBuilderMkText,ptext="base no units",helpText="base width,do not include units",data="dec.dec")
53
+ if base is None:
54
+ return
55
+ elif base in ['d',]:
56
+ base=decc(1)
57
+ break
58
+ except Exception as e:
59
+ continue
56
60
 
57
- while True:
58
- try:
59
- height=Control(func=FormBuilderMkText,ptext="height",helpText="height width",data="string")
60
- if height is None:
61
- return
62
- elif height in ['d',]:
63
- height=unit_registry.Quantity('1')
64
- else:
65
- height=unit_registry.Quantity(height)
66
- break
67
- except Exception as e:
68
- print(e)
61
+ while True:
69
62
  try:
70
- height=Control(func=FormBuilderMkText,ptext="height no units",helpText="height width, do not include units",data="dec.dec")
63
+ height=Control(func=FormBuilderMkText,ptext="height",helpText="height width",data="string")
71
64
  if height is None:
72
65
  return
73
66
  elif height in ['d',]:
74
- height=decc(1)
67
+ height=unit_registry.Quantity('1')
68
+ else:
69
+ height=unit_registry.Quantity(height)
75
70
  break
76
71
  except Exception as e:
77
- continue
78
- print(type(height),height,type(base))
79
- if isinstance(height,decimal.Decimal) and isinstance(base,decimal.Decimal):
80
- return decc((height*base)/decc(2))
81
- elif isinstance(height,pint.Quantity) and isinstance(base,pint.Quantity):
82
- return ((height.to(base)*base)/2)
83
- elif isinstance(height,pint.Quantity) and isinstance(base,decimal.Decimal):
84
- return ((height*unit_registry.Quantity(base,height.units))/2)
85
- elif isinstance(height,decimal.Decimal) and isinstance(base,pint.Quantity):
86
- return ((unit_registry.Quantity(height,base.units)*base)/2)
72
+ print(e)
73
+ try:
74
+ height=Control(func=FormBuilderMkText,ptext="height no units",helpText="height width, do not include units",data="dec.dec")
75
+ if height is None:
76
+ return
77
+ elif height in ['d',]:
78
+ height=decc(1)
79
+ break
80
+ except Exception as e:
81
+ continue
82
+ print(type(height),height,type(base))
83
+ if isinstance(height,decimal.Decimal) and isinstance(base,decimal.Decimal):
84
+ return decc((height*base)/decc(2))
85
+ elif isinstance(height,pint.Quantity) and isinstance(base,pint.Quantity):
86
+ return ((height.to(base)*base)/2)
87
+ elif isinstance(height,pint.Quantity) and isinstance(base,decimal.Decimal):
88
+ return ((height*unit_registry.Quantity(base,height.units))/2)
89
+ elif isinstance(height,decimal.Decimal) and isinstance(base,pint.Quantity):
90
+ return ((unit_registry.Quantity(height,base.units)*base)/2)
87
91
 
88
92
  class Taxable:
89
93
  def general_taxable(self):
@@ -196,144 +200,152 @@ juices)''',
196
200
 
197
201
  #tax rate tools go here
198
202
  def AddNewTaxRate(excludes=['txrt_id','DTOE']):
199
- with Session(ENGINE) as session:
200
- '''AddNewTaxRate() -> None
203
+ with localcontext() as ctx:
204
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
205
+ with Session(ENGINE) as session:
206
+ '''AddNewTaxRate() -> None
201
207
 
202
- add a new taxrate to db.'''
203
- tr=TaxRate()
204
- session.add(tr)
205
- session.commit()
206
- session.refresh(tr)
207
- fields={i.name:{
208
- 'default':getattr(tr,i.name),
209
- 'type':str(i.type).lower()} for i in tr.__table__.columns if i.name not in excludes
210
- }
208
+ add a new taxrate to db.'''
209
+ tr=TaxRate()
210
+ session.add(tr)
211
+ session.commit()
212
+ session.refresh(tr)
213
+ fields={i.name:{
214
+ 'default':getattr(tr,i.name),
215
+ 'type':str(i.type).lower()} for i in tr.__table__.columns if i.name not in excludes
216
+ }
211
217
 
212
- fd=FormBuilder(data=fields)
213
- if fd is None:
214
- session.delete(tr)
215
- return
216
- for k in fd:
217
- setattr(tr,k,fd[k])
218
+ fd=FormBuilder(data=fields)
219
+ if fd is None:
220
+ session.delete(tr)
221
+ return
222
+ for k in fd:
223
+ setattr(tr,k,fd[k])
218
224
 
219
-
220
- session.add(tr)
221
- session.commit()
222
- session.refresh(tr)
223
- print(tr)
224
- return tr.TaxRate
225
+
226
+ session.add(tr)
227
+ session.commit()
228
+ session.refresh(tr)
229
+ print(tr)
230
+ return tr.TaxRate
225
231
 
226
232
  def GetTaxRate(excludes=['txrt_id','DTOE']):
227
- with Session(ENGINE) as session:
228
- '''GetTaxRate() -> TaxRate:Decimal
233
+ with localcontext() as ctx:
234
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
235
+ with Session(ENGINE) as session:
236
+ '''GetTaxRate() -> TaxRate:Decimal
229
237
 
230
- search for and return a Decimal/decc
231
- taxrate for use by prompt.
232
- '''
233
- tr=TaxRate()
234
- fields={i.name:{
235
- 'default':getattr(tr,i.name),
236
- 'type':str(i.type).lower()} for i in tr.__table__.columns if i.name not in excludes
237
- }
238
+ search for and return a Decimal/decc
239
+ taxrate for use by prompt.
240
+ '''
241
+ tr=TaxRate()
242
+ fields={i.name:{
243
+ 'default':getattr(tr,i.name),
244
+ 'type':str(i.type).lower()} for i in tr.__table__.columns if i.name not in excludes
245
+ }
238
246
 
239
- fd=FormBuilder(data=fields,passThruText="GetTaxRate Search -> ")
240
- if fd is None:
241
- return
242
- for k in fd:
243
- setattr(tr,k,fd[k])
244
- #and_
245
- filte=[]
246
- for k in fd:
247
- if fd[k] is not None:
248
- if isinstance(fd[k],str):
249
- filte.append(getattr(TaxRate,k).icontains(fd[k]))
250
- else:
251
- filte.append(getattr(tr,k)==fd[k])
252
-
253
- results=session.query(TaxRate).filter(and_(*filte)).all()
254
- ct=len(results)
255
- htext=[]
256
- for num,i in enumerate(results):
257
- m=std_colorize(i,num,ct)
258
- print(m)
259
- htext.append(m)
260
- htext='\n'.join(htext)
261
- if ct < 1:
262
- print(f"{Fore.light_red}There is nothing to work on in TaxRates that match your criteria.{Style.reset}")
263
- return
264
- while True:
265
- select=Control(func=FormBuilderMkText,ptext="Which index to return for tax rate[NAN=0.0000]?",helpText=htext,data="integer")
266
- print(select)
267
- if select is None:
247
+ fd=FormBuilder(data=fields,passThruText="GetTaxRate Search -> ")
248
+ if fd is None:
268
249
  return
269
- elif isinstance(select,str) and select.upper() in ['NAN',]:
270
- return 0
271
- elif select in ['d',]:
272
- return results[0].TaxRate
273
- else:
274
- if index_inList(select,results):
275
- return results[select].TaxRate
250
+ for k in fd:
251
+ setattr(tr,k,fd[k])
252
+ #and_
253
+ filte=[]
254
+ for k in fd:
255
+ if fd[k] is not None:
256
+ if isinstance(fd[k],str):
257
+ filte.append(getattr(TaxRate,k).icontains(fd[k]))
258
+ else:
259
+ filte.append(getattr(tr,k)==fd[k])
260
+
261
+ results=session.query(TaxRate).filter(and_(*filte)).all()
262
+ ct=len(results)
263
+ htext=[]
264
+ for num,i in enumerate(results):
265
+ m=std_colorize(i,num,ct)
266
+ print(m)
267
+ htext.append(m)
268
+ htext='\n'.join(htext)
269
+ if ct < 1:
270
+ print(f"{Fore.light_red}There is nothing to work on in TaxRates that match your criteria.{Style.reset}")
271
+ return
272
+ while True:
273
+ select=Control(func=FormBuilderMkText,ptext="Which index to return for tax rate[NAN=0.0000]?",helpText=htext,data="integer")
274
+ print(select)
275
+ if select is None:
276
+ return
277
+ elif isinstance(select,str) and select.upper() in ['NAN',]:
278
+ return 0
279
+ elif select in ['d',]:
280
+ return results[0].TaxRate
276
281
  else:
277
- continue
282
+ if index_inList(select,results):
283
+ return results[select].TaxRate
284
+ else:
285
+ continue
278
286
 
279
287
  def price_by_tax(total=False):
280
- fields={
281
- 'price':{
282
- 'default':0,
283
- 'type':'dec.dec'
284
- },
285
- 'rate':{
286
- 'default':GetTaxRate(),
287
- 'type':'dec.dec'
288
+ with localcontext() as ctx:
289
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
290
+ fields={
291
+ 'price':{
292
+ 'default':0,
293
+ 'type':'dec.dec'
294
+ },
295
+ 'rate':{
296
+ 'default':GetTaxRate(),
297
+ 'type':'dec.dec'
298
+ }
288
299
  }
289
- }
290
- fd=FormBuilder(data=fields,passThruText="Tax on Price ->")
291
- if fd is None:
292
- return
293
- else:
294
- price=fd['price']
295
- rate=fd['rate']
296
- if price is None:
297
- price=0
298
- if fd['rate'] is None:
299
- rate=0
300
- if total == False:
301
- return decc(price,cf=4)*decc(rate,cf=4)
300
+ fd=FormBuilder(data=fields,passThruText="Tax on Price ->")
301
+ if fd is None:
302
+ return
302
303
  else:
303
- return (decc(price,cf=4)*decc(rate,cf=4))+decc(price,cf=4)
304
+ price=fd['price']
305
+ rate=fd['rate']
306
+ if price is None:
307
+ price=0
308
+ if fd['rate'] is None:
309
+ rate=0
310
+ if total == False:
311
+ return decc(price,cf=4)*decc(rate,cf=4)
312
+ else:
313
+ return (decc(price,cf=4)*decc(rate,cf=4))+decc(price,cf=4)
304
314
 
305
315
  def price_plus_crv_by_tax(total=False):
306
- fields={
307
- 'price':{
308
- 'default':0,
309
- 'type':'dec.dec'
316
+ with localcontext() as ctx:
317
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
318
+ fields={
319
+ 'price':{
320
+ 'default':0,
321
+ 'type':'dec.dec'
322
+ },
323
+ 'crv_total_for_pkg':{
324
+ 'default':0,
325
+ 'type':'dec.dec',
310
326
  },
311
- 'crv_total_for_pkg':{
312
- 'default':0,
313
- 'type':'dec.dec',
314
- },
315
- 'rate':{
316
- 'default':GetTaxRate(),
317
- 'type':'dec.dec'
327
+ 'rate':{
328
+ 'default':GetTaxRate(),
329
+ 'type':'dec.dec'
330
+ }
318
331
  }
319
- }
320
- fd=FormBuilder(data=fields,passThruText="Tax on (Price+CRV)")
321
- if fd is None:
322
- return
323
- else:
324
- price=fd['price']
325
- rate=fd['rate']
326
- crv=fd['crv_total_for_pkg']
327
- if price is None:
328
- price=0
329
- if crv is None:
330
- crv=0
331
- if fd['rate'] is None:
332
- rate=0
333
- if total == False:
334
- return (decc(price,cf=4)+decc(crv,cf=4))*decc(rate,cf=4)
332
+ fd=FormBuilder(data=fields,passThruText="Tax on (Price+CRV)")
333
+ if fd is None:
334
+ return
335
335
  else:
336
- return (price+crv)+((decc(price,cf=4)+decc(crv,cf=4))*decc(rate,cf=4))
336
+ price=fd['price']
337
+ rate=fd['rate']
338
+ crv=fd['crv_total_for_pkg']
339
+ if price is None:
340
+ price=0
341
+ if crv is None:
342
+ crv=0
343
+ if fd['rate'] is None:
344
+ rate=0
345
+ if total == False:
346
+ return (decc(price,cf=4)+decc(crv,cf=4))*decc(rate,cf=4)
347
+ else:
348
+ return (price+crv)+((decc(price,cf=4)+decc(crv,cf=4))*decc(rate,cf=4))
337
349
 
338
350
  def DeleteTaxRate(excludes=['txrt_id','DTOE']):
339
351
  with Session(ENGINE) as session:
@@ -460,3 +472,125 @@ def EditTaxRate(excludes=['txrt_id','DTOE']):
460
472
  else:
461
473
  continue
462
474
 
475
+ def heronsFormula():
476
+ with localcontext() as ctx:
477
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
478
+ '''
479
+ Calculate the semi-perimeter (s): Add the lengths of the three sides and divide by 2.
480
+ s = (a + b + c) / 2
481
+ '''
482
+ fields={
483
+ 'side 1':{
484
+ 'default':1,
485
+ 'type':'dec.dec'
486
+ },
487
+ 'side 2':{
488
+ 'default':1,
489
+ 'type':'dec.dec'
490
+ },
491
+ 'side 3':{
492
+ 'default':1,
493
+ 'type':'dec.dec'
494
+ },
495
+ }
496
+ fd=FormBuilder(data=fields)
497
+ if fd is None:
498
+ return
499
+
500
+ s=(fd['side 1']+fd['side 2']+fd['side 3'])/2
501
+ '''Apply Heron's formula: Substitute the semi-perimeter (s) and the side lengths (a, b, and c) into the formula:
502
+ Area = √(s(s-a)(s-b)(s-c))'''
503
+ Area=math.sqrt(s*(s-fd['side 1'])*(s-fd['side 2'])*(s-fd['side 3']))
504
+ return Area
505
+
506
+ def volumeCylinderRadius():
507
+ with localcontext() as ctx:
508
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
509
+ '''
510
+ Volume of a cylinder: Used for cylindrical storage bins, silos, or tanks.(V=pi r^{2}h)
511
+ '''
512
+ fields={
513
+ 'height':{
514
+ 'default':1,
515
+ 'type':'dec.dec'
516
+ },
517
+ 'radius':{
518
+ 'default':1,
519
+ 'type':'dec.dec'
520
+ },
521
+ }
522
+ fd=FormBuilder(data=fields)
523
+ if fd is None:
524
+ return
525
+
526
+ volume=Decimal(math.pi)*(fd['radius']**2)*fd['height']
527
+ return volume
528
+
529
+ def volumeCylinderDiameter():
530
+ with localcontext() as ctx:
531
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
532
+ '''
533
+ Volume of a cylinder: Used for cylindrical storage bins, silos, or tanks.(V=pi r^{2}h)
534
+ '''
535
+ fields={
536
+ 'height':{
537
+ 'default':1,
538
+ 'type':'dec.dec'
539
+ },
540
+ 'diameter':{
541
+ 'default':1,
542
+ 'type':'dec.dec'
543
+ },
544
+ }
545
+ fd=FormBuilder(data=fields)
546
+ if fd is None:
547
+ return
548
+
549
+ volume=Decimal(math.pi)*((fd['diameter']/2)**2)*fd['height']
550
+ return volume
551
+
552
+ def volumeConeRadius():
553
+ with localcontext() as ctx:
554
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
555
+ '''
556
+ Volume of a cylinder: Used for cylindrical storage bins, silos, or tanks.(V=pi r^{2}h)
557
+ '''
558
+ fields={
559
+ 'height':{
560
+ 'default':1,
561
+ 'type':'dec.dec'
562
+ },
563
+ 'radius':{
564
+ 'default':1,
565
+ 'type':'dec.dec'
566
+ },
567
+ }
568
+ fd=FormBuilder(data=fields)
569
+ if fd is None:
570
+ return
571
+
572
+ volume=Decimal(1/3)*(Decimal(math.pi)*(fd['radius']**2)*fd['height'])
573
+ return volume
574
+
575
+ def volumeConeDiameter():
576
+ with localcontext() as ctx:
577
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
578
+ '''
579
+ Volume of a cylinder: Used for cylindrical storage bins, silos, or tanks.(V=pi r^{2}h)
580
+ '''
581
+ fields={
582
+ 'height':{
583
+ 'default':1,
584
+ 'type':'dec.dec'
585
+ },
586
+ 'diameter':{
587
+ 'default':1,
588
+ 'type':'dec.dec'
589
+ },
590
+ }
591
+ fd=FormBuilder(data=fields)
592
+ if fd is None:
593
+ return
594
+
595
+ volume=Decimal(1/3)*(Decimal(math.pi)*((fd['diameter']/2)**2)*fd['height'])
596
+ return volume
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: radboy
3
- Version: 0.0.713
3
+ Version: 0.0.714
4
4
  Summary: A Retail Calculator for Android/Linux
5
5
  Author: Carl Joseph Hirner III
6
6
  Author-email: Carl Hirner III <k.j.hirner.wisdom@gmail.com>
@@ -5,7 +5,7 @@ radboy/Holidays.txt,sha256=y-JZPihh5iaWKxMIHNXD39yVuVmf1vMs4FdNDcg0f1Y,3114
5
5
  radboy/InventoryGlossary.txt,sha256=018-Yqca6DFb10jPdkUY-5qhkRlQN1k3rxoTaERQ-LA,91008
6
6
  radboy/RecordMyCodes.py,sha256=KI7Jmf3MX0Zng_YUvcjVKN2siyUOhaMAHQGzpPuX8KQ,41373
7
7
  radboy/Run.py,sha256=JUoCTHnzQBv7n8PB2_i93ANdAC_iW__RkAge8esCnk4,76
8
- radboy/__init__.py,sha256=9CyUNXPQTGFWyCEdYEqpWVwMS57bLD3d9exo35JWAaA,17
8
+ radboy/__init__.py,sha256=knF7756I5eX5wXmKdi4xUHUZw_nwtlS7rvIbRRLbI7E,17
9
9
  radboy/api_key,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  radboy/case-export-2024-05-14-13-10-00.672971.xlsx,sha256=Wd592d_VLFmfUI9KKKSVjNwjV91euc1T7ATyvwvUhlg,5431
11
11
  radboy/case-export-2024-05-14-13-13-22.540614.xlsx,sha256=OnGrhmScHfGp_mVaWW-LNMsqrQgyZDpiU3wV-2s3U5Q,5556
@@ -84,11 +84,11 @@ radboy/DB/DisplayItemDb.py,sha256=uVvrNyFyBuKvrw-BEPXKYvfa-QWyFN5ahESi2l6vUUA,52
84
84
  radboy/DB/EstimatedPayCalendarWorkSheet.txt,sha256=GOjRSmGxFoNTdAnpPe2kGv7CkXDrh0Mee01HslamGbo,17173
85
85
  radboy/DB/ExerciseTracker.py,sha256=OS9i8jGIZPj-6m1bB0-eKNHQ6vf2iv_AYPEc0s4bkBM,27809
86
86
  radboy/DB/LetterWriter.py,sha256=0B14GB-hJK2Xf_TFASriOELFygiI1LwkSb__R3tUiU0,2631
87
- radboy/DB/OrderedAndRxd.py,sha256=PZ_Rbm0H3DFhHuN1SZEnd1RhEnKOU_L0X0MHXwYN3-s,23004
87
+ radboy/DB/OrderedAndRxd.py,sha256=gdOTxia6b6RN2h99e4uF87G7Rmujem1F0kr4Uuxy6dw,23166
88
88
  radboy/DB/PayDay.py,sha256=H2kPGvBCDkMOz7lbxQhYtUt_oAInpxi37Q6MFrah98I,8710
89
89
  radboy/DB/PayModels.py,sha256=hjwWxP7PL33hmfzQl5YTf0HqzaMxXJxFknPdxFJXJc8,3499
90
90
  radboy/DB/PrintLogging.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
- radboy/DB/Prompt.py,sha256=gsenew2dCRujrd85qYYrO4NbXkl8euzDX1uQi5a_LLA,184485
91
+ radboy/DB/Prompt.py,sha256=wdf8bH2huJNQzN80sKopPD7AWz_wFhZ67CbhQbGiJus,185475
92
92
  radboy/DB/RandomStringUtil.py,sha256=eZCpR907WStgfbk4Evcghjv9hOkUDXH-iMXIq0-kXq8,24386
93
93
  radboy/DB/ResetTools.py,sha256=RbI-Ua7UlsN0S9qLqtEkTWvzyTZ6R-hHR3CW4NHlUPE,6660
94
94
  radboy/DB/SMLabelImporter.py,sha256=eUoBDxVUUEKGL2g_PwkASM67ZB7FmXtSnn4bCagskhY,4013
@@ -117,7 +117,7 @@ radboy/DB/__pycache__/FormBuilder.cpython-312.pyc,sha256=p1o-5SMRL8OXP_XQ5liUpf-
117
117
  radboy/DB/__pycache__/PrintLogging.cpython-312.pyc,sha256=pIAFqTi6OiQQORSc-oMH1zAbsdH7sY1TifxrN_QOvnU,148
118
118
  radboy/DB/__pycache__/Prompt.cpython-311.pyc,sha256=P2uPRpeqfLFtxieZ0JHBG3X_HZzWUCsFSLb_fpRqky0,6407
119
119
  radboy/DB/__pycache__/Prompt.cpython-312.pyc,sha256=6CcQ1gE2hcz3cKPjo4f6d7xNM2PTDnl8NzQG0Pme5BE,142886
120
- radboy/DB/__pycache__/Prompt.cpython-313.pyc,sha256=LbqRqno1PcabI2TJEbeEsGR10613PTPnHarrdjlPEto,263265
120
+ radboy/DB/__pycache__/Prompt.cpython-313.pyc,sha256=CoQNDnFr2_B_4nJ7nKTxzi_bU7u13Sugnqb6Tg0fAQg,263833
121
121
  radboy/DB/__pycache__/RandomStringUtil.cpython-312.pyc,sha256=TrbEY89MuLmNlvoo5d8vOE6Dyshh5_EMlTZvk8MDVN4,48597
122
122
  radboy/DB/__pycache__/RandomStringUtil.cpython-313.pyc,sha256=MCcgVwV2Y-9rAY2FVaJZCKcou3HDX70EZudoiCigT0o,49217
123
123
  radboy/DB/__pycache__/ResetTools.cpython-311.pyc,sha256=4Vyc57iAAF0yRPjjglnVKovnTn8OoFIi6Zok3Wpj_YM,9292
@@ -201,12 +201,12 @@ radboy/ExtractPkg/__pycache__/__init__.cpython-311.pyc,sha256=62yPgrgPZffZFLr6Fs
201
201
  radboy/ExtractPkg/__pycache__/__init__.cpython-312.pyc,sha256=Ll1iKcG0MDtoCIloQ_frcihvCSe1HPtyERzcAoXwQT0,273
202
202
  radboy/ExtractPkg/__pycache__/__init__.cpython-313.pyc,sha256=kL3Y3KxCTaGNg3aq5fhf2fsnQHZolGfvniEUfsx2bwY,152
203
203
  radboy/FB/FBMTXT.py,sha256=6PodraQPmIsEcbvYv-AR0AIoK630kjF50raPgqiCuvI,42230
204
- radboy/FB/FormBuilder.py,sha256=ByPBfmxRL4Xb9JSCl7-ciwJgYK9LT249alw0M7MZavQ,18800
204
+ radboy/FB/FormBuilder.py,sha256=gbpzLcjL292aAHGimQFvrhnhMnMpDCwKQ0L3jio7FG8,20156
205
205
  radboy/FB/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
206
206
  radboy/FB/__pycache__/FBMTXT.cpython-312.pyc,sha256=XCVFa7Mo83LGIdRrTvcK73siUpcVIEQfXKCH2QHeViw,9626
207
207
  radboy/FB/__pycache__/FBMTXT.cpython-313.pyc,sha256=lPsj5ps9SqSccQuZKFuaAVkQT-3uma68J3FSPKHA_cc,56574
208
208
  radboy/FB/__pycache__/FormBuilder.cpython-312.pyc,sha256=lNQdB-zApsXM7OQF9MIi0zRZD1SAL6stKEN-AyQiIKg,18873
209
- radboy/FB/__pycache__/FormBuilder.cpython-313.pyc,sha256=mGkAw_sTf1VisaBhK8I5gp-L2ndP137VxZe5WVpFK3c,25044
209
+ radboy/FB/__pycache__/FormBuilder.cpython-313.pyc,sha256=Ydb7h_VUHhKWhF8eJHnkm3TNMoL5Da1BysxN0CWCMA0,26069
210
210
  radboy/FB/__pycache__/__init__.cpython-312.pyc,sha256=ULEL8Au_CxcYpNAcSoSbI65M7-av1W6Zuy6kQJUu-Mw,265
211
211
  radboy/FB/__pycache__/__init__.cpython-313.pyc,sha256=Mp4kqFJa86-gyUu1vr9rubcUHUDr-O75hevV5IQdSFw,144
212
212
  radboy/GDOWN/GDOWN.py,sha256=Z5q6TR92I4eQpxhsJpOwhH__f1tK2IcGctPRw8OAEr8,798
@@ -406,7 +406,7 @@ radboy/__pycache__/Run.cpython-311.pyc,sha256=G_UEfMtkLRjR6ZpGA_BJzGenuaCcP469Y9
406
406
  radboy/__pycache__/Run.cpython-312.pyc,sha256=v4xolc3mHyla991XhpYBUbBHYT0bnJ1gE-lkFoQ4GFA,241
407
407
  radboy/__pycache__/__init__.cpython-311.pyc,sha256=R-DVbUioMOW-Fnaq7FpT5F1a5p0q3b_RW-HpLRArCAY,242
408
408
  radboy/__pycache__/__init__.cpython-312.pyc,sha256=FsFzLXOlTK8_7ixoPZzakkR8Wibt-DvXLFh-oG2QlPw,164
409
- radboy/__pycache__/__init__.cpython-313.pyc,sha256=kO2KmVU3-joi_6igAc2KOZKom7LJQQ9SmeC8SsL5t2Q,165
409
+ radboy/__pycache__/__init__.cpython-313.pyc,sha256=Wc4FIDuyxBS5yhhY9PanTJSoIj6ai3CEhqcOmyRLPtU,165
410
410
  radboy/__pycache__/__init__.cpython-39.pyc,sha256=D48T6x6FUeKPfubo0sdS_ZUut3FmBvPMP7qT6rYBZzU,275
411
411
  radboy/__pycache__/possibleCode.cpython-311.pyc,sha256=zFiHyzqD8gUnIWu4vtyMYIBposiRQqaRXfcT_fOl4rU,20882
412
412
  radboy/__pycache__/possibleCode.cpython-312.pyc,sha256=tk_CO-AcsO3YZj5j6vEsw3g37UmEzWc5YgeWEoJEUg4,27922
@@ -416,8 +416,8 @@ radboy/__pycache__/t.cpython-311.pyc,sha256=bVszNkmfiyoNLd0WUc8aBJc2geGseW4O28cq
416
416
  radboy/__pycache__/te.cpython-311.pyc,sha256=vI8eNUE5VVrfCQvnrJ7WuWpoKcLz-vVK3ifdUZ4UNhk,592
417
417
  radboy/__pycache__/x.cpython-311.pyc,sha256=3jIvWoO5y5WqrL_hRmXNK8O0vO7DwJ4gufjm2b0V7VI,1963
418
418
  radboy/preloader/__init__.py,sha256=lrGR0JF0dkDM8N9ORGUKH_MucUFx1-PI38YsvqS-wgA,926
419
- radboy/preloader/preloader.py,sha256=vLZfFehbndvkV5O6TPlaZZRqOG-RpMQ5DseCpQpU4C8,14513
420
- radboy/preloader/preloader_func.py,sha256=gWvdLrcM03hctD3yPH8kK5gGhvWss15OfQd1jZ4gbW8,12503
419
+ radboy/preloader/preloader.py,sha256=b66i5CTmUiPzfd3XRO1ydJqFF53eQiqnBeVZlDOpTIY,15898
420
+ radboy/preloader/preloader_func.py,sha256=3aBCkvEROsefwbhiuxTYg1EnklE3odQ6see-N-DLSyQ,16177
421
421
  radboy/setCode/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
422
422
  radboy/setCode/setCode.py,sha256=8UOf4okbx-Zane99odeoLAS_lfIt8pIaFomN7EtnnVA,5202
423
423
  radboy/setCode/__pycache__/__init__.cpython-311.pyc,sha256=cJuP5rve6Wn7ZO789tixyOlyrHZQWsBxDn9oZGoG5WE,232
@@ -434,7 +434,7 @@ radboy/tkGui/Images/__pycache__/__init__.cpython-311.pyc,sha256=tXBYpqbOlZ24B1BI
434
434
  radboy/tkGui/__pycache__/BeginnersLuck.cpython-311.pyc,sha256=xLQOnV1wuqHGaub16mPX0dDMGU9ryCeLtNz5e517_GE,3004
435
435
  radboy/tkGui/__pycache__/Review.cpython-311.pyc,sha256=wKq24iM6Xe2OampgZ7-8U6Nvmgs2y-qWOrGwtWhc75k,4047
436
436
  radboy/tkGui/__pycache__/__init__.cpython-311.pyc,sha256=BX7DBn5qbvKTvlrKOP5gzTBPBTeTgSMjBW6EMl7N8e0,230
437
- radboy-0.0.713.dist-info/METADATA,sha256=tY-XDEdAyG4-7dUwWpB7EfkSDoXJWQlLIa43uTReEPU,1891
438
- radboy-0.0.713.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
439
- radboy-0.0.713.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
440
- radboy-0.0.713.dist-info/RECORD,,
437
+ radboy-0.0.714.dist-info/METADATA,sha256=pxSTz6MKgS6tFbz18xZ570ZRqBg5rnYx6T8oH_rD5f8,1891
438
+ radboy-0.0.714.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
439
+ radboy-0.0.714.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
440
+ radboy-0.0.714.dist-info/RECORD,,