コード例 #1
0
def set_pixel_position(user):
    if not is_admin(user):
        abort(403, "Forbidden Bru")

    body = request.get_json()
    if 'row' not in body:
        abort(415, 'Missing height value')
    if 'column' not in body:
        abort(415, 'Missing width value')


    #TODO: variable mac a changer en string pour voir l'erreur
    mac = 1;

    SchedulerState.add_cell(body['column'], body['row'], mac);

    return jsonify(row=body['row'], column=body['column'])
コード例 #2
0
 def update_DB(self):
     if self.pixels.get('default'):  #Remove the fake pixel
         self.pixels.pop('default')
     #Updates the server dictionnaries
     Websock.send_pixels(self.pixels)
     Websock.send_pos_unk({})
     Websock.send_deco(self.deco)
     Websock.send_get_deco()
     #Update DB
     if (
             self.params['mode'] == 'ama' or self.params['mode'] == 'skip'
     ):  # in case of initial addressing, the previous configuration is first deleted.
         SchedulerState.drop_dic()
         print_flush("Database cleaned")
     while (len(self.pixels) !=
            0):  #Pixels are then added one by one to the database
         (mac, ((x, y), ind)) = self.pixels.popitem()
         SchedulerState.add_cell(x, y, mac, ind)
     print_flush("Database updated")