abidlabs HF Staff commited on
Commit
848d983
·
1 Parent(s): 57f7892

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -42
app.py CHANGED
@@ -12,46 +12,46 @@ from copy import deepcopy
12
  #######################
13
  #First define the functions
14
 
15
- # def PrimeVisualTemplate(vTmplFl,FTrefFl,TempRefFl):
16
- # primedTemplateName=tls.translate_Visual_Template(vTmplFl,FTrefFl,TempRefFl)
17
- # 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
18
 
19
- # def GenerateSchedule(schedWWF,xtraDays,wkHrs,DaysCrew,AssnFl,FTrefFl,TempRefFl,PollFl,stop1=0,stop2=0,template=False):
20
- # stop=(stop1,stop2)
21
- # assnWWF=schedWWF
22
- # if assnWWF=='Yes': assnWWF=True
23
- # if assnWWF=='No': assnWWF=True
24
- # xtraDays=xtraDays
25
- # Acrew=DaysCrew
26
- # wkHrs=wkHrs
27
- # mySched=tls.preProcessData(Acrew,wkHrs,FTrefFl,TempRefFl,AssnFl,PollFl,assnWWF=assnWWF,xtraDays=xtraDays)
28
- # mySched.evalAssnList()
29
- # mySched.proofEligVol()
30
- # mySched.proofEligVol()#i don't know man i found in testing sometimes it wasnt completing properly the first time around
31
- # if template==True: #Case of template viewer
32
- # flNm=mySched.printToExcel()
33
- # return flNm,datetime.now()
34
- # sch=mySched.fillOutSched_v3(stop=stop) #Stop is not None when submitted from tab C
35
- # flNm=sch.printToExcel()
36
- # return flNm,datetime.now()
37
 
38
- # def GenerateSchedule1(schedWWF,xtraDays,wkHrs,DaysCrew,AssnFl,FTrefFl,TempRefFl,PollFl,stop=None,template=True):
39
- # assnWWF=schedWWF
40
- # if assnWWF=='Yes': assnWWF=True
41
- # if assnWWF=='No': assnWWF=True
42
- # xtraDays=xtraDays
43
- # Acrew=DaysCrew
44
- # wkHrs=wkHrs
45
- # mySched=tls.preProcessData(Acrew,wkHrs,FTrefFl,TempRefFl,AssnFl,PollFl,assnWWF=assnWWF,xtraDays=xtraDays)
46
- # mySched.evalAssnList()
47
- # mySched.proofEligVol()
48
- # mySched.proofEligVol()#i don't know man i found in testing sometimes it wasnt completing properly the first time around
49
- # if template==True: #Case of template viewer
50
- # flNm=mySched.printToExcel()
51
- # return flNm,datetime.now()
52
- # sch=mySched.fillOutSched_v3(stop=stop) #Stop is not None when submitted from tab C
53
- # flNm=sch.printToExcel()
54
- # return flNm,datetime.now()
55
 
56
 
57
  #######################
@@ -114,8 +114,8 @@ with gr.Blocks() as demo:
114
 
115
  #######################
116
  # #Third Define the Interactions
117
- # 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])
118
- # 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])
119
- # C_bt_MT.click(GenerateSchedule1,[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])
120
- # C_bt_PS.click(GenerateSchedule,[B_wwfOT,B_xtraDay,B_wkHrs,B_dayCrew,B_fl_PT,B_fl_FTref,B_fl_Tref,B_fl_Pl,C_nm_IN,C_nm_PS],[C_fl_PS,C_tx_ts2])
121
  demo.launch()
 
12
  #######################
13
  #First define the functions
14
 
15
+ def PrimeVisualTemplate(vTmplFl,FTrefFl,TempRefFl):
16
+ primedTemplateName=tls.translate_Visual_Template(vTmplFl,FTrefFl,TempRefFl)
17
+ 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
18
 
19
+ def GenerateSchedule(schedWWF,xtraDays,wkHrs,DaysCrew,AssnFl,FTrefFl,TempRefFl,PollFl,stop1=0,stop2=0,template=False):
20
+ stop=(stop1,stop2)
21
+ assnWWF=schedWWF
22
+ if assnWWF=='Yes': assnWWF=True
23
+ if assnWWF=='No': assnWWF=True
24
+ xtraDays=xtraDays
25
+ Acrew=DaysCrew
26
+ wkHrs=wkHrs
27
+ mySched=tls.preProcessData(Acrew,wkHrs,FTrefFl,TempRefFl,AssnFl,PollFl,assnWWF=assnWWF,xtraDays=xtraDays)
28
+ mySched.evalAssnList()
29
+ mySched.proofEligVol()
30
+ mySched.proofEligVol()#i don't know man i found in testing sometimes it wasnt completing properly the first time around
31
+ if template==True: #Case of template viewer
32
+ flNm=mySched.printToExcel()
33
+ return flNm,datetime.now()
34
+ sch=mySched.fillOutSched_v3(stop=stop) #Stop is not None when submitted from tab C
35
+ flNm=sch.printToExcel()
36
+ return flNm,datetime.now()
37
 
38
+ def GenerateSchedule1(schedWWF,xtraDays,wkHrs,DaysCrew,AssnFl,FTrefFl,TempRefFl,PollFl,stop=None,template=True):
39
+ assnWWF=schedWWF
40
+ if assnWWF=='Yes': assnWWF=True
41
+ if assnWWF=='No': assnWWF=True
42
+ xtraDays=xtraDays
43
+ Acrew=DaysCrew
44
+ wkHrs=wkHrs
45
+ mySched=tls.preProcessData(Acrew,wkHrs,FTrefFl,TempRefFl,AssnFl,PollFl,assnWWF=assnWWF,xtraDays=xtraDays)
46
+ mySched.evalAssnList()
47
+ mySched.proofEligVol()
48
+ mySched.proofEligVol()#i don't know man i found in testing sometimes it wasnt completing properly the first time around
49
+ if template==True: #Case of template viewer
50
+ flNm=mySched.printToExcel()
51
+ return flNm,datetime.now()
52
+ sch=mySched.fillOutSched_v3(stop=stop) #Stop is not None when submitted from tab C
53
+ flNm=sch.printToExcel()
54
+ return flNm,datetime.now()
55
 
56
 
57
  #######################
 
114
 
115
  #######################
116
  # #Third Define the Interactions
117
+ 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])
118
+ 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])
119
+ C_bt_MT.click(GenerateSchedule1,[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])
120
+ C_bt_PS.click(GenerateSchedule,[B_wwfOT,B_xtraDay,B_wkHrs,B_dayCrew,B_fl_PT,B_fl_FTref,B_fl_Tref,B_fl_Pl,C_nm_IN,C_nm_PS],[C_fl_PS,C_tx_ts2])
121
  demo.launch()