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

Files changed (39) hide show
  1. radboy/Comm/RxTx.py +4 -493
  2. radboy/Comm/__pycache__/RxTx.cpython-313.pyc +0 -0
  3. radboy/CookBook/CookBook.py +4 -0
  4. radboy/DB/ExerciseTracker.py +64 -27
  5. radboy/DB/GEMINI.py +146 -0
  6. radboy/DB/Prompt.py +150 -7
  7. radboy/DB/__pycache__/ExerciseTracker.cpython-313.pyc +0 -0
  8. radboy/DB/__pycache__/Prompt.cpython-313.pyc +0 -0
  9. radboy/DB/__pycache__/db.cpython-313.pyc +0 -0
  10. radboy/DB/db.py +141 -10
  11. radboy/DayLog/DayLogger.py +1 -1
  12. radboy/DayLog/__pycache__/DayLogger.cpython-313.pyc +0 -0
  13. radboy/FB/FBMTXT.py +48 -1
  14. radboy/FB/__pycache__/FBMTXT.cpython-313.pyc +0 -0
  15. radboy/HowDoYouDefineMe/CoreEmotions.py +268 -9
  16. radboy/Lookup2/Lookup2.py +31 -1
  17. radboy/Lookup2/__pycache__/Lookup2.cpython-313.pyc +0 -0
  18. radboy/RNE/RNE.py +7 -0
  19. radboy/RNE/__pycache__/RNE.cpython-313.pyc +0 -0
  20. radboy/TasksMode/SetEntryNEU.py +16 -2
  21. radboy/TasksMode/Tasks.py +546 -101
  22. radboy/TasksMode/__pycache__/SetEntryNEU.cpython-313.pyc +0 -0
  23. radboy/TasksMode/__pycache__/Tasks.cpython-313.pyc +0 -0
  24. radboy/Unified/BACKUP.py +443 -0
  25. radboy/Unified/Unified.py +2 -321
  26. radboy/Unified/__pycache__/Unified.cpython-313.pyc +0 -0
  27. radboy/Unified/__pycache__/bareCA.cpython-313.pyc +0 -0
  28. radboy/Unified/__pycache__/clearalll.cpython-313.pyc +0 -0
  29. radboy/Unified/bareCA.py +26 -2
  30. radboy/Unified/clearalll.py +6 -0
  31. radboy/__init__.py +1 -1
  32. radboy/__pycache__/__init__.cpython-313.pyc +0 -0
  33. radboy/code.png +0 -0
  34. radboy/preloader/preloader.py +70 -0
  35. radboy/preloader/preloader_func.py +688 -2
  36. {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/METADATA +1 -1
  37. {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/RECORD +39 -37
  38. {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/WHEEL +0 -0
  39. {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/top_level.txt +0 -0
radboy/DB/db.py CHANGED
@@ -1187,6 +1187,37 @@ For hot food, one of the notable exceptions is "Hot Baked Goods," like pretzels
1187
1187
  ShelfCount=Column(Integer,default=0)
1188
1188
  #LoadCount=1,PalletCount=1,ShelfCount=1
1189
1189
 
1190
+ Expiry=Column(DateTime,default=None)
1191
+ BestBy=Column(DateTime,default=None)
1192
+ AquisitionDate=Column(DateTime,default=None)
1193
+ '''
1194
+ #__init__ def #AquisitionDate=None,BestBy=None,Expiry=None
1195
+
1196
+ #inside __init__
1197
+ self.AquisitionDate=AquisitionDate
1198
+ self.Expiry=Expiry
1199
+ self.BestBy=BestBy
1200
+
1201
+ #in def saveListExtended(self,num):
1202
+ Expiry = {self.Expiry}
1203
+ BestBy = {self.BestBy}
1204
+ AquisitionDate = {self.AquisitionDate}
1205
+
1206
+ #in def listdisplay_extended(self,num):
1207
+ ------------- Dates -----------------------------------
1208
+ {Fore.light_cyan}Expiry = {Fore.light_green}{self.Expiry}{Style.reset}
1209
+ {Fore.light_cyan}BestBy = {Fore.light_green}{self.BestBy}{Style.reset}
1210
+ {Fore.light_cyan}AquisitionDate = {Fore.light_green}{self.AquisitionDate}{Style.reset}
1211
+
1212
+ #in def __repr__
1213
+ ------------- Dates -----------------------------------
1214
+ {Fore.light_cyan}Expiry{Fore.grey_70}{types['Expiry']}{Fore.light_cyan}={Fore.light_green}{self.Expiry}{Style.reset}
1215
+ {Fore.light_cyan}BestBy{Fore.grey_70}{types['BestBy']}{Fore.light_cyan}={Fore.light_green}{self.BestBy}{Style.reset}
1216
+ {Fore.light_cyan}AquisitionDate{Fore.grey_70}{types['AquisitionDate']}{Fore.light_cyan}={Fore.light_green}{self.AquisitionDate}{Style.reset}
1217
+
1218
+
1219
+ '''
1220
+
1190
1221
  def csv_headers(self):
1191
1222
  headers=[]
1192
1223
  for i in self.__table__.columns:
@@ -1273,7 +1304,7 @@ For hot food, one of the notable exceptions is "Hot Baked Goods," like pretzels
1273
1304
  if k in [s.name for s in self.__table__.columns]:
1274
1305
  setattr(self,k,kwargs.get(k))
1275
1306
 
1276
- def __init__(self,Barcode,Code,upce2upca='',Name='',InList=True,Price=0.0,Note='',Size='',CaseCount=1,Shelf=0,BackRoom=0,Display_1=0,Display_2=0,Display_3=0,Display_4=0,Display_5=0,Display_6=0,Stock_Total=0,Timestamp=datetime.now().timestamp(),EntryId=None,Location='///',ListQty=0.0,Image='',CHKSTND_SPLY=0,WD_DSPLY=0,FLRL_CHP_DSPLY=0,FLRL_WTR_DSPLY=0,SBX_WTR_KLR=0,SBX_CHP_DSPLY=0,SBX_WTR_DSPLY=0,Facings=0,Tags='',CaseID_6W='',CaseID_BR='',CaseID_LD='',ALT_Barcode='',DUP_Barcode='',CRV=0.0,Tax=0.0,TaxNote='',userUpdated=False,LoadCount=1,PalletCount=1,ShelfCount=1,Description='',Distress=0,UnitsDeep=1,UnitsHigh=1):
1307
+ def __init__(self,Barcode,Code,upce2upca='',Name='',InList=True,Price=0.0,Note='',Size='',CaseCount=1,Shelf=0,BackRoom=0,Display_1=0,Display_2=0,Display_3=0,Display_4=0,Display_5=0,Display_6=0,Stock_Total=0,Timestamp=datetime.now().timestamp(),EntryId=None,Location='///',ListQty=0.0,Image='',CHKSTND_SPLY=0,WD_DSPLY=0,FLRL_CHP_DSPLY=0,FLRL_WTR_DSPLY=0,SBX_WTR_KLR=0,SBX_CHP_DSPLY=0,SBX_WTR_DSPLY=0,Facings=0,Tags='',CaseID_6W='',CaseID_BR='',CaseID_LD='',ALT_Barcode='',DUP_Barcode='',CRV=0.0,Tax=0.0,TaxNote='',userUpdated=False,LoadCount=1,PalletCount=1,ShelfCount=1,Description='',Distress=0,UnitsDeep=1,UnitsHigh=1,AquisitionDate=None,BestBy=None,Expiry=None):
1277
1308
  if EntryId:
1278
1309
  self.EntryId=EntryId
1279
1310
  self.CRV=CRV
@@ -1311,6 +1342,10 @@ For hot food, one of the notable exceptions is "Hot Baked Goods," like pretzels
1311
1342
  InList=True
1312
1343
  self.UnitsHigh=UnitsHigh
1313
1344
  self.UnitsDeep=UnitsDeep
1345
+
1346
+ self.AquisitionDate=AquisitionDate
1347
+ self.Expiry=Expiry
1348
+ self.BestBy=BestBy
1314
1349
  if isinstance(userUpdated,str):
1315
1350
  try:
1316
1351
  self.InList=eval(InList)
@@ -1611,6 +1646,9 @@ CHKSTND_SPLY={self.CHKSTND_SPLY}
1611
1646
  Distress={self.Distress} #not added to total
1612
1647
  Total = {total}
1613
1648
  Total(w/o BR+) - Backroom = {(total-self.BackRoom)-self.BackRoom}
1649
+ Expiry = {self.Expiry}
1650
+ BestBy = {self.BestBy}
1651
+ AquisitionDate = {self.AquisitionDate}
1614
1652
  -------------{num}-------------
1615
1653
  """
1616
1654
 
@@ -1728,6 +1766,10 @@ deducted from Total as remainder is to be filled from LOAD{Style.reset}
1728
1766
  {Fore.medium_violet_red}Total Product Handled/To Be Handled Value: {Fore.spring_green_3a}{total_value}{Style.reset}
1729
1767
  {Fore.medium_violet_red}Total Product Handled/To Be Handled Value*CaseCount: {Fore.spring_green_3a}{total_value_case}{Style.reset}
1730
1768
  {Fore.orange_3}Distressed Product:{Fore.light_red}{self.Distress}{Style.reset}
1769
+ ------------- Dates ----------------------
1770
+ {Fore.light_cyan}Expiry = {Fore.light_green}{self.Expiry}{Style.reset}
1771
+ {Fore.light_cyan}BestBy = {Fore.light_green}{self.BestBy}{Style.reset}
1772
+ {Fore.light_cyan}AquisitionDate = {Fore.light_green}{self.AquisitionDate}{Style.reset}
1731
1773
  -------------{Style.bold+Style.underline+Fore.orange_red_1}{num}{Style.reset}-------------
1732
1774
  """
1733
1775
  print(msg)
@@ -1802,18 +1844,32 @@ deducted from Total as remainder is to be filled from LOAD{Style.reset}
1802
1844
 
1803
1845
  def seeShort(self):
1804
1846
  rebar=self.rebar()
1805
- ROUNDTO=int(detectGetOrSet("TotalSpent ROUNDTO default",3,setValue=False,literal=True))
1806
- default_taxrate=float(detectGetOrSet("Tax Rate",0.0925,setValue=False,literal=True))
1807
- price=round(self.Price,ROUNDTO)+round(self.CRV,ROUNDTO)
1847
+ ROUNDTO=decc(detectGetOrSet("TotalSpent ROUNDTO default",3,setValue=False,literal=True))
1848
+ default_taxrate=decc(detectGetOrSet("Tax Rate",0.0925,setValue=False,literal=True))
1849
+ price=decc(self.Price)+decc(self.CRV)
1808
1850
 
1809
- formula=round(price+self.Tax,ROUNDTO)
1810
-
1811
- msg=f''' {Fore.slate_blue_1}{Style.underline}{'-'*5}{Style.reset}{Style.bold} Short Data {Style.reset}
1851
+ formula=decc(price+decc(self.Tax))
1852
+ location=f"{Fore.light_cyan}LCTN({Fore.light_steel_blue}{self.Location}{Fore.light_cyan})"
1853
+ msg=f''' {Fore.slate_blue_1}{Style.underline}{'-'*5}{Style.reset}{Style.bold} Short Data @ {location}{Style.reset}
1812
1854
  {Fore.light_yellow}Name({Fore.pale_green_1b}{self.Name}{Fore.light_yellow}) {Fore.light_magenta}Price Per Unit({Fore.slate_blue_1}prc={self.Price}{Fore.light_magenta},crv={self.CRV},tax={self.Tax},ttl={formula}){Style.reset} {Fore.misty_rose_3}EID({Fore.pale_green_1b}{self.EntryId}{Fore.light_yellow}) {Fore.spring_green_3a}[BCD/UPC[A/E]/EAN[8/13]/GTIN](cd={Fore.light_magenta}{rebar},{Fore.chartreuse_1}no_sep={self.rebar(skip_sep=True)}{Fore.spring_green_3a}){Style.reset}{Fore.slate_blue_1} -{Fore.cyan}> {Fore.orange_red_1}[SHELF/TAG/CIC/STR_CD]({Fore.light_red}cd={self.cfmt(self.Code)}{Fore.orange_red_1}){Style.reset}'''
1813
1855
  return msg
1814
1856
 
1815
1857
  pinfo=f"{Back.green_3a}{Fore.red}**{Fore.white}{Style.bold}Product/Entry Info{Fore.red}- #REPLACE#**{Style.reset} "
1816
1858
  def __repr__(self):
1859
+ if self.Expiry is not None:
1860
+ expiry_age=self.Expiry-datetime.now()
1861
+ else:
1862
+ expiry_age=timedelta(days=0)
1863
+ if self.BestBy is not None:
1864
+ bestby_age=self.BestBy-datetime.now()
1865
+ else:
1866
+ bestby_age=timedelta(days=0)
1867
+
1868
+ if self.AquisitionDate is not None:
1869
+ aqd_age=self.AquisitionDate-datetime.now()
1870
+ else:
1871
+ aqd_age=timedelta(days=0)
1872
+
1817
1873
  pinfo=self.pinfo
1818
1874
  total_value=self.total_value(CaseMode=False)
1819
1875
  total_value_case=self.total_value()
@@ -1875,6 +1931,12 @@ deducted from Total as remainder is to be filled from LOAD{Style.reset}
1875
1931
  {Fore.light_steel_blue}PalletCount{Style.reset}:{Fore.grey_70}{types['PalletCount']}{Style.reset}={self.PalletCount},
1876
1932
  {Fore.light_steel_blue}LoadCount{Style.reset}:{Fore.grey_70}{types['LoadCount']}{Style.reset}={self.LoadCount},
1877
1933
 
1934
+ {Fore.orange_3}Distressed Product:{Fore.light_red}{self.Distress}{Style.reset}
1935
+ ------------- Dates -----------------
1936
+ {Fore.light_cyan}Expiry{Fore.grey_70}[{types['Expiry']}{Fore.light_cyan}]={Fore.light_green}{self.Expiry}[{expiry_age} old]{Style.reset}
1937
+ {Fore.light_cyan}BestBy{Fore.grey_70}[{types['BestBy']}{Fore.light_cyan}]={Fore.light_green}{self.BestBy}[{bestby_age} old]{Style.reset}
1938
+ {Fore.light_cyan}AquisitionDate{Fore.grey_70}[{types['AquisitionDate']}{Fore.light_cyan}]={Fore.light_green}{self.AquisitionDate}[{aqd_age} old]{Style.reset}
1939
+
1878
1940
  {Fore.sky_blue_2}Size{Style.reset}:{Fore.grey_70}{types['Size']}{Style.reset}={self.Size}
1879
1941
  {Fore.tan}Image[{Fore.dark_goldenrod}Exists:{Fore.deep_pink_3b}{self.imageExists()}{Style.reset}{Fore.tan}]{Style.reset}:{Fore.grey_70}{types['Image']}{Style.reset}={self.Image}
1880
1942
  {Fore.slate_blue_1}{Style.underline}{'-'*5}{Style.reset}{Style.bold} Short Data {Style.reset}{Fore.slate_blue_1}{Style.underline}{'-'*5}{Style.reset}
@@ -2043,6 +2105,37 @@ class DayLog(BASE,EntryExtras):
2043
2105
  WD_DSPLY=WD_DSPLY=Column(Integer)
2044
2106
  CHKSTND_SPLY=CHKSTND_SPLY=Column(Integer)
2045
2107
 
2108
+ Expiry=Column(DateTime,default=None)
2109
+ BestBy=Column(DateTime,default=None)
2110
+ AquisitionDate=Column(DateTime,default=None)
2111
+ '''
2112
+ #__init__ def #AquisitionDate=None,BestBy=None,Expiry=None
2113
+
2114
+ #inside __init__
2115
+ self.AquisitionDate=AquisitionDate
2116
+ self.Expiry=Expiry
2117
+ self.BestBy=BestBy
2118
+
2119
+ #in def saveListExtended(self,num):
2120
+ Expiry = {self.Expiry}
2121
+ BestBy = {self.BestBy}
2122
+ AquisitionDate = {self.AquisitionDate}
2123
+
2124
+ #in def listdisplay_extended(self,num):
2125
+ ------------- Dates ----------------------------------------------------------------------
2126
+ {Fore.light_cyan}Expiry = {Fore.light_green}{self.Expiry}{Style.reset}
2127
+ {Fore.light_cyan}BestBy = {Fore.light_green}{self.BestBy}{Style.reset}
2128
+ {Fore.light_cyan}AquisitionDate = {Fore.light_green}{self.AquisitionDate}{Style.reset}
2129
+
2130
+ #in def __repr__
2131
+ ------------- Dates ----------------------------------------------------------------------
2132
+ {Fore.light_cyan}Expiry{Fore.grey_70}{types['Expiry']}{Fore.light_cyan}={Fore.light_green}{self.Expiry}{Style.reset}
2133
+ {Fore.light_cyan}BestBy{Fore.grey_70}{types['BestBy']}{Fore.light_cyan}={Fore.light_green}{self.BestBy}{Style.reset}
2134
+ {Fore.light_cyan}AquisitionDate{Fore.grey_70}{types['AquisitionDate']}{Fore.light_cyan}={Fore.light_green}{self.AquisitionDate}{Style.reset}
2135
+
2136
+
2137
+ '''
2138
+
2046
2139
  def csv_headers(self):
2047
2140
  headers=[]
2048
2141
  for i in self.__table__.columns:
@@ -2116,9 +2209,12 @@ class DayLog(BASE,EntryExtras):
2116
2209
  {Fore.light_yellow}Name({Fore.pale_green_1b}{self.Name}{Fore.light_yellow}) {Fore.light_magenta}Price Per Unit({Fore.slate_blue_1}prc={self.Price}{Fore.light_magenta},crv={self.CRV},tax={self.Tax},ttl={formula}){Style.reset} {Fore.misty_rose_3}EID({Fore.pale_green_1b}{self.EntryId}{Fore.light_yellow}) {Fore.spring_green_3a}[BCD/UPC[A/E]/EAN[8/13]/GTIN](cd={Fore.light_magenta}{rebar},{Fore.chartreuse_1}no_sep={self.rebar(skip_sep=True)}{Fore.spring_green_3a}){Style.reset}{Fore.slate_blue_1} -{Fore.cyan}> {Fore.orange_red_1}[SHELF/TAG/CIC/STR_CD]({Fore.light_red}cd={self.cfmt(self.Code)}{Fore.orange_red_1},{Fore.light_steel_blue}DayLogId={self.DayLogId},{Fore.pale_green_1b}EntryId={self.EntryId}){Style.reset}'''
2117
2210
  return msg
2118
2211
 
2119
- def __init__(self,Barcode,Code,upce2upca='',Name='',InList=False,Price=0.0,Note='',Size='',CaseCount=0,Shelf=0,BackRoom=0,Display_1=0,Display_2=0,Display_3=0,Display_4=0,Display_5=0,Display_6=0,Stock_Total=0,Timestamp=datetime.now().timestamp(),EntryId=None,Location='///',ListQty=0.0,Image='',CHKSTND_SPLY=0,WD_DSPLY=0,FLRL_CHP_DSPLY=0,FLRL_WTR_DSPLY=0,SBX_WTR_KLR=0,SBX_CHP_DSPLY=0,SBX_WTR_DSPLY=0,Facings=0,Tags='',CaseID_6W='',CaseID_BR='',CaseID_LD='',ALT_Barcode='',DUP_Barcode='',DayLogDate=datetime.now(),DayLogId=None,CRV=0.0,Tax=0.0,TaxNote='',userUpdated=False,LoadCount=1,PalletCount=1,ShelfCount=1,Description='',Distress=0,UnitsDeep=1,UnitsHigh=1):
2212
+ def __init__(self,Barcode,Code,upce2upca='',Name='',InList=False,Price=0.0,Note='',Size='',CaseCount=0,Shelf=0,BackRoom=0,Display_1=0,Display_2=0,Display_3=0,Display_4=0,Display_5=0,Display_6=0,Stock_Total=0,Timestamp=datetime.now().timestamp(),EntryId=None,Location='///',ListQty=0.0,Image='',CHKSTND_SPLY=0,WD_DSPLY=0,FLRL_CHP_DSPLY=0,FLRL_WTR_DSPLY=0,SBX_WTR_KLR=0,SBX_CHP_DSPLY=0,SBX_WTR_DSPLY=0,Facings=0,Tags='',CaseID_6W='',CaseID_BR='',CaseID_LD='',ALT_Barcode='',DUP_Barcode='',DayLogDate=datetime.now(),DayLogId=None,CRV=0.0,Tax=0.0,TaxNote='',userUpdated=False,LoadCount=1,PalletCount=1,ShelfCount=1,Description='',Distress=0,UnitsDeep=1,UnitsHigh=1,AquisitionDate=None,BestBy=None,Expiry=None):
2120
2213
  if EntryId:
2121
2214
  self.EntryId=EntryId
2215
+ self.AquisitionDate=AquisitionDate
2216
+ self.Expiry=Expiry
2217
+ self.BestBy=BestBy
2122
2218
  self.userUpdated=userUpdated
2123
2219
  self.Distress=Distress
2124
2220
  self.UnitsHigh=UnitsHigh
@@ -2419,6 +2515,9 @@ CHKSTND_SPLY={self.CHKSTND_SPLY}
2419
2515
  Total = {total}
2420
2516
  Distressed={self.Distress} #not included in total
2421
2517
  Total(w/o BR+) - Backroom = {(total-self.BackRoom)-self.BackRoom}
2518
+ Expiry = {self.Expiry}
2519
+ BestBy = {self.BestBy}
2520
+ AquisitionDate = {self.AquisitionDate}
2422
2521
  -------------{num}-------------
2423
2522
  """
2424
2523
 
@@ -2494,6 +2593,10 @@ Facings={self.Facings}
2494
2593
  {Fore.yellow_4b}{Style.underline}If Product was Pulled From BR to Fill Shelf, and needs to be
2495
2594
  deducted from Total as remainder is to be filled from LOAD{Style.reset}
2496
2595
  {Fore.cyan}{Style.bold}2->{Style.reset}{Fore.hot_pink_2}Total(w/o BR+) - Backroom{Style.reset} = {Fore.light_yellow}{(total-self.BackRoom)-self.BackRoom}{Style.reset}
2596
+ ------------- Dates ------------------
2597
+ {Fore.light_cyan}Expiry = {Fore.light_green}{self.Expiry}{Style.reset}
2598
+ {Fore.light_cyan}BestBy = {Fore.light_green}{self.BestBy}{Style.reset}
2599
+ {Fore.light_cyan}AquisitionDate = {Fore.light_green}{self.AquisitionDate}{Style.reset}
2497
2600
  -------------{Style.bold+Style.underline+Fore.orange_red_1}{num}{Style.reset}-------------
2498
2601
  """
2499
2602
  print(msg)
@@ -2519,6 +2622,19 @@ deducted from Total as remainder is to be filled from LOAD{Style.reset}
2519
2622
  return ''
2520
2623
 
2521
2624
  def __repr__(self):
2625
+ if self.Expiry is not None:
2626
+ expiry_age=self.Expiry-datetime.now()
2627
+ else:
2628
+ expiry_age=timedelta(days=0)
2629
+ if self.BestBy is not None:
2630
+ bestby_age=self.BestBy-datetime.now()
2631
+ else:
2632
+ bestby_age=timedelta(days=0)
2633
+
2634
+ if self.AquisitionDate is not None:
2635
+ aqd_age=self.AquisitionDate-datetime.now()
2636
+ else:
2637
+ aqd_age=timedelta(days=0)
2522
2638
  types={i.name:str(i.type) for i in self.__table__.columns}
2523
2639
  m= f"""
2524
2640
  {Style.bold}{Style.underline}{Fore.pale_green_1b}Daylog{Style.reset}(
@@ -2577,7 +2693,11 @@ deducted from Total as remainder is to be filled from LOAD{Style.reset}
2577
2693
  {Fore.light_steel_blue}ShelfCount{Style.reset}:{Fore.grey_70}{types['ShelfCount']}{Style.reset}={self.ShelfCount},
2578
2694
  {Fore.light_steel_blue}PalletCount{Style.reset}:{Fore.grey_70}{types['PalletCount']}{Style.reset}={self.PalletCount},
2579
2695
  {Fore.light_steel_blue}LoadCount{Style.reset}:{Fore.grey_70}{types['LoadCount']}{Style.reset}={self.LoadCount},
2580
-
2696
+ ------------- Dates ---------------
2697
+ {Fore.light_cyan}Expiry{Fore.grey_70}[{types['Expiry']}] = {Fore.light_green}{self.Expiry}[{expiry_age} old]{Style.reset}
2698
+ {Fore.light_cyan}BestBy{Fore.grey_70}[{types['BestBy']}] = {Fore.light_green}{self.BestBy}[{bestby_age} old]{Style.reset}
2699
+ {Fore.light_cyan}AquisitionDate{Fore.grey_70}[{types['AquisitionDate']}] = {Fore.light_green}[{aqd_age} old]{self.AquisitionDate}{Style.reset}
2700
+
2581
2701
  {Fore.sky_blue_2}Size{Style.reset}:{Fore.grey_70}{types['Size']}{Style.reset}={self.Size}
2582
2702
  {Fore.tan}Image[{Fore.dark_goldenrod}Exists:{Fore.deep_pink_3b}{self.imageExists()}{Style.reset}{Fore.tan}]{Style.reset}:{Fore.grey_70}{types['Image']}{Style.reset}={self.Image}
2583
2703
  {Fore.orange_red_1}(Estimated/Inverted Shelf Qty) Shelf=ShelfCount - Qty {Fore.light_yellow}[{Fore.cyan}{self.ShelfCount}{Fore.light_yellow} -{Fore.cyan}{self.Shelf}{Fore.light_yellow}]={Fore.pale_green_1b}{self.ShelfCount-self.Shelf}{Style.reset}"""
@@ -4667,7 +4787,7 @@ class HistoryUi:
4667
4787
  ALL_LINES=session.query(PH).all()
4668
4788
  all_lines_ct=len(ALL_LINES)
4669
4789
 
4670
- max_lines=detectGetOrSet('PH_MAXLINES',10000)
4790
+ max_lines=detectGetOrSet('PH_MAXLINES',1000)
4671
4791
  if all_lines_ct >= max_lines:
4672
4792
  for num,line in enumerate(reversed(ALL_LINES)):
4673
4793
  if num <= max_lines:
@@ -5573,6 +5693,17 @@ class CookBook(BASE,Template):
5573
5693
  if k in [s.name for s in self.__table__.columns]:
5574
5694
  setattr(self,k,kwargs.get(k))
5575
5695
 
5696
+
5697
+ def __str__(self):
5698
+ msg=[]
5699
+ msg.append(__class__.__name__+"(")
5700
+ for i in self.__table__.columns:
5701
+ if getattr(self,i.name) is not None:
5702
+ x=f"{Fore.orange_red_1}{i.name}[{Fore.cyan}{i.type}{Fore.orange_red_1}]{Fore.light_green}={getattr(self,i.name)}{Style.reset}"
5703
+ msg.append(x)
5704
+ msg.append(")")
5705
+ return '\n'.join(msg)
5706
+
5576
5707
  try:
5577
5708
  CookBook.metadata.create_all(ENGINE)
5578
5709
  except Exception as e:
@@ -1903,7 +1903,7 @@ fxtbl - update table with correct columns
1903
1903
  self.listDate()
1904
1904
  elif what.lower() in 'cd|clear_date'.split("|"):
1905
1905
  self.clearDate()
1906
- elif what.lower() in 'reset DayLog'.split("|"):
1906
+ elif what.lower() in 'reset DayLog|rsd'.lower().split("|"):
1907
1907
  self.clearAllDL()
1908
1908
  elif what.lower() in 'ea|export_all'.split("|"):
1909
1909
  self.exportAllDL()
radboy/FB/FBMTXT.py CHANGED
@@ -9,6 +9,7 @@ from datetime import timedelta
9
9
  import calendar
10
10
  from colored import Fore,Back,Style
11
11
  import itertools
12
+ from uuid import uuid1
12
13
 
13
14
  def generate_cmds(startcmd,endCmd):
14
15
  cmd=(startcmd,endCmd)
@@ -304,13 +305,59 @@ def FormBuilderMkText(text,data,passThru=[],PassThru=True,alternative_false=None
304
305
  print(e)
305
306
  elif data.lower() in ['datetime','datetime-','datetime~']:
306
307
  try:
307
-
308
+ def regexSelect(ds):
309
+ fmt={}
310
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9][0-9]"),"%m#CHAR#%y"]
311
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9][0-9][0-9][0-9]"),"%m#CHAR#%Y"]
312
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9][0-9][0-9][0-9]"),"%m#CHAR#%Y"]
313
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9][0-9]"),"%m#CHAR#%y"]
314
+
315
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9][0-9].[0-9][0-9]"),"%m#CHAR#%d#CHAR#%y"]
316
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9][0-9].[0-9][0-9][0-9][0-9]"),"%m#CHAR#%d#CHAR#%Y"]
317
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9][0-9].[0-9][0-9][0-9][0-9]"),"%m#CHAR#%d#CHAR#%Y"]
318
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9][0-9].[0-9][0-9]"),"%m#CHAR#%d#CHAR#%y"]
319
+
320
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9][0-9].[0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%y@%H:%M"]
321
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9][0-9].[0-9][0-9][0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%Y@%H:%M"]
322
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9][0-9].[0-9][0-9][0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%Y@%H:%M"]
323
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9][0-9].[0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%y@%H:%M"]
324
+
325
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9].[0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%y@%H:%M"]
326
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9].[0-9][0-9][0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%Y@%H:%M"]
327
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9].[0-9][0-9][0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%Y@%H:%M"]
328
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9].[0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%y@%H:%M"]
329
+
330
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9].[0-9][0-9]@[0-9][0-9]:[0-9]"),"%m#CHAR#%d#CHAR#%y@%H:%M"]
331
+ fmt[str(uuid1())]=[re.compile(r"[0-1][0-9].[0-9].[0-9][0-9][0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%Y@%H:%M"]
332
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9].[0-9][0-9][0-9][0-9]@[0-9][0-9]:[0-9][0-9]"),"%m#CHAR#%d#CHAR#%Y@%H:%M"]
333
+ fmt[str(uuid1())]=[re.compile(r"[0-9].[0-9].[0-9][0-9]@[0-9][0-9]:[0-9]"),"%m#CHAR#%d#CHAR#%y@%H:%M"]
334
+
335
+ ct=len(fmt)
336
+ for num,i in enumerate(fmt):
337
+ print(db.std_colorize(fmt[i],num,ct))
338
+
339
+ for i in fmt:
340
+ if fmt[i][0].findall(ds) != []:
341
+ print(fmt[i][1])
342
+ for char in ds:
343
+ if char in string.punctuation:
344
+ try:
345
+ fmt[i][1]=fmt[i][1].replace("#CHAR#",char)
346
+ return True,datetime.strptime(ds,fmt[i][1])
347
+ except Exception as e:
348
+ print(e)
349
+
350
+ return False,None
351
+
308
352
  TODAY_IS=datetime.now()
309
353
  z=TODAY_IS
310
354
  if text.lower() in ['y','yes','1','t','true','+']:
311
355
  value=TM.Tasks.TasksMode(parent=None,engine=db.ENGINE,init_only=True).DateTimePkr()
312
356
  elif text.lower() in ['now',]:
313
357
  return datetime.now()
358
+ elif regexSelect(text.lower())[0] == True:
359
+ bild=regexSelect(text.lower())
360
+ return bild[-1]
314
361
  elif text.lower() in ['today',]:
315
362
  return datetime(year=TODAY_IS.year,month=TODAY_IS.month,day=TODAY_IS.day)
316
363
  elif text.lower() in ['tomorrow',]:
@@ -1,14 +1,273 @@
1
1
  from . import *
2
2
 
3
-
4
3
  @dataclass
5
- class EmotionCore:
6
- intensity:float=0
7
- name:str=''
8
- dtoe:datetime=datetime.now()
9
- note:str=''
4
+ class CookingConversion(BASE,Template):
5
+ ccid=Column(Integer,primary_key=True)
6
+ __tablename__="CookingConversions"
7
+ Mass_with_unit=Column(String,default='')
8
+ ResourceName=Column(String,default='butter')
9
+ Converts_To_Volume_With_Unit=Column(String,default='')
10
+
11
+ def __str__(self):
12
+ msg=[]
13
+ f=f"Cooking Conversion(ccid={self.ccid},{Fore.orange_red_1}Mass_with_unit='{Fore.light_steel_blue}{self.Mass_with_unit}{Fore.orange_red_1}' of ResourceName='{Fore.light_yellow}{self.ResourceName}' {Fore.medium_violet_red}~={Fore.magenta} Converts_To_Volume_With_Unit='{Fore.light_green}{self.Converts_To_Volume_With_Unit}'){Style.reset}"
14
+ msg.append(f)
15
+ return '\n'.join(msg)
16
+
17
+ try:
18
+ CookingConversion.metadata.create_all(ENGINE)
19
+ except Exception as e:
20
+ CookingConversion.__table__.drop(ENGINE)
21
+ CookingConversion.metadata.create_all(ENGINE)
22
+
23
+
24
+ class CC_Ui:
25
+ def fix_table(self):
26
+ CookingConversion.__table__.drop(ENGINE)
27
+ CookingConversion.metadata.create_all(ENGINE)
28
+
29
+ def new_conversion(self):
30
+ try:
31
+ excludes=['ccid',]
32
+ fields={
33
+ i.name:{
34
+ 'default':None,
35
+ 'type':str(i.type).lower()
36
+ } for i in CookingConversion.__table__.columns if i.name not in excludes
37
+ }
38
+ fb=FormBuilder(data=fields)
39
+ if fb is None:
40
+ return
41
+
42
+ with Session(ENGINE) as session:
43
+ try:
44
+ ncc=CookingConversion()
45
+ for k in fb:
46
+ setattr(ncc,k,fb[k])
47
+ session.add(ncc)
48
+ session.commit()
49
+ session.refresh(ncc)
50
+ print(ncc)
51
+ except Exception as ee:
52
+ print(ee)
53
+ session.rollback()
54
+ session.commit()
55
+ except Exception as e:
56
+ print(e)
57
+
58
+ def edit_cvt(self,cvt):
59
+ with Session(ENGINE) as session:
60
+ fields={i.name:{'default':getattr(cvt,i.name),'type':str(i.type).lower()} for i in cvt.__table__.columns}
61
+ fb=FormBuilder(data=fields,passThruText="Edit CookingConversion")
62
+
63
+ r=session.query(CookingConversion).filter(CookingConversion.ccid==cvt.ccid).first()
64
+ for i in fb:
65
+ setattr(r,i,fb[i])
66
+ session.commit()
67
+ session.refresh(r)
68
+
69
+
70
+
71
+ def search_conversion(self,menu=False):
72
+ try:
73
+ excludes=['ccid',]
74
+ fields={
75
+ i.name:{
76
+ 'default':None,
77
+ 'type':str(i.type).lower()
78
+ } for i in CookingConversion.__table__.columns if i.name not in excludes
79
+ }
80
+ fb=FormBuilder(data=fields)
81
+ if fb is None:
82
+ return
83
+
84
+ tmp={}
85
+ for i in fb:
86
+ if fb[i] is not None:
87
+ tmp[i]=fb[i]
88
+
89
+
90
+ FILTER=[]
91
+ for i in tmp:
92
+ try:
93
+ FILTER.append(getattr(CookingConversion,i).icontains(tmp[i]))
94
+ except Exception as e:
95
+ print(e)
96
+
97
+ with Session(ENGINE) as session:
98
+ try:
99
+ if len(FILTER) < 1:
100
+ query=session.query(CookingConversion)
101
+ else:
102
+ query=session.query(CookingConversion).filter(or_(*FILTER))
103
+
104
+ ordered=orderQuery(query,CookingConversion.ResourceName,inverse=True)
105
+ results=ordered.all()
106
+ cta=len(results)
107
+ display=[]
108
+
109
+ modified=True
110
+ while True:
111
+ da=False
112
+ for num,i in enumerate(results):
113
+ msg=std_colorize(f"{i}",num,cta)
114
+ if menu:
115
+ print(msg)
116
+ if not da:
117
+ action=Control(func=FormBuilderMkText,ptext=f"Delete All({Fore.light_red}delete all{Fore.light_yellow} or {Fore.light_red}da{Fore.light_yellow})/Delete({Fore.light_red}del{Fore.light_yellow})/Edit({Fore.light_red}ed{Fore.light_yellow})",helpText="edit or delete",data="string")
118
+ else:
119
+ action='da'
120
+ if action.lower() in ['delete','del']:
121
+ session.delete(i)
122
+ session.commit()
123
+ continue
124
+ elif action.lower() in ['ed','edit']:
125
+ self.edit_cvt(i)
126
+ session.refresh(results[num])
127
+ msg=std_colorize(f"{i}",num,cta)
128
+ elif action.lower() in ['u','use']:
129
+ print('not implemented!')
130
+ continue
131
+ elif action.lower() in ['da','delete all']:
132
+ da=True
133
+ session.delete(i)
134
+ session.commit()
135
+ else:
136
+ pass
137
+
138
+ try:
139
+ display.append(msg)
140
+ except Exception as e:
141
+ print(e)
142
+ break
143
+ if not da:
144
+ display='\n'.join(display)
145
+ print(display)
146
+
147
+ except Exception as ee:
148
+ print(ee)
149
+ except Exception as e:
150
+ print(e)
151
+
152
+ def findAndUse2(self):
153
+ with Session(ENGINE) as session:
154
+ cmd=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}[FindAndUse2]{Fore.light_yellow}what cmd are your looking for?",helpText="type the cmd",data="string")
155
+ if cmd in ['d',None]:
156
+ return
157
+ else:
158
+ options=copy(self.options)
159
+
160
+ session.query(FindCmd).delete()
161
+ session.commit()
162
+ for num,k in enumerate(options):
163
+ stage=0
164
+ cmds=options[k]['cmds']
165
+ l=[]
166
+ l.extend(cmds)
167
+ l.append(options[k]['desc'])
168
+ cmdStr=' '.join(l)
169
+ cmd_string=FindCmd(CmdString=cmdStr,CmdKey=k)
170
+ session.add(cmd_string)
171
+ if num % 50 == 0:
172
+ session.commit()
173
+ session.commit()
174
+ session.flush()
175
+
176
+ results=session.query(FindCmd).filter(FindCmd.CmdString.icontains(cmd)).all()
177
+
178
+
179
+ ct=len(results)
180
+ if ct == 0:
181
+ print(f"No Cmd was found by {Fore.light_red}{cmd}{Style.reset}")
182
+ return
183
+ for num,x in enumerate(results):
184
+ msg=f"{Fore.light_yellow}{num}/{Fore.light_steel_blue}{num+1} of {Fore.light_red}{ct} -> {Fore.turquoise_4}{f'{Fore.light_yellow},{Style.reset}{Fore.turquoise_4}'.join(options[x.CmdKey]['cmds'])} - {Fore.green_yellow}{options[x.CmdKey]['desc']}"
185
+ print(msg)
186
+ select=Prompt.__init2__(None,func=FormBuilderMkText,ptext="which index?",helpText="the number farthest to the left before the /",data="integer")
187
+ if select in [None,'d']:
188
+ return
189
+ try:
190
+ ee=options[results[select].CmdKey]['exec']
191
+ if callable(ee):
192
+ ee()
193
+ except Exception as e:
194
+ print(e)
195
+
196
+
197
+
198
+ def __init__(self):
199
+
200
+ self.options={}
201
+ self.options[str(uuid1())]={
202
+ 'cmds':generate_cmds(startcmd=["fix","fx"],endCmd=['tbl','table']),
203
+ 'desc':'''
204
+ drop and regenerate CookingConversion Table
205
+ ''',
206
+ 'exec':self.fix_table
207
+ }
208
+ self.options[str(uuid1())]={
209
+ 'cmds':generate_cmds(startcmd=["search","s","sch"],endCmd=['cvt','cvn','conversion']),
210
+ 'desc':'''
211
+ search conversions
212
+ ''',
213
+ 'exec':self.search_conversion
214
+ }
215
+ self.options[str(uuid1())]={
216
+ 'cmds':generate_cmds(startcmd=["search","s","sch"],endCmd=['mnu','menu','m']),
217
+ 'desc':'''
218
+ search for and edit/use/delete cooking conversions that were stored
219
+ ''',
220
+ 'exec':lambda self=self:self.search_conversion(menu=True)
221
+ }
222
+ self.options[str(uuid1())]={
223
+ 'cmds':['',],
224
+ 'desc':f'',
225
+ 'exec':print
226
+ }
227
+ #new methods() start
228
+ self.options[str(uuid1())]={
229
+ 'cmds':['ncc','new cooking conversion','nw ckng cvt'],
230
+ 'desc':f'save a new conversion',
231
+ 'exec':self.new_conversion
232
+ }
233
+
234
+ #new methods() end
235
+ self.options[str(uuid1())]={
236
+ 'cmds':['fcmd','findcmd','find cmd'],
237
+ 'desc':f'Find {Fore.light_yellow}cmd{Fore.medium_violet_red} and excute for return{Style.reset}',
238
+ 'exec':self.findAndUse2
239
+ }
240
+ self.DESCRIPTION=f'''
241
+ Review Cooking Conversions so you can get dat recipe fo gud. u good cheech?.
242
+ '''
243
+
244
+ self.options[str(uuid1())]={
245
+ 'cmds':['desciption','describe me','what am i','help me','?+'],
246
+ 'desc':f'print the module description',
247
+ 'exec':lambda self=self:print(self.DESCRIPTION)
248
+ }
249
+
250
+ for num,i in enumerate(self.options):
251
+ if str(num) not in self.options[i]['cmds']:
252
+ self.options[i]['cmds'].append(str(num))
253
+ options=copy(self.options)
254
+
255
+ while True:
256
+ helpText=[]
257
+ for i in options:
258
+ msg=f"{Fore.light_green}{options[i]['cmds']}{Fore.light_red} -> {options[i]['desc']}{Style.reset}"
259
+ helpText.append(msg)
260
+ helpText='\n'.join(helpText)
261
+
262
+ cmd=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{__class__.__name__}|Do What?:",helpText=helpText,data="string")
263
+ if cmd is None:
264
+ return None
265
+ result=None
266
+ for i in options:
267
+ els=[ii.lower() for ii in options[i]['cmds']]
268
+ if cmd.lower() in els:
269
+ print(i)
270
+ options[i]['exec']()
271
+ break
10
272
 
11
- @dataclass
12
- class EmotionCoreDB(BASE,Template):
13
- pass
14
273