区域赛版本
This commit is contained in:
29
app.py
29
app.py
@@ -1,4 +1,4 @@
|
||||
from flask import Flask, render_template
|
||||
from flask import Flask, render_template, request
|
||||
from flask_socketio import SocketIO
|
||||
import toml
|
||||
from loguru import logger
|
||||
@@ -51,6 +51,8 @@ logger.add(handler, format="{time:MM-DD HH:mm:ss} {message}", level="DEBUG")
|
||||
|
||||
fileOptions_path = '/home/evan/Workplace/project_main'
|
||||
fileOptions_list = ['cfg_args.toml','cfg_main.toml', 'cfg_subtask.toml']
|
||||
cfg_args_path = os.path.join(fileOptions_path, 'cfg_args.toml')
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
@@ -58,11 +60,16 @@ def index():
|
||||
|
||||
@app.route('/run')
|
||||
def run():
|
||||
return render_template('index1.html')
|
||||
mode_index = request.args.get('mode')
|
||||
config_args = toml.load(cfg_args_path)
|
||||
config_args['lane_mode']['mode_index'] = int(mode_index)
|
||||
with open(cfg_args_path, 'w') as config_file:
|
||||
toml.dump(config_args, config_file)
|
||||
return render_template('index2.html')
|
||||
|
||||
@app.route('/csdn')
|
||||
def csdn():
|
||||
return render_template('csdn.html')
|
||||
# @app.route('/csdn')
|
||||
# def csdn():
|
||||
# return render_template('csdn.html')
|
||||
|
||||
@socketio.on('operate')
|
||||
def operate_handle(data):
|
||||
@@ -134,12 +141,12 @@ def operate_handle(data):
|
||||
elif data['type'] == 'skip_task':
|
||||
logger.info(data)
|
||||
skip_task_queue.put(1)
|
||||
elif data['type'] == 'save_target_person':
|
||||
config_path = os.path.join(fileOptions_path, 'cfg_args.toml')
|
||||
config_args = toml.load(config_path)
|
||||
config_args['lane_mode']['mode_index'] = int(data['content'])
|
||||
with open(config_path, 'w') as config_file:
|
||||
toml.dump(config_args, config_file)
|
||||
# elif data['type'] == 'save_target_person':
|
||||
# config_path = os.path.join(fileOptions_path, 'cfg_args.toml')
|
||||
# config_args = toml.load(config_path)
|
||||
# config_args['lane_mode']['mode_index'] = int(data['content'])
|
||||
# with open(config_path, 'w') as config_file:
|
||||
# toml.dump(config_args, config_file)
|
||||
|
||||
@socketio.on('connect')
|
||||
def test_connect():
|
||||
|
||||
Reference in New Issue
Block a user