Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -188,12 +188,12 @@ def measureproject(result,dataDoc,img=0,dxffile=0):
|
|
| 188 |
temp_file.write(dxfpath)
|
| 189 |
temp_filename = temp_file.name
|
| 190 |
print(temp_filename)
|
| 191 |
-
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr=dxf__omar3_2.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] , pdfpath,result[0])
|
| 192 |
dbPath='/TSA JOBS/ADR Test'+pdfpath+'Measured Plan/'
|
| 193 |
pdflink= tsadropboxretrieval.uploadanyFile(doc=doc,path=dbPath,pdfname=result[0]) #doc=doc,pdfname=path,pdfpath=pdfpath+'Measured Plan/'
|
| 194 |
|
| 195 |
_, buffer = cv2.imencode('.png', outputimg)
|
| 196 |
-
arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],
|
| 197 |
################################# -2.2- #################################
|
| 198 |
# elif result[5][2].startswith('2.2'): #section value - 2.2 rc slabs
|
| 199 |
#add here python code
|
|
@@ -397,16 +397,19 @@ def getnewlegend():
|
|
| 397 |
dbPath='/TSA JOBS/ADR Test'+pdfpth+'Measured Plan/'
|
| 398 |
deletedrows1=pilecaps_adr.deletemarkups(list1=list1,dbPath=dbPath,path=path)
|
| 399 |
arr1=[deletedrows1.to_dict()]
|
|
|
|
| 400 |
return jsonify(arr1)
|
| 401 |
#---------------------------------------------------------------------------
|
| 402 |
#if user wishes to delete
|
| 403 |
@app.route('/deletemarkupsroute',methods=["GET", "POST"])
|
| 404 |
def dltmarkupslegend():
|
|
|
|
| 405 |
pdfpth=''
|
| 406 |
alljson = request.get_json()
|
| 407 |
SimilarAreaDictionary=alljson.get('dict')
|
| 408 |
# SimilarAreaDictionary = request.args.get('dict')
|
| 409 |
deletedrows=alljson.get('deletedrows')
|
|
|
|
| 410 |
# deletedrows = request.args.get('deletedrows')
|
| 411 |
path=alljson.get('path')
|
| 412 |
# path = request.args.get('path')
|
|
@@ -421,14 +424,15 @@ def dltmarkupslegend():
|
|
| 421 |
for word in eval(pdfpathpath):
|
| 422 |
pdfpth+='/' +word
|
| 423 |
pdfpth+='/'
|
| 424 |
-
myDict=eval(deletedrows)
|
| 425 |
-
deletedrows=pd.DataFrame(
|
| 426 |
print('deletedrows',deletedrows)
|
| 427 |
if section.startswith('1.0'):
|
| 428 |
newlgnd=google_sheet_Legend.deletefromlegend(deletedrows=deletedrows,SimilarAreaDictionarycopy=SimilarAreaDictionary, section=section,areaPermArr=areaPermArr)
|
| 429 |
else:
|
| 430 |
newlgnd=google_sheet_Legend.deletefromlegend(deletedrows=deletedrows,SimilarAreaDictionarycopy=SimilarAreaDictionary, section=section)
|
| 431 |
try:
|
|
|
|
| 432 |
newlgnd1=google_sheet_Legend.legendGoogleSheets(SimilarAreaDictionary=newlgnd,path=path,spreadsheetId=spreadsheetId ,pdfpath=pdfpth) #new legend
|
| 433 |
except:
|
| 434 |
print("An exception occurred")
|
|
@@ -626,7 +630,7 @@ def cvtSummarytoXML(jsdata):
|
|
| 626 |
# print(result[1])
|
| 627 |
xmllink=google_sheet_to_xml.create_xml(documentname=result[1],dbPath=path)
|
| 628 |
return jsonify(xmllink)
|
| 629 |
-
|
| 630 |
#_________________________________________________________________________________________________________________________
|
| 631 |
#_________________________________________________________________________________________________________________________
|
| 632 |
|
|
|
|
| 188 |
temp_file.write(dxfpath)
|
| 189 |
temp_filename = temp_file.name
|
| 190 |
print(temp_filename)
|
| 191 |
+
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1=dxf__omar3_2.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] , pdfpath,result[0])
|
| 192 |
dbPath='/TSA JOBS/ADR Test'+pdfpath+'Measured Plan/'
|
| 193 |
pdflink= tsadropboxretrieval.uploadanyFile(doc=doc,path=dbPath,pdfname=result[0]) #doc=doc,pdfname=path,pdfpath=pdfpath+'Measured Plan/'
|
| 194 |
|
| 195 |
_, buffer = cv2.imencode('.png', outputimg)
|
| 196 |
+
arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,[],namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 197 |
################################# -2.2- #################################
|
| 198 |
# elif result[5][2].startswith('2.2'): #section value - 2.2 rc slabs
|
| 199 |
#add here python code
|
|
|
|
| 397 |
dbPath='/TSA JOBS/ADR Test'+pdfpth+'Measured Plan/'
|
| 398 |
deletedrows1=pilecaps_adr.deletemarkups(list1=list1,dbPath=dbPath,path=path)
|
| 399 |
arr1=[deletedrows1.to_dict()]
|
| 400 |
+
print('arr,',arr1)
|
| 401 |
return jsonify(arr1)
|
| 402 |
#---------------------------------------------------------------------------
|
| 403 |
#if user wishes to delete
|
| 404 |
@app.route('/deletemarkupsroute',methods=["GET", "POST"])
|
| 405 |
def dltmarkupslegend():
|
| 406 |
+
print('IN deletemarkupsroute')
|
| 407 |
pdfpth=''
|
| 408 |
alljson = request.get_json()
|
| 409 |
SimilarAreaDictionary=alljson.get('dict')
|
| 410 |
# SimilarAreaDictionary = request.args.get('dict')
|
| 411 |
deletedrows=alljson.get('deletedrows')
|
| 412 |
+
print('deletedrowsssssssssssssssssssssssssssssss',deletedrows)
|
| 413 |
# deletedrows = request.args.get('deletedrows')
|
| 414 |
path=alljson.get('path')
|
| 415 |
# path = request.args.get('path')
|
|
|
|
| 424 |
for word in eval(pdfpathpath):
|
| 425 |
pdfpth+='/' +word
|
| 426 |
pdfpth+='/'
|
| 427 |
+
# myDict=eval(deletedrows)
|
| 428 |
+
deletedrows=pd.DataFrame(deletedrows)
|
| 429 |
print('deletedrows',deletedrows)
|
| 430 |
if section.startswith('1.0'):
|
| 431 |
newlgnd=google_sheet_Legend.deletefromlegend(deletedrows=deletedrows,SimilarAreaDictionarycopy=SimilarAreaDictionary, section=section,areaPermArr=areaPermArr)
|
| 432 |
else:
|
| 433 |
newlgnd=google_sheet_Legend.deletefromlegend(deletedrows=deletedrows,SimilarAreaDictionarycopy=SimilarAreaDictionary, section=section)
|
| 434 |
try:
|
| 435 |
+
# print('newlgnd',newlgnd)
|
| 436 |
newlgnd1=google_sheet_Legend.legendGoogleSheets(SimilarAreaDictionary=newlgnd,path=path,spreadsheetId=spreadsheetId ,pdfpath=pdfpth) #new legend
|
| 437 |
except:
|
| 438 |
print("An exception occurred")
|
|
|
|
| 630 |
# print(result[1])
|
| 631 |
xmllink=google_sheet_to_xml.create_xml(documentname=result[1],dbPath=path)
|
| 632 |
return jsonify(xmllink)
|
| 633 |
+
|
| 634 |
#_________________________________________________________________________________________________________________________
|
| 635 |
#_________________________________________________________________________________________________________________________
|
| 636 |
|