DavidD003 commited on
Commit
5e57fd1
1 Parent(s): e1a9790

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -14,7 +14,7 @@ def PrimeVisualTemplate(vTmplFl,FTrefFl,TempRefFl):
14
  primedTemplateName=tls.translate_Visual_Template(vTmplFl,FTrefFl,TempRefFl)
15
  return primedTemplateName,primedTemplateName,datetime.now(),datetime.now(),FTrefFl.name,TempRefFl.name #Return twice so as to send file to two interface entities (file holders), plus time stampers, return the refusal sheets to send to B
16
 
17
- def GenerateSchedule(schedWWF,xtraDays,wkHrs,DaysCrew,AssnFl,FTrefFl,TempRefFl,PollFl,stop=None):
18
  assnWWF=schedWWF
19
  if assnWWF=='Yes': assnWWF=True
20
  if assnWWF=='No': assnWWF=True
@@ -25,7 +25,10 @@ def GenerateSchedule(schedWWF,xtraDays,wkHrs,DaysCrew,AssnFl,FTrefFl,TempRefFl,P
25
  mySched.evalAssnList()
26
  mySched.proofEligVol()
27
  mySched.proofEligVol()#i don't know man i found in testing sometimes it wasnt completing properly the first time around
28
- sch=mySched.fillOutSched_v3(stop=stop)
 
 
 
29
  flNm=sch.printToExcel()
30
  return flNm,datetime.now()
31
 
@@ -68,7 +71,10 @@ with gr.Blocks() as demo:
68
  B_tx_FTtimestamp=gr.Textbox(label="File Change Timestamp - Completed Schedule",placeholder="Waiting for first run")
69
  with gr.Tab("C - Review"):
70
  with gr.Tab("Inspect Template"):
71
- gr.Markdown("On this tab you can have the program generate a schedule using only the template file so as to confirm the template was entered correctly for program interpretation")
 
 
 
72
  with gr.Tab("Force Stop Mid-Scheduling"):
73
  gr.Markdown("On this tab you can observe what a schedule looked like after making a specific number of assignments. Iteration number can be retrieved from the bottom of the verbose assignment list tab of a generated schedule.")
74
  with gr.Row():
@@ -83,4 +89,5 @@ with gr.Blocks() as demo:
83
  #Third Define the Interactions
84
  A_bt_PT.click(PrimeVisualTemplate,[A_fl_VT,A_fl_FTref,A_fl_Tref],[A_fl_PT,B_fl_PT,A_tx_PTtimestamp,B_tx_PTtimestamp,B_fl_FTref,B_fl_Tref])
85
  B_bt_MS.click(GenerateSchedule,[B_wwfOT,B_xtraDay,B_wkHrs,B_dayCrew,B_fl_PT,B_fl_FTref,B_fl_Tref,B_fl_Pl],[B_fl_FS,B_tx_FTtimestamp])
86
- demo.launch()
 
 
14
  primedTemplateName=tls.translate_Visual_Template(vTmplFl,FTrefFl,TempRefFl)
15
  return primedTemplateName,primedTemplateName,datetime.now(),datetime.now(),FTrefFl.name,TempRefFl.name #Return twice so as to send file to two interface entities (file holders), plus time stampers, return the refusal sheets to send to B
16
 
17
+ def GenerateSchedule(schedWWF,xtraDays,wkHrs,DaysCrew,AssnFl,FTrefFl,TempRefFl,PollFl,stop=None,template=False):
18
  assnWWF=schedWWF
19
  if assnWWF=='Yes': assnWWF=True
20
  if assnWWF=='No': assnWWF=True
 
25
  mySched.evalAssnList()
26
  mySched.proofEligVol()
27
  mySched.proofEligVol()#i don't know man i found in testing sometimes it wasnt completing properly the first time around
28
+ if template==True: #Case of template viewer
29
+ flNm=sch.printToExcel()
30
+ return flNm,datetime.now()
31
+ sch=mySched.fillOutSched_v3(stop=stop) #Stop is not None when submitted from tab C
32
  flNm=sch.printToExcel()
33
  return flNm,datetime.now()
34
 
 
71
  B_tx_FTtimestamp=gr.Textbox(label="File Change Timestamp - Completed Schedule",placeholder="Waiting for first run")
72
  with gr.Tab("C - Review"):
73
  with gr.Tab("Inspect Template"):
74
+ gr.Markdown("On this tab you can have the program generate a schedule using only the template file so as to confirm the template was entered correctly for program interpretation. This process builds the template using all inputs present in tab B. Inputs are required for building the template.")
75
+ C_bt_MT = gr.Button("Generate Template")
76
+ C_fl_T=gr.File(label="Generated Template")
77
+ C_tx_Ttimestamp=gr.Textbox(label="File Change Timestamp - Generated Template",placeholder="Waiting for first run.")
78
  with gr.Tab("Force Stop Mid-Scheduling"):
79
  gr.Markdown("On this tab you can observe what a schedule looked like after making a specific number of assignments. Iteration number can be retrieved from the bottom of the verbose assignment list tab of a generated schedule.")
80
  with gr.Row():
 
89
  #Third Define the Interactions
90
  A_bt_PT.click(PrimeVisualTemplate,[A_fl_VT,A_fl_FTref,A_fl_Tref],[A_fl_PT,B_fl_PT,A_tx_PTtimestamp,B_tx_PTtimestamp,B_fl_FTref,B_fl_Tref])
91
  B_bt_MS.click(GenerateSchedule,[B_wwfOT,B_xtraDay,B_wkHrs,B_dayCrew,B_fl_PT,B_fl_FTref,B_fl_Tref,B_fl_Pl],[B_fl_FS,B_tx_FTtimestamp])
92
+ C_bt_MT.click(GenerateSchedule,[B_wwfOT,B_xtraDay,B_wkHrs,B_dayCrew,B_fl_PT,B_fl_FTref,B_fl_Tref,B_fl_Pl],[C_fl_T,C_tx_Ttimestamp])
93
+ demo.launch()