示例#1
0
def on_join_main(data):
    room = data["room"]
    join_room(room)
    print("user joined room " + room)
    socketio.emit("joined-mainid", room=room)
    tile_types = boxer_app.host_worker.get_tile_types(
        {"user_id": data["user_id"]})
    return tile_types
示例#2
0
def logout(page_id):
    print("in logout")
    user_id = current_user.get_id()
    socketio.emit('close-user-windows', {"originator": page_id},
                  namespace='/library',
                  room=user_id)
    socketio.emit('close-user-windows', {"originator": page_id},
                  namespace='/main',
                  room=user_id)
    logout_user()
    return redirect(url_for("login"))
示例#3
0
def stop_spinner(user_id=None):
    if user_id is None:
        user_id = current_user.get_id()
    socketio.emit('stop-spinner', {}, namespace='/library', room=user_id)
示例#4
0
 def refresh_selector_list(self, user_obj=None):
     if user_obj is None:
         user_obj = current_user
     socketio.emit("refresh-{}-selector".format(self.res_type), {},
                   namespace='/library',
                   room=user_obj.get_id())
示例#5
0
 def update_selector_row(self, res_dict):
     user_obj = current_user
     socketio.emit("update-{}-selector-row".format(self.res_type),
                   res_dict,
                   namespace='/library',
                   room=user_obj.get_id())
示例#6
0
 def stop_library_spinner(self, library_id):
     print("stopping the library spinner")
     socketio.emit('stop-spinner', {},
                   namespace='/library',
                   room=library_id)
示例#7
0
 def clear_um_message(self, library_id):
     socketio.emit('clear-status-msg', {},
                   namespace='/library',
                   room=library_id)
示例#8
0
 def show_um_message(self, message, library_id, timeout=3):
     data = {"message": message, "timeout": timeout}
     socketio.emit('show-status-msg',
                   data,
                   namespace='/library',
                   room=library_id)
示例#9
0
def doflash(message, alert_type='alert-info', user_id=None):
    if user_id is None:
        user_id = current_user.get_id()
    data = {"message": message, "alert_type": alert_type}
    socketio.emit('stop-spinner', data, namespace='/library', room=user_id)