Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
| 1 |
# import numpy as np
|
| 2 |
import cv2
|
| 3 |
-
# from google.colab.patches import cv2_imshow
|
| 4 |
-
# from matplotlib import pyplot as plt
|
| 5 |
-
# from pdf2image import convert_from_path
|
| 6 |
|
|
|
|
| 7 |
import math
|
| 8 |
import fitz
|
| 9 |
import pandas as pd
|
|
@@ -915,30 +913,36 @@ def retrieveMCCol(gc):
|
|
| 915 |
newMcTNames.append(i)
|
| 916 |
return newMcTNames
|
| 917 |
|
| 918 |
-
|
| 919 |
-
def getdropdownValues(gc,spreadsheet_service,spreadsheetid):
|
| 920 |
dropdownValues=[]
|
| 921 |
-
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
|
| 927 |
-
|
| 928 |
-
|
| 929 |
-
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
|
| 933 |
-
|
| 934 |
-
|
| 935 |
-
|
| 936 |
-
|
| 937 |
-
|
| 938 |
-
|
| 939 |
-
|
| 940 |
-
|
| 941 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 942 |
return dropdownValues
|
| 943 |
|
| 944 |
def createGoogleSheet():
|
|
@@ -1227,7 +1231,17 @@ def saveExcel(Dictionary,plan):
|
|
| 1227 |
d=dropbox_upload_file('.',local_file=Dictionary,dropbox_file_path='/savedMeasurements/'+plan2+'summaryXML.xml')
|
| 1228 |
|
| 1229 |
|
| 1230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1231 |
|
| 1232 |
|
| 1233 |
# with gr.Column():
|
|
|
|
| 1 |
# import numpy as np
|
| 2 |
import cv2
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
import sched, time
|
| 5 |
import math
|
| 6 |
import fitz
|
| 7 |
import pandas as pd
|
|
|
|
| 913 |
newMcTNames.append(i)
|
| 914 |
return newMcTNames
|
| 915 |
|
| 916 |
+
def getdropdownValues(gc,spreadsheet_service):
|
|
|
|
| 917 |
dropdownValues=[]
|
| 918 |
+
allIds=gc.spreadsheet_ids()
|
| 919 |
+
for spreadsheetId in allIds:
|
| 920 |
+
if spreadsheetId != '1A8VtqLFhe2NXPxIjfAilbxF9xV2eSzZ-yZ9GP8_5jSo':
|
| 921 |
+
print(spreadsheetId)
|
| 922 |
+
ws=gc.open_by_key('1A8VtqLFhe2NXPxIjfAilbxF9xV2eSzZ-yZ9GP8_5jSo') ## spreadsheet containing mc-t names
|
| 923 |
+
worksheet = ws.worksheet(0)
|
| 924 |
+
response = spreadsheet_service.spreadsheets().get(
|
| 925 |
+
spreadsheetId=spreadsheetId, fields='*',
|
| 926 |
+
ranges='A2:A60',includeGridData=True).execute()
|
| 927 |
+
r=list(response['sheets'][0]['data'][0]['rowData'][0]['values'][0])
|
| 928 |
+
print(r)
|
| 929 |
+
if 'dataValidation' in r:
|
| 930 |
+
print('yes')
|
| 931 |
+
colvals= response['sheets'][0]['data'][0]['rowData'][0]['values'][0]['dataValidation']
|
| 932 |
+
colvalsList=list(colvals.items())
|
| 933 |
+
# print(colvalsList[0][1])
|
| 934 |
+
lengthVals=len(colvalsList[0][1]['values'])
|
| 935 |
+
for i in range(lengthVals):
|
| 936 |
+
dictVal=(colvalsList[0][1]['values'][i].values())
|
| 937 |
+
# val=[*dictVal]
|
| 938 |
+
x=[*dictVal][0]
|
| 939 |
+
# print(x)
|
| 940 |
+
if x not in dropdownValues:
|
| 941 |
+
dropdownValues.append(*dictVal)
|
| 942 |
+
print(dropdownValues)
|
| 943 |
+
# worksheet.delete_cols(1,1)
|
| 944 |
+
worksheet.update_col(index=1, values=dropdownValues)
|
| 945 |
+
|
| 946 |
return dropdownValues
|
| 947 |
|
| 948 |
def createGoogleSheet():
|
|
|
|
| 1231 |
d=dropbox_upload_file('.',local_file=Dictionary,dropbox_file_path='/savedMeasurements/'+plan2+'summaryXML.xml')
|
| 1232 |
|
| 1233 |
|
| 1234 |
+
def do_something(scheduler):
|
| 1235 |
+
# schedule the next call first
|
| 1236 |
+
scheduler.enter(10, 1, do_something, (scheduler,))
|
| 1237 |
+
# print("Doing stuff...")
|
| 1238 |
+
getdropdownValues(gc,spreadsheet_service)
|
| 1239 |
+
# then do your stuff
|
| 1240 |
+
|
| 1241 |
+
my_scheduler = sched.scheduler(time.time, time.sleep)
|
| 1242 |
+
my_scheduler.enter(10, 1, do_something, (my_scheduler,))
|
| 1243 |
+
my_scheduler.run()
|
| 1244 |
+
|
| 1245 |
|
| 1246 |
|
| 1247 |
# with gr.Column():
|