radboy 0.0.713__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/DB/OrderedAndRxd.py +6 -0
- radboy/DB/Prompt.py +19 -2
- radboy/DB/__pycache__/Prompt.cpython-313.pyc +0 -0
- radboy/FB/FormBuilder.py +257 -254
- radboy/FB/__pycache__/FormBuilder.cpython-313.pyc +0 -0
- 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 +56 -359
- radboy/preloader/preloader_func.py +818 -163
- {radboy-0.0.713.dist-info → radboy-0.0.715.dist-info}/METADATA +1 -1
- {radboy-0.0.713.dist-info → radboy-0.0.715.dist-info}/RECORD +15 -15
- {radboy-0.0.713.dist-info → radboy-0.0.715.dist-info}/WHEEL +0 -0
- {radboy-0.0.713.dist-info → radboy-0.0.715.dist-info}/top_level.txt +0 -0
radboy/DB/OrderedAndRxd.py
CHANGED
|
@@ -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
|
-
|
|
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()
|
|
Binary file
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
76
|
-
|
|
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
|
-
|
|
101
|
-
|
|
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"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
119
|
-
if
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
GOTOK
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
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
|
-
|
|
163
|
-
|
|
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
|
|
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
|
-
|
|
172
|
-
return
|
|
173
|
-
done=True
|
|
174
|
-
finalize=True
|
|
175
|
-
skip_review=True
|
|
263
|
+
if_continue=True
|
|
176
264
|
break
|
|
177
|
-
|
|
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
|
-
|
|
182
|
-
return
|
|
183
|
-
done=True
|
|
184
|
-
finalize=True
|
|
185
|
-
skip_review=True
|
|
270
|
+
if_continue=True
|
|
186
271
|
break
|
|
187
|
-
|
|
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
|
-
|
|
192
|
-
return
|
|
193
|
-
done=True
|
|
194
|
-
finalize=True
|
|
195
|
-
skip_review=True
|
|
277
|
+
if_continue=True
|
|
196
278
|
break
|
|
197
|
-
|
|
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=
|
|
201
|
-
|
|
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(
|
|
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=
|
|
291
|
+
GOTOK=findAndSelectKey(options=DATA)
|
|
292
|
+
#GOTOK=setGOTOK_str(GOTOK)
|
|
212
293
|
if GOTOK in [None,]:
|
|
213
294
|
return
|
|
214
|
-
|
|
215
|
-
finalize=True
|
|
216
|
-
skip_review=True
|
|
295
|
+
if_continue=True
|
|
217
296
|
break
|
|
218
|
-
elif isinstance(
|
|
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
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
-
|
|
278
|
-
|
|
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
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
print(
|
|
287
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
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)
|
|
Binary file
|