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

Binary file
radboy/DB/db.py CHANGED
@@ -5405,13 +5405,6 @@ class Occurances(BASE,Template):
5405
5405
  quantity=Column(Float,default=0.0)
5406
5406
 
5407
5407
  comment=Column(String,default='')
5408
- long_comment=Column(Text,default='')
5409
-
5410
- max_pre=Column(Float,default=sys.maxsize)
5411
- min_pre=Column(Float,default=-sys.maxsize)
5412
-
5413
- max_post=Column(Float,default=sys.maxsize)
5414
- min_post=Column(Float,default=-sys.maxsize)
5415
5408
 
5416
5409
  created_dtoe=Column(DateTime,default=datetime.now())
5417
5410
 
@@ -2,7 +2,7 @@ from . import *
2
2
 
3
3
 
4
4
  class OccurancesUi:
5
- first_time_excludes=['oid','hidden','hidden_dtoe','soft_deleted','soft_deleted_dtoe','created_dtoe','modified_dtoe','modified_how_many_times_since_created']
5
+ first_time_excludes=['oid','created_dtoe',]
6
6
  basic_includes=['name','type','unit_of_measure','quantity']
7
7
 
8
8
  group_fields=['group_name','group_uid']
@@ -19,6 +19,7 @@ class OccurancesUi:
19
19
  session.delete(OCT)
20
20
  session.commit()
21
21
  print("user backed out, nothing was saved!")
22
+ return
22
23
  for k in fd:
23
24
  setattr(OCT,k,fd[k])
24
25
  session.commit()
@@ -40,6 +41,7 @@ class OccurancesUi:
40
41
  session.delete(OCT)
41
42
  session.commit()
42
43
  print("user backed out, nothing was saved!")
44
+ return
43
45
  for k in fd:
44
46
  setattr(OCT,k,fd[k])
45
47
  session.commit()
@@ -49,9 +51,6 @@ class OccurancesUi:
49
51
  print(e)
50
52
  session.rollback()
51
53
 
52
- def edit_occurance(self):
53
- pass
54
-
55
54
  def lst_group_names(self):
56
55
  with Session(ENGINE) as session:
57
56
  hs=[]
@@ -88,12 +87,13 @@ class OccurancesUi:
88
87
  ct=len(results)
89
88
  if ct == 0:
90
89
  print(std_colorize("No Results Found",0,1))
91
- return
90
+ return None,None
92
91
  for num,result in enumerate(results):
93
92
  hs.append(self.master_display(result,num,ct))
94
93
  helpText='\n'.join(hs)
95
94
  return results,helpText
96
95
  return None,None
96
+
97
97
  def master_display(self,result,num,ct):
98
98
  hstring=std_colorize(f"{Fore.light_sea_green}[group name] '{result.group_name}' {Fore.dodger_blue_3}- [guuid] '{result.group_uid}' -{Fore.green_yellow} [oid] '{result.oid}' - {Fore.light_magenta}[name] '{result.name}' - {Fore.magenta}[type] '{result.type}' - {Fore.orange_red_1}[qty] '{result.quantity}' {Fore.light_steel_blue}'{result.unit_of_measure}'{Fore.light_salmon_1} - [uid]'{result.uid}'",num,ct)
99
99
  print(hstring)
@@ -135,7 +135,7 @@ class OccurancesUi:
135
135
  ct=len(results)
136
136
  if ct == 0:
137
137
  print(std_colorize("No Results Found",0,1))
138
- return
138
+ return None,None
139
139
  for num,result in enumerate(results):
140
140
  hs.append(self.master_display(result,num,ct))
141
141
  helpText='\n'.join(hs)
@@ -145,28 +145,131 @@ class OccurancesUi:
145
145
  by=['group_name','group_uid','name','uid','type']
146
146
  #need to select for total
147
147
 
148
- def scan_create_count_save(self):
149
- pass
150
-
151
- def edit_groups(self):
152
- pass
148
+ def copy_to_new(self,prompted=True):
149
+ local_excludes=['quantity','uid',]
150
+ #search and copy old details to a new Occurance setting created_dtoe to today, and quantity to 0
151
+ with Session(ENGINE) as session:
152
+ while True:
153
+ search,helpText=self.lst_names()
154
+ if search is None:
155
+ return
156
+ whiches=Prompt.__init2__(None,func=FormBuilderMkText,ptext="which indexes to copy to new Occurances",helpText=helpText,data="list")
157
+ if whiches in [None,'d']:
158
+ return
159
+ cta=len(search)
160
+ try:
161
+ for which in whiches:
162
+ try:
163
+ which=int(which)
164
+ if which in range(0,cta+1):
165
+ oid=search[which].oid
166
+ x=session.query(Occurances).filter(Occurances.oid==oid).first()
167
+ new=Occurances()
168
+ session.add(new)
169
+ excludes=[]
170
+ excludes.extend(self.first_time_excludes)
171
+ excludes.extend(local_excludes)
172
+ if prompted:
173
+ fields={i.name:{'default':getattr(x,i.name),'type':str(i.type).lower()} for i in Occurances.__table__.columns if i.name not in excludes}
174
+ fd=FormBuilder(data=fields)
175
+ else:
176
+ fd={}
177
+ fields=[i.name for i in Occurances.__table__.columns if i.name not in excludes]
178
+ for k in fields:
179
+ old=getattr(x,k)
180
+ fd[k]=old
153
181
 
154
- def searchAuto(self):
155
- pass
182
+ includes2=['quantity',]
183
+ fields2={i.name:{'default':getattr(x,i.name),'type':str(i.type).lower()} for i in Occurances.__table__.columns if i.name in includes2}
184
+ fd2=FormBuilder(data=fields2)
185
+ if fd2:
186
+ fd['quantity']=fd2['quantity']
187
+ else:
188
+ fd['quantity']=0
189
+ fd['name']=f"{fd['name']} {dayString(datetime.now())}"
190
+ if fd:
191
+ try:
192
+ for k in fd:
193
+ setattr(new,k,fd[k])
194
+ session.commit()
195
+ except Exception as eee:
196
+ print(eee)
197
+ session.rollback()
198
+ except Exception as e:
199
+ print(e)
200
+ return
201
+ except Exception as ee:
202
+ print(ee)
203
+ break
156
204
 
157
- def set_max_pre(self):
158
- pass
159
- def set_min_pre(self):
160
- pass
161
- def set_min_post(self):
162
- pass
163
- def set_max_post(self):
164
- pass
205
+ def edit_selected(self):
206
+ with Session(ENGINE) as session:
207
+ while True:
208
+ search,helpText=self.lst_names()
209
+ if search is None:
210
+ return
211
+ whiches=Prompt.__init2__(None,func=FormBuilderMkText,ptext="which indexes to edit",helpText=helpText,data="list")
212
+ if whiches in [None,'d']:
213
+ return
214
+ cta=len(search)
215
+ try:
216
+ for which in whiches:
217
+ try:
218
+ which=int(which)
219
+ if which in range(0,cta+1):
220
+ oid=search[which].oid
221
+ x=session.query(Occurances).filter(Occurances.oid==oid).first()
222
+ fields={i.name:{'default':getattr(x,i.name),'type':str(i.type).lower()} for i in Occurances.__table__.columns if i.name not in self.first_time_excludes}
223
+ fd=FormBuilder(data=fields)
224
+ if fd:
225
+ try:
226
+ for k in fd:
227
+ setattr(x,k,fd[k])
228
+ session.commit()
229
+ except Exception as eee:
230
+ print(eee)
231
+ session.rollback()
232
+ except Exception as e:
233
+ print(e)
234
+ return
235
+ except Exception as ee:
236
+ print(ee)
237
+ break
165
238
 
166
- def set_unit_of_measure(self):
167
- pass
168
- def set_qty(self):
169
- pass
239
+ def edit_selected_qty(self):
240
+ with Session(ENGINE) as session:
241
+ while True:
242
+ search,helpText=self.lst_names()
243
+ if search is None:
244
+ return
245
+ whiches=Prompt.__init2__(None,func=FormBuilderMkText,ptext="which indexes to edit",helpText=helpText,data="list")
246
+ if whiches in [None,'d']:
247
+ return
248
+ cta=len(search)
249
+ try:
250
+ for which in whiches:
251
+ try:
252
+ which=int(which)
253
+ if which in range(0,cta+1):
254
+ oid=search[which].oid
255
+ x=session.query(Occurances).filter(Occurances.oid==oid).first()
256
+ includes=['quantity',]
257
+ fields={i.name:{'default':getattr(x,i.name),'type':str(i.type).lower()} for i in Occurances.__table__.columns if i.name in includes}
258
+ fd=FormBuilder(data=fields)
259
+ if fd:
260
+ try:
261
+ for k in fd:
262
+ setattr(x,k,fd[k])
263
+ session.commit()
264
+ except Exception as eee:
265
+ print(eee)
266
+ session.rollback()
267
+ except Exception as e:
268
+ print(e)
269
+ return
270
+ except Exception as ee:
271
+ print(ee)
272
+ break
170
273
 
171
274
  def delete_groups_uid(self):
172
275
  with Session(ENGINE) as session:
@@ -182,14 +285,13 @@ class OccurancesUi:
182
285
  for which in whiches:
183
286
  try:
184
287
  which=int(which)
185
- if which in range(0,cta):
288
+ if which in range(0,cta+1):
186
289
  guid=search[which].group_uid
187
290
  x=session.query(Occurances).filter(Occurances.group_uid==guid).delete()
188
291
  session.commit()
189
- return
190
-
191
292
  except Exception as e:
192
293
  print(e)
294
+ return
193
295
  except Exception as ee:
194
296
  print(ee)
195
297
  break
@@ -208,16 +310,15 @@ class OccurancesUi:
208
310
  for which in whiches:
209
311
  try:
210
312
  which=int(which)
211
- print(which,which in range(0,cta),cta,range(0,cta))
212
- if which in range(0,cta):
313
+ #print(which,which in range(0,cta),cta,range(0,cta))
314
+ if which in range(0,cta+1):
213
315
  guid=search[which].group_name
214
316
  print(guid)
215
317
  x=session.query(Occurances).filter(Occurances.group_name==search[which].group_name).delete()
216
318
  session.commit()
217
- return
218
-
219
319
  except Exception as e:
220
320
  print(e)
321
+ return
221
322
  except Exception as ee:
222
323
  print(ee)
223
324
  break
@@ -236,14 +337,14 @@ class OccurancesUi:
236
337
  for which in whiches:
237
338
  try:
238
339
  which=int(which)
239
- if which in range(0,cta):
340
+ #print(which,which in range(0,cta),cta,range(0,cta))
341
+ if which in range(0,cta+1):
240
342
  oid=search[which].oid
241
343
  x=session.query(Occurances).filter(Occurances.oid==oid).delete()
242
344
  session.commit()
243
- return
244
-
245
345
  except Exception as e:
246
346
  print(e)
347
+ return
247
348
  except Exception as ee:
248
349
  print(ee)
249
350
  break
@@ -257,46 +358,6 @@ class OccurancesUi:
257
358
  for num, i in enumerate(results):
258
359
  self.master_display(i,num,ct)
259
360
 
260
- def search_select(self,rTYPE=list,display=True):
261
- '''Search for, select,
262
- display selected, or
263
- return selected as:
264
- list of Occurances
265
- a single Occurance
266
-
267
- '''
268
- with Session(ENGINE) as session:
269
- stext=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What are you looking for?",helpText="text data to search for",data="string")
270
- if stext is None:
271
- return
272
- elif stext in ['d','']:
273
- pass
274
-
275
- query=session.query(Occurances)
276
- text_fields=[]
277
- text_query_fields=[]
278
- #setup filters for stext
279
-
280
- query=orderQuery(query,Occurances.created_dtoe,inverse=True)
281
- results=query.all()
282
- def display_results(results,session,query):
283
- pass
284
- if isinstance(rTYPE,list) or rType is list:
285
- if display:
286
- display_results(results,session,query)
287
- else:
288
- #list selector here
289
- return results
290
- elif isinstance(rTYPE,Occurances) or rType is Occurances:
291
- if display:
292
- display_results(results,session,query)
293
- else:
294
- pass
295
- #Occurance selector here
296
- return results
297
- else:
298
- display_results(results,session,query)
299
-
300
361
  def fix_table(self):
301
362
  Occurances.__table__.drop(ENGINE)
302
363
  Occurances.metadata.create_all(ENGINE)
@@ -348,6 +409,26 @@ class OccurancesUi:
348
409
  'desc':f"list all",
349
410
  'exec':self.list_all,
350
411
  },
412
+ uuid1():{
413
+ 'cmds':generate_cmds(startcmd=['edit','edt','ed'],endCmd=['occurance','cntr','selected','s',]),
414
+ 'desc':f"edit occurances data",
415
+ 'exec':self.edit_selected,
416
+ },
417
+ uuid1():{
418
+ 'cmds':generate_cmds(startcmd=['edit','edt','ed'],endCmd=['quantity','qty','amnt','amount']),
419
+ 'desc':f"edit occurances quantity only",
420
+ 'exec':self.edit_selected_qty,
421
+ },
422
+ uuid1():{
423
+ 'cmds':generate_cmds(startcmd=['cp','copy','cpy'],endCmd=['2new','2 new',' ','']),
424
+ 'desc':f"copy all details of Occurances to new Occurance except for quantity and uids prompting for user provided changes to old",
425
+ 'exec':self.copy_to_new,
426
+ },
427
+ uuid1():{
428
+ 'cmds':generate_cmds(startcmd=['cp','copy','cpy'],endCmd=['2new np','2 new np','2nw np','2 new no prompt','2new no-prompt']),
429
+ 'desc':f"copy all details of Occurances to new Occurance except for quantity and uids prompting for user provided changes to old",
430
+ 'exec':lambda self=self:self.copy_to_new(prompted=False),
431
+ },
351
432
  }
352
433
 
353
434
  htext=[]
radboy/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION='0.0.501'
1
+ VERSION='0.0.502'
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: radboy
3
- Version: 0.0.501
3
+ Version: 0.0.502
4
4
  Summary: A small example package
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=Lt2reA6xchq3U7Y08DvkrHboZ25i1ts7X2E9gSIwcVg,41101
7
7
  radboy/Run.py,sha256=JUoCTHnzQBv7n8PB2_i93ANdAC_iW__RkAge8esCnk4,76
8
- radboy/__init__.py,sha256=PkQJnfuIp5bsvc3U6hS8hBIwanUJE5wkzIWo8MShcM0,17
8
+ radboy/__init__.py,sha256=Us27Bqzc2h2YT-8rjX2f1imPTMI9oyE6_sdTy5_ht9I,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
@@ -92,7 +92,7 @@ radboy/DB/SMLabelImporter.py,sha256=eUoBDxVUUEKGL2g_PwkASM67ZB7FmXtSnn4bCagskhY,
92
92
  radboy/DB/__init__.py,sha256=JiigA9B7GalP7YuRdcwyGDu5PDSBahoi0lLjtScxlN8,49
93
93
  radboy/DB/blankDataFile.py,sha256=YX_05Usi71UpDkZN9UTMYwUipbTndTAtEgqzBEga0kE,9285
94
94
  radboy/DB/config.py,sha256=bvu43dUl1_yO3Zq3gsLuenGUgJSiS3S9Cs6ppFEvZbg,239
95
- radboy/DB/db.py,sha256=lOiHfXdIcMOi8GkMejpuMLubAJ0uvzj0ofrJlo0Ou_E,246602
95
+ radboy/DB/db.py,sha256=lFGyGn4ZD6PDg3dOQZxRCk3HLLp88cGrpBlUyiB2mhc,246363
96
96
  radboy/DB/glossary_db.py,sha256=1_qxeEpjjEtpWB_eDjsgJisimLv7OBm75MuqM-Lt6zg,28218
97
97
  radboy/DB/masterLookup.py,sha256=DBaM2uscG3_X5dek49wjdnOzhrjWhKgvOEz_umdz0mY,4566
98
98
  radboy/DB/msg.txt,sha256=YxWed6A6tuP1djJ5QPS2Rz3ING4TKKf8kUiCCPtzHXE,7937
@@ -127,7 +127,7 @@ radboy/DB/__pycache__/config.cpython-312.pyc,sha256=Qo7E6MHrF6yqvKgepNFyCoekZXiv
127
127
  radboy/DB/__pycache__/config.cpython-313.pyc,sha256=_8wCIg_3jhyJjxnExD2Sm6aY-uZTw036p7Ki5znL7dc,376
128
128
  radboy/DB/__pycache__/db.cpython-311.pyc,sha256=rNgigyBd0D-cg1JxKAS8t0B_k0IEJivgVlRaZE10Xis,210105
129
129
  radboy/DB/__pycache__/db.cpython-312.pyc,sha256=ANDJPC0RoavbmSKFxG15vC7B4rEGyVt7xRJt7XGY3OA,334609
130
- radboy/DB/__pycache__/db.cpython-313.pyc,sha256=5GJPTLCBcrX_euyOk-5FEcWTqH7cLsWAp24cuPIPg2k,392546
130
+ radboy/DB/__pycache__/db.cpython-313.pyc,sha256=iCo8Bq54dG0hlAzKeAXOSRUs8t6gPQomS7rg5qDjuc4,392241
131
131
  radboy/DB/__pycache__/glossary_db.cpython-312.pyc,sha256=8UL-29cKqtKovx0BANm6kzKKteef1BW_2qF3wumzst4,36023
132
132
  radboy/DB/__pycache__/glossary_db.cpython-313.pyc,sha256=Ke9bkvllGv5CK0JdT9DRvQ3MOdrXxoYv7TVLNkqLux0,36582
133
133
  radboy/DB/__pycache__/masterLookup.cpython-312.pyc,sha256=bQiOkmMwwHgcO18tYSWGQ-YUff4GQlKVhBMp1GoWAqY,6324
@@ -264,7 +264,7 @@ radboy/ModuleTemplate/Tasks.py,sha256=RF4sWnLH4FyzMU8AHOov7WP24-udd96-l9c9SvbIP_
264
264
  radboy/ModuleTemplate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
265
265
  radboy/ModuleTemplate/__pycache__/Tasks.cpython-311.pyc,sha256=rllpmYgt71yfhr2e08OB_iYnlcO5eIIGCQErAj6ikTA,1989
266
266
  radboy/ModuleTemplate/__pycache__/__init__.cpython-311.pyc,sha256=J6kTs2HBMSDNpjWxKLwzOfg70xEDLVtulYrYvCVF3Mw,239
267
- radboy/Occurances/Occurances.py,sha256=z88erzQoSlC1d9ZVZ-LeyfGt9HI6cchWddc2imPlc20,10743
267
+ radboy/Occurances/Occurances.py,sha256=ll7QGbkZRmrSKBhJxUW1GaEB4c2spQejkeLSYVAMQ0I,14357
268
268
  radboy/Occurances/__init__.py,sha256=Xv528_TFNgaC7fr3ykgYG4qUxoz-_8dQMEAhDBAtdXw,930
269
269
  radboy/Of/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
270
270
  radboy/Of/of.py,sha256=l5YyMVe4rixyYeJZ6BKzkVEr7lk2SuMyPxm14LMwF9c,1341
@@ -398,7 +398,7 @@ radboy/__pycache__/Run.cpython-311.pyc,sha256=G_UEfMtkLRjR6ZpGA_BJzGenuaCcP469Y9
398
398
  radboy/__pycache__/Run.cpython-312.pyc,sha256=v4xolc3mHyla991XhpYBUbBHYT0bnJ1gE-lkFoQ4GFA,241
399
399
  radboy/__pycache__/__init__.cpython-311.pyc,sha256=R-DVbUioMOW-Fnaq7FpT5F1a5p0q3b_RW-HpLRArCAY,242
400
400
  radboy/__pycache__/__init__.cpython-312.pyc,sha256=FsFzLXOlTK8_7ixoPZzakkR8Wibt-DvXLFh-oG2QlPw,164
401
- radboy/__pycache__/__init__.cpython-313.pyc,sha256=xV3wNP9GOlWOXQQvssv_Whaj-sYO9zUNttOb7E171dU,165
401
+ radboy/__pycache__/__init__.cpython-313.pyc,sha256=6-d12VLxilYwsrI29rhnmzNU2ME2iS6onbVZS7eh_TI,165
402
402
  radboy/__pycache__/__init__.cpython-39.pyc,sha256=D48T6x6FUeKPfubo0sdS_ZUut3FmBvPMP7qT6rYBZzU,275
403
403
  radboy/__pycache__/possibleCode.cpython-311.pyc,sha256=zFiHyzqD8gUnIWu4vtyMYIBposiRQqaRXfcT_fOl4rU,20882
404
404
  radboy/__pycache__/possibleCode.cpython-312.pyc,sha256=tk_CO-AcsO3YZj5j6vEsw3g37UmEzWc5YgeWEoJEUg4,27922
@@ -423,7 +423,7 @@ radboy/tkGui/Images/__pycache__/__init__.cpython-311.pyc,sha256=tXBYpqbOlZ24B1BI
423
423
  radboy/tkGui/__pycache__/BeginnersLuck.cpython-311.pyc,sha256=xLQOnV1wuqHGaub16mPX0dDMGU9ryCeLtNz5e517_GE,3004
424
424
  radboy/tkGui/__pycache__/Review.cpython-311.pyc,sha256=wKq24iM6Xe2OampgZ7-8U6Nvmgs2y-qWOrGwtWhc75k,4047
425
425
  radboy/tkGui/__pycache__/__init__.cpython-311.pyc,sha256=BX7DBn5qbvKTvlrKOP5gzTBPBTeTgSMjBW6EMl7N8e0,230
426
- radboy-0.0.501.dist-info/METADATA,sha256=94ocYU0eHzv3n1Uxw-iVgtSuRFvLJhlDLoIDm0BN0BM,1601
427
- radboy-0.0.501.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
428
- radboy-0.0.501.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
429
- radboy-0.0.501.dist-info/RECORD,,
426
+ radboy-0.0.502.dist-info/METADATA,sha256=v8Lzb-Jq6PpPYX-siwJ9DtjSyZUrRwU5QJup-iaZCe8,1601
427
+ radboy-0.0.502.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
428
+ radboy-0.0.502.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
429
+ radboy-0.0.502.dist-info/RECORD,,