|
|
|
@ -17,3 +17,15 @@ def event_stream(type, action="update", payload=None):
|
|
|
|
|
except (ValueError, TypeError):
|
|
|
|
|
pass
|
|
|
|
|
socketio.emit("data", {"type": type, "action": action, "payload": payload})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def show_message(msg):
|
|
|
|
|
event_stream(type="message", payload=msg)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def show_progress(name, percent):
|
|
|
|
|
event_stream(type="progress", payload={"name": name, "percent": percent})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def hide_progress(name):
|
|
|
|
|
event_stream(type="progress", action="delete", payload={"name": name, "percent": 0})
|
|
|
|
|