Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,11 +41,12 @@ import Code_2_7
|
|
| 41 |
import Counting_Columns_2_1
|
| 42 |
import Find_Hyperlinking_text
|
| 43 |
import ezdxf
|
| 44 |
-
|
| 45 |
from flask import Flask, render_template, session, redirect, url_for
|
| 46 |
from flask_session import Session # Capital "S"
|
| 47 |
-
|
| 48 |
|
|
|
|
|
|
|
| 49 |
prjnamesURL = 'https://docs.google.com/spreadsheets/d/1nsIgi9o9VSBKQlNxbxihPzG_N7s4um0eNVfgL4gaGPc/export?format=csv&gid=0'
|
| 50 |
prjpartsURL = 'https://docs.google.com/spreadsheets/d/1nsIgi9o9VSBKQlNxbxihPzG_N7s4um0eNVfgL4gaGPc/export?format=csv&gid=34865056'
|
| 51 |
prjsectionsURL = 'https://docs.google.com/spreadsheets/d/1nsIgi9o9VSBKQlNxbxihPzG_N7s4um0eNVfgL4gaGPc/export?format=csv&gid=1751466819'
|
|
@@ -66,6 +67,23 @@ app.secret_key = "your_secret_key"
|
|
| 66 |
sess = Session()
|
| 67 |
sess.init_app(app)
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
@app.route("/", methods=["GET", "POST"])
|
| 70 |
def getInfotoMeasure():
|
| 71 |
return render_template("gui2.html")
|
|
|
|
| 41 |
import Counting_Columns_2_1
|
| 42 |
import Find_Hyperlinking_text
|
| 43 |
import ezdxf
|
|
|
|
| 44 |
from flask import Flask, render_template, session, redirect, url_for
|
| 45 |
from flask_session import Session # Capital "S"
|
| 46 |
+
from flask_socketio import SocketIO
|
| 47 |
|
| 48 |
+
app = Flask(__name__)
|
| 49 |
+
socketio = SocketIO(app, cors_allowed_origins="*")
|
| 50 |
prjnamesURL = 'https://docs.google.com/spreadsheets/d/1nsIgi9o9VSBKQlNxbxihPzG_N7s4um0eNVfgL4gaGPc/export?format=csv&gid=0'
|
| 51 |
prjpartsURL = 'https://docs.google.com/spreadsheets/d/1nsIgi9o9VSBKQlNxbxihPzG_N7s4um0eNVfgL4gaGPc/export?format=csv&gid=34865056'
|
| 52 |
prjsectionsURL = 'https://docs.google.com/spreadsheets/d/1nsIgi9o9VSBKQlNxbxihPzG_N7s4um0eNVfgL4gaGPc/export?format=csv&gid=1751466819'
|
|
|
|
| 67 |
sess = Session()
|
| 68 |
sess.init_app(app)
|
| 69 |
|
| 70 |
+
|
| 71 |
+
@socketio.on("connect")
|
| 72 |
+
def handle_connect():
|
| 73 |
+
print("Client connected")
|
| 74 |
+
socketio.emit("progress", {"data": "Connected"})
|
| 75 |
+
|
| 76 |
+
@socketio.on("get_project_names")
|
| 77 |
+
def get_project_names():
|
| 78 |
+
socketio.emit("progress", {"data": "10"})
|
| 79 |
+
|
| 80 |
+
prjnames, prjids = API.getPrjNames(progress_callback=lambda p: socketio.emit("progress", {"data": p}))
|
| 81 |
+
|
| 82 |
+
socketio.emit("progress", {"data": "80"})
|
| 83 |
+
socketio.emit("progress", {"data": "100"})
|
| 84 |
+
socketio.emit("project_data", {"data": [prjnames, prjids]})
|
| 85 |
+
|
| 86 |
+
|
| 87 |
@app.route("/", methods=["GET", "POST"])
|
| 88 |
def getInfotoMeasure():
|
| 89 |
return render_template("gui2.html")
|