diff --git a/app/api/api.py b/app/api/api.py index aa843a3..a26d1a5 100644 --- a/app/api/api.py +++ b/app/api/api.py @@ -6,6 +6,7 @@ import json import datetime import os import sys +from utils.utils import send_notifycation def getFile(ruleFile): if getattr(sys, 'frozen', False): @@ -84,8 +85,8 @@ class API: self.net = PicoDet( get_settings_status_name(self.args,"ModelSetting","模型版本设置"), self.args['classfile'], - prob_threshold=get_setting_status(self.args,"ModelSetting",'confThreshold'), - iou_threshold=get_setting_status(self.args,"ModelSetting",'nmsThreshold')) + prob_threshold=float(get_setting_status(self.args,"ModelSetting",'confThreshold')), + iou_threshold=float(get_setting_status(self.args,"ModelSetting",'nmsThreshold'))) # net.detect_folder(args['img_fold'], args['result_fold']) @@ -93,6 +94,8 @@ class API: self.cap = cv2.VideoCapture(0) # 开启摄像头 # cv2.namedWindow('Video Cam', cv2.WINDOW_NORMAL) + if(self.args['toggle'] and self.args['tip']): + send_notifycation("功能已开启") diff --git a/app/api/config.json b/app/api/config.json index d7dd5fe..ea926fd 100644 --- a/app/api/config.json +++ b/app/api/config.json @@ -2,12 +2,12 @@ "classfile": "coco_label.txt", "img_fold": "./imgs", "result_fold": "results", - "toggle": false, - "tip": false, + "toggle": true, + "tip": true, "control": [ { "name": "嘴控", - "status": false + "status": true }, { "name": "眼控", @@ -15,7 +15,7 @@ }, { "name": "嘴/眼控", - "status": true + "status": false } ], "ControlSetting": [ @@ -24,7 +24,7 @@ "status": [ { "name": "开/关/开", - "status": true + "status": false }, { "name": "关/开/关", @@ -32,7 +32,7 @@ }, { "name": "闭上持续2S", - "status": false + "status": true }, { "name": "张开持续2S", @@ -69,15 +69,15 @@ }, { "name": "置信度", - "status": 0.5 + "status": "0.5" }, { "name": "confThreshold", - "status": 0.5 + "status": "0.5" }, { "name": "nmsThreshold", - "status": 0.6 + "status": "0.6" }, { "name": "图片载入方式", diff --git a/app/main.py b/app/main.py index 601093b..3a0aa04 100644 --- a/app/main.py +++ b/app/main.py @@ -42,6 +42,5 @@ if __name__ == "__main__": default='False', help="开发模式") args = parser.parse_args() - send_notifycation('EMC程序已启动') WebViewApp(args.port,args.dev=='True') diff --git a/src/components/Setting.vue b/src/components/Setting.vue index 555983e..b2f276f 100644 --- a/src/components/Setting.vue +++ b/src/components/Setting.vue @@ -17,6 +17,10 @@ watch(() => props.settingData, () => { deep: true, }) +const handleChange = () => { + +} + const { t } = useI18n() @@ -38,11 +42,13 @@ const { t } = useI18n() --> -
+
{{ t(item.name) }}
- +
+ +
diff --git a/src/components/daisy/DSelect.vue b/src/components/daisy/DSelect.vue index 6952dae..19f08e7 100644 --- a/src/components/daisy/DSelect.vue +++ b/src/components/daisy/DSelect.vue @@ -6,23 +6,19 @@ const props = defineProps({ }, }) const emit = defineEmits(['update:options']) -let selectedOption = $ref(!!props.options && props.options.find(option => option.status === true)?.name) - -const handleChange = () => { - props.options.forEach((option) => { - if (option.name === selectedOption) - option.status = true - else - option.status = false +const selectedOption = computed( + { + get() { + const opt = !!props.options && props.options.find(option => option.status === true) + return opt ? opt.name : '' + }, + set(newVal) { + props.options.forEach((option) => { + option.status = option.name === newVal + }) + emit('update:options', props.options) + }, }) - emit('update:options', props.options) -} -watch(() => props.options, () => { // 无延时props不起作用 - if (selectedOption === false) - selectedOption = props.options.find(option => option.status === true).name -}, { - deep: true, -})