There will be a short maintenance break on Wed 27.10. at 12:00. Estimated time 30 minutes.

Commit ef9a7efa authored by Ossi Laine's avatar Ossi Laine
Browse files

Added missing requirements

parent 4958ffad
......@@ -14,8 +14,8 @@ from flask_cors import CORS, cross_origin
app = Flask(__name__)
CORS(app)
# CORS(app, resources={r"/*": {"cors_allowed_origins":"*"} } )
#CORS(app)
CORS(app, resources={r"/*": {"cors_allowed_origins":"*"} } )
#app.config['BABEL_DEFAULT_LOCALE'] = 'fin'
#app.config['BABEL_TRANSLATION_DIRECTORIES'] ='C:/Users/Timo/git/pet-rating/app/translations'
......
......@@ -1045,11 +1045,13 @@ def remove_rows(rows):
@socketio.on('connect', namespace="/create_embody")
def start_create_embody():
print('io connected')
emit('success', {'connection': 'on'})
@socketio.on('draw', namespace="/create_embody")
def create_embody(meta):
print("draw initialized")
page = meta["page"]
embody = meta["embody"]
img_path = embody_plot.get_coordinates(page, embody)
......@@ -1059,6 +1061,7 @@ def create_embody(meta):
@socketio.on('connect', namespace="/download_csv")
def start_download_csv():
print('io connected')
emit('success', {'connection': 'Start generating CSV file'})
......
$(document).ready(function()  {
$(document).ready(function () {
var drawButtons = $(".embody-get-drawing");
var imageContainer = $(".embody-image-container")
var progressBarContainer = $(".progress")
var progressBar = $("#image-loading-progress")
var imageContainer = $(".embody-image-container");
var progressBarContainer = $(".progress");
var progressBar = $("#image-loading-progress");
// With sockets
function initConnection(socket) {
socket.on('success', function(msg) {
console.log(msg)
socket.on("success", function (msg) {
console.log(msg);
});
socket.on('progress', function(data) {
progressBar.width(100*(data.done/data.from) + '%')
socket.on("progress", function (data) {
progressBar.width(100 * (data.done / data.from) + "%");
});
socket.on('end', function(img) {
socket.on("end", function (img) {
// kill connection
socket.emit('end')
socket.disconnect()
socket.emit("end");
socket.disconnect();
// Draw image to statistic -page
var source = img.path
d = new Date()
imageContainer.attr("src", "/static/embody_drawings/" + source + "?" +d.getTime())
var source = img.path;
d = new Date();
imageContainer.attr(
"src",
"/static/embody_drawings/" + source + "?" + d.getTime()
);
// Remove progress bar
progressBarContainer.addClass("hidden")
progressBar.width('0%')
progressBarContainer.addClass("hidden");
progressBar.width("0%");
});
}
drawButtons.click(function (event) {
event.preventDefault();
drawButtons.click(function(event) {
event.preventDefault()
console.log("SADATDS");
// Init socket
var socket = io.connect(getDrawingURI);
initConnection(socket)
initConnection(socket);
var pageId = this.dataset.value.split('-')[0]
var embodyId = this.dataset.value.split('-')[1]
var pageId = this.dataset.value.split("-")[0];
var embodyId = this.dataset.value.split("-")[1];
socket.emit('draw', {page:pageId, embody:embodyId})
progressBarContainer.removeClass("hidden")
socket.emit("draw", { page: pageId, embody: embodyId });
progressBarContainer.removeClass("hidden");
scrollTo('plotted-image')
})
scrollTo("plotted-image");
});
function scrollTo(hash) {
$('html, body').animate({
'scrollTop': $('#'+hash).offset().top - 250
}, 500);
$("html, body").animate(
{
scrollTop: $("#" + hash).offset().top - 250,
},
500
);
}
})
});
const baseURI = 'localhost/';
const baseURI = "localhost:8000/";
//const baseURI = 'http://onni.utu.fi/';
var exportURL = baseURI + 'download_csv';
var getDrawingURI = baseURI + 'create_embody';
\ No newline at end of file
var exportURL = baseURI + "download_csv";
var getDrawingURI = baseURI + "create_embody";
......@@ -6,7 +6,6 @@ Flask-Login==0.4.1
Flask-Migrate==2.2.1
Flask-Session==0.3.1
Flask-SocketIO==4.3.0
# Flask-SocketIO==3.3.2
Flask-SQLAlchemy==2.3.2
Flask-Uploads==0.2.1
Flask-WTF==0.14.2
......@@ -17,13 +16,12 @@ matplotlib==3.0.3
mysql-connector==2.2.9
networkx==2.2
numpy==1.16.2
Pillow
PyMySQL==0.9.3
pyparsing==2.3.1
python-dateutil==2.7.3
python-editor==1.0.3
python-decouple
python-engineio==3.13.0
# python-engineio==3.5.1
# python-socketio==3.1.2
python-socketio==4.6.0
pytz==2018.7
rope==0.12.0
......@@ -33,4 +31,3 @@ uuid==1.30
Werkzeug==0.14.1
WTForms==2.2.1
WTForms-SQLAlchemy==0.1
python-decouple
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment