增加ini 人脸超时限制
This commit is contained in:
@ -450,7 +450,7 @@ class QFaceCameraViewPage(PageTemplate):
|
|||||||
self.btn_reset.clicked.connect(lambda: self.send(build_reset()))
|
self.btn_reset.clicked.connect(lambda: self.send(build_reset()))
|
||||||
self.btn_enroll.clicked.connect(self.do_enroll_itg_single)
|
self.btn_enroll.clicked.connect(self.do_enroll_itg_single)
|
||||||
self.btn_users.clicked.connect(self.do_manage_users)
|
self.btn_users.clicked.connect(self.do_manage_users)
|
||||||
self.btn_verify.clicked.connect(self.do_verify)
|
# self.btn_verify.clicked.connect(self.do_verify)
|
||||||
|
|
||||||
|
|
||||||
# 定时器:串口监控 & 视频重连
|
# 定时器:串口监控 & 视频重连
|
||||||
@ -536,21 +536,22 @@ class QFaceCameraViewPage(PageTemplate):
|
|||||||
self.log(f"[ERR] write: {e}")
|
self.log(f"[ERR] write: {e}")
|
||||||
|
|
||||||
# 业务功能
|
# 业务功能
|
||||||
def do_verify(self):
|
# def do_verify(self):
|
||||||
dlg = VerifyDialog(self)
|
# dlg = VerifyDialog(self)
|
||||||
if dlg.exec_() == QDialog.Accepted:
|
# if dlg.exec_() == QDialog.Accepted:
|
||||||
pd_val, timeout_val = dlg.values()
|
# pd_val, timeout_val = dlg.values()
|
||||||
self.send(build_verify(pd_val, timeout_val))
|
# self.send(build_verify(pd_val, timeout_val))
|
||||||
|
|
||||||
def do_enroll_itg_single(self):
|
|
||||||
dlg = EnrollItgSingleDialog(self)
|
|
||||||
if dlg.exec_() == QDialog.Accepted:
|
|
||||||
admin_val, uname, face_dir, timeout_val, itg_val = dlg.values()
|
|
||||||
self.last_enroll_name = uname
|
|
||||||
self.send(build_enroll_itg_single(admin_val, uname, face_dir, timeout_val, itg_val))
|
|
||||||
|
|
||||||
def do_manage_users(self):
|
# def do_enroll_itg_single(self):
|
||||||
UserManageDialog(self, self.send).exec_()
|
# dlg = EnrollItgSingleDialog(self)
|
||||||
|
# if dlg.exec_() == QDialog.Accepted:
|
||||||
|
# admin_val, uname, face_dir, timeout_val, itg_val = dlg.values()
|
||||||
|
# self.last_enroll_name = uname
|
||||||
|
# self.send(build_enroll_itg_single(admin_val, uname, face_dir, timeout_val, itg_val))
|
||||||
|
|
||||||
|
# def do_manage_users(self):
|
||||||
|
# UserManageDialog(self, self.send).exec_()
|
||||||
|
|
||||||
def toggle_video(self):
|
def toggle_video(self):
|
||||||
running = self.video_worker and self.video_worker.isRunning()
|
running = self.video_worker and self.video_worker.isRunning()
|
||||||
@ -636,8 +637,9 @@ class QFaceCameraViewPage(PageTemplate):
|
|||||||
self.log(f"[REPLY] {info}")
|
self.log(f"[REPLY] {info}")
|
||||||
if info.get("mid") in (CMD_ENROLL, CMD_ENROLL_ITG) and info.get("result") == 0x00:
|
if info.get("mid") in (CMD_ENROLL, CMD_ENROLL_ITG) and info.get("result") == 0x00:
|
||||||
user_id = info.get("user_id")
|
user_id = info.get("user_id")
|
||||||
user_name = self.last_enroll_name or ""
|
# 如果用户名为空,使用用户ID作为用户名
|
||||||
if user_id and user_name:
|
user_name = self.last_enroll_name if self.last_enroll_name else str(user_id)
|
||||||
|
if user_id: # 只需检查user_id存在即可,因为user_name已确保有值
|
||||||
if save_user(user_id, user_name):
|
if save_user(user_id, user_name):
|
||||||
self.log(f"[INFO] 用户 {user_name}(ID={user_id}) 已保存")
|
self.log(f"[INFO] 用户 {user_name}(ID={user_id}) 已保存")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -70,9 +70,9 @@
|
|||||||
<widget class="QGroupBox" name="group_log">
|
<widget class="QGroupBox" name="group_log">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>340</x>
|
||||||
<y>570</y>
|
<y>670</y>
|
||||||
<width>1291</width>
|
<width>701</width>
|
||||||
<height>381</height>
|
<height>381</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -94,7 +94,7 @@
|
|||||||
<widget class="QPushButton" name="btn_save">
|
<widget class="QPushButton" name="btn_save">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>550</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>211</width>
|
<width>211</width>
|
||||||
<height>41</height>
|
<height>41</height>
|
||||||
@ -120,10 +120,10 @@ color: rgb(170, 0, 0);</string>
|
|||||||
<widget class="QTextEdit" name="txt_log">
|
<widget class="QTextEdit" name="txt_log">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>40</x>
|
<x>-20</x>
|
||||||
<y>40</y>
|
<y>60</y>
|
||||||
<width>1111</width>
|
<width>701</width>
|
||||||
<height>321</height>
|
<height>301</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -131,10 +131,10 @@ color: rgb(170, 0, 0);</string>
|
|||||||
<widget class="QGroupBox" name="group_video">
|
<widget class="QGroupBox" name="group_video">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>410</x>
|
<x>450</x>
|
||||||
<y>10</y>
|
<y>110</y>
|
||||||
<width>481</width>
|
<width>481</width>
|
||||||
<height>561</height>
|
<height>551</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
@ -146,7 +146,7 @@ color: rgb(170, 0, 0);</string>
|
|||||||
<widget class="QLabel" name="video_label">
|
<widget class="QLabel" name="video_label">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>70</x>
|
<x>60</x>
|
||||||
<y>50</y>
|
<y>50</y>
|
||||||
<width>360</width>
|
<width>360</width>
|
||||||
<height>480</height>
|
<height>480</height>
|
||||||
@ -191,8 +191,8 @@ color: rgb(170, 0, 0);</string>
|
|||||||
<widget class="QGroupBox" name="group_cmd">
|
<widget class="QGroupBox" name="group_cmd">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>260</x>
|
<x>340</x>
|
||||||
<y>20</y>
|
<y>110</y>
|
||||||
<width>109</width>
|
<width>109</width>
|
||||||
<height>551</height>
|
<height>551</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -261,7 +261,7 @@ color: rgb(170, 0, 0);</string>
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
<string>Index=0, Action=Verify,SelectImag=IMxx_00F.png</string>
|
<string>Index=0, Action=Verify,password,SelectImag=IMxx_00F.png</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>识别</string>
|
<string>识别</string>
|
||||||
@ -299,8 +299,64 @@ color: rgb(170, 0, 0);</string>
|
|||||||
<string>用户管理</string>
|
<string>用户管理</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="FaceRecogTimeoutEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>210</y>
|
||||||
|
<width>120</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="statusTip">
|
||||||
|
<string>System=FaceRecogTimeout, Action=ModifySystem, Index=13,SelectImag=P4_ParaSelect.png, password</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgba(85, 170, 127,0);
|
||||||
|
color: rgb(177, 229, 252);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="P05_01BG">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1920</width>
|
||||||
|
<height>1080</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap>../image/FaceCameraView.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<zorder>P05_01BG</zorder>
|
||||||
|
<zorder>groupBox_sys</zorder>
|
||||||
|
<zorder>group_log</zorder>
|
||||||
|
<zorder>group_video</zorder>
|
||||||
|
<zorder>group_cmd</zorder>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
@ -864,11 +864,47 @@ color: rgb(207, 0, 13);</string>
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="FaceRecogTimeoutEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>880</x>
|
||||||
|
<y>640</y>
|
||||||
|
<width>120</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="statusTip">
|
||||||
|
<string>System=FaceRecogTimeout, Action=ModifySystem, Index=13,SelectImag=P4_ParaSelect.png, password</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgba(85, 170, 127,0);
|
||||||
|
color: rgb(177, 229, 252);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<zorder>sys_P00_2</zorder>
|
<zorder>sys_P00_2</zorder>
|
||||||
<zorder>sys_P00_3</zorder>
|
<zorder>sys_P00_3</zorder>
|
||||||
<zorder>BindNum_Title</zorder>
|
<zorder>BindNum_Title</zorder>
|
||||||
<zorder>sys_home</zorder>
|
<zorder>sys_home</zorder>
|
||||||
<zorder>sys_menu</zorder>
|
<zorder>sys_menu</zorder>
|
||||||
|
<zorder>FaceRecogTimeoutEdit</zorder>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="indicator_Label">
|
<widget class="QLabel" name="indicator_Label">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
|||||||
@ -20,7 +20,7 @@ from Shared_CODE.DialogModifyValue import DialogModifyValue
|
|||||||
from Shared_CODE.DialogModifyAlias import DialogModifyAlias
|
from Shared_CODE.DialogModifyAlias import DialogModifyAlias
|
||||||
from Shared_CODE.DialogModifyText import DialogModifyText
|
from Shared_CODE.DialogModifyText import DialogModifyText
|
||||||
from Shared_CODE.DialogInform import DialogInform
|
from Shared_CODE.DialogInform import DialogInform
|
||||||
from QT5_Project.Shared_CODE.DialogFaceVerify import VerifyDialog
|
from QT5_Project.Shared_CODE.FaceRecognitionProtocol import parse_reply
|
||||||
from QT5_Project.Shared_CODE.DialogFaceEnrollItgSingle import EnrollItgSingleDialog
|
from QT5_Project.Shared_CODE.DialogFaceEnrollItgSingle import EnrollItgSingleDialog
|
||||||
from QT5_Project.Shared_CODE.DialogFaceUserManage import UserManageDialog
|
from QT5_Project.Shared_CODE.DialogFaceUserManage import UserManageDialog
|
||||||
|
|
||||||
@ -543,6 +543,7 @@ class UIFrameWork(QMainWindow, class_comm_mqtt_interface):
|
|||||||
|
|
||||||
def process_widget_timeout_list(self) :
|
def process_widget_timeout_list(self) :
|
||||||
list_index = 0
|
list_index = 0
|
||||||
|
self.para_face() #刷新人脸数据显示
|
||||||
for timeout_items in self.widget_timeout_list:
|
for timeout_items in self.widget_timeout_list:
|
||||||
time_limit = timeout_items[0]
|
time_limit = timeout_items[0]
|
||||||
cur_time = timeout_items[1]
|
cur_time = timeout_items[1]
|
||||||
@ -723,6 +724,7 @@ class UIFrameWork(QMainWindow, class_comm_mqtt_interface):
|
|||||||
self.create_alias_list()
|
self.create_alias_list()
|
||||||
self.process_alias_query()
|
self.process_alias_query()
|
||||||
self.para_or_measure_query()
|
self.para_or_measure_query()
|
||||||
|
self.para_face()
|
||||||
|
|
||||||
def create_alias_list(self, child = None) :
|
def create_alias_list(self, child = None) :
|
||||||
widget :QWidget = self
|
widget :QWidget = self
|
||||||
@ -767,21 +769,43 @@ class UIFrameWork(QMainWindow, class_comm_mqtt_interface):
|
|||||||
def on_select_object_action_process(self, select_object : QWidget) :
|
def on_select_object_action_process(self, select_object : QWidget) :
|
||||||
tip_str = select_object.statusTip()
|
tip_str = select_object.statusTip()
|
||||||
action_str = get_tip_value_str(tip_str, "Action", None)
|
action_str = get_tip_value_str(tip_str, "Action", None)
|
||||||
|
input = False
|
||||||
if action_str != None :
|
if action_str != None :
|
||||||
if "password" in tip_str :
|
if "password" in tip_str:
|
||||||
|
|
||||||
|
# 第一步:弹出认证方式选择框
|
||||||
|
dialog_auth_choice = DialogModifyAlias(self)
|
||||||
|
auth_dict = {
|
||||||
|
"face": "人脸认证",
|
||||||
|
"word": "密码认证"
|
||||||
|
}
|
||||||
|
dialog_auth_choice.set_alias_item_info(auth_dict, "password", "请选择认证方式")
|
||||||
|
|
||||||
|
if dialog_auth_choice.exec() == QDialog.Accepted:
|
||||||
|
choice = dialog_auth_choice.value
|
||||||
|
|
||||||
|
# 第二步:根据选择执行不同的认证
|
||||||
|
if choice == "word":
|
||||||
dialog_modify_text = DialogModifyValue(self)
|
dialog_modify_text = DialogModifyValue(self)
|
||||||
caption_str = "请输入密码:"
|
caption_str = "请输入密码:"
|
||||||
dialog_modify_text.update_modify_info("", "0000", caption_str)
|
dialog_modify_text.update_modify_info("", "0000", caption_str)
|
||||||
input = False
|
input = False
|
||||||
|
|
||||||
if dialog_modify_text.exec() == QDialog.Accepted:
|
if dialog_modify_text.exec() == QDialog.Accepted:
|
||||||
input = True
|
input = True
|
||||||
modify_screen_time_str = dialog_modify_text.value
|
modify_screen_time_str = dialog_modify_text.value
|
||||||
pass_word = system_parameter()
|
pass_word = system_parameter()
|
||||||
if modify_screen_time_str != pass_word.get_system_password() :
|
if modify_screen_time_str != pass_word.get_system_password():
|
||||||
inform_box : DialogInform = DialogInform()
|
inform_box = DialogInform()
|
||||||
inform_box.information("提示", "密码错误,无法修改!")
|
inform_box.information("提示", "密码错误,无法修改!")
|
||||||
return
|
return
|
||||||
|
print("密码认证成功")
|
||||||
|
|
||||||
|
elif choice == "face":
|
||||||
|
# face_page = self.parent_window.P05_01_FaceCameraView
|
||||||
|
input = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
input = True
|
input = True
|
||||||
if input :
|
if input :
|
||||||
@ -799,12 +823,13 @@ class UIFrameWork(QMainWindow, class_comm_mqtt_interface):
|
|||||||
if isinstance(select_object, QLineEdit) :
|
if isinstance(select_object, QLineEdit) :
|
||||||
self.on_line_edit_modify_click(select_object)
|
self.on_line_edit_modify_click(select_object)
|
||||||
elif "Users" in action_str :
|
elif "Users" in action_str :
|
||||||
UserManageDialog(self, self.sender()).exec_()
|
self.do_manage_users()
|
||||||
elif "Verify" in action_str :
|
elif "Verify" in action_str :
|
||||||
dlg = VerifyDialog(self)
|
self.do_verify()
|
||||||
if dlg.exec_() == QDialog.Accepted:
|
elif "EnrollItgSingle" in action_str :
|
||||||
pd_val, timeout_val = dlg.values()
|
self.do_enroll_itg_single()
|
||||||
self.send(build_verify(pd_val, timeout_val))
|
elif "Reset" in action_str :
|
||||||
|
self.reset_command()
|
||||||
|
|
||||||
self.virtual_widget_action_process(select_object, action_str)
|
self.virtual_widget_action_process(select_object, action_str)
|
||||||
|
|
||||||
@ -818,7 +843,27 @@ class UIFrameWork(QMainWindow, class_comm_mqtt_interface):
|
|||||||
break
|
break
|
||||||
menu_index += 1
|
menu_index += 1
|
||||||
return match_object, menu_index
|
return match_object, menu_index
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
def do_verify(self):
|
||||||
|
pd_val = 0
|
||||||
|
timeout_val = system_parameter().get_verify_timeout()
|
||||||
|
self.send(build_verify(pd_val, timeout_val))
|
||||||
|
|
||||||
|
def do_enroll_itg_single(self):
|
||||||
|
dlg = EnrollItgSingleDialog(self)
|
||||||
|
if dlg.exec_() == QDialog.Accepted:
|
||||||
|
admin_val, uname, face_dir, timeout_val, itg_val = dlg.values()
|
||||||
|
self.last_enroll_name = uname
|
||||||
|
self.send(build_enroll_itg_single(admin_val, uname, face_dir, timeout_val, itg_val))
|
||||||
|
|
||||||
|
def do_manage_users(self):
|
||||||
|
UserManageDialog(self, self.send).exec_()
|
||||||
|
|
||||||
|
def reset_command(self):
|
||||||
|
self.send(build_reset())
|
||||||
|
|
||||||
|
################################################################################
|
||||||
#刷新屏幕上的系统信息, 例如时间日期之类
|
#刷新屏幕上的系统信息, 例如时间日期之类
|
||||||
def flush_system_info(self, child = None) :
|
def flush_system_info(self, child = None) :
|
||||||
widget : QWidget= child
|
widget : QWidget= child
|
||||||
@ -953,6 +998,22 @@ class UIFrameWork(QMainWindow, class_comm_mqtt_interface):
|
|||||||
pass_word.set_system_password(modify_screen_time_str)
|
pass_word.set_system_password(modify_screen_time_str)
|
||||||
dialog_inform = DialogInform(self)
|
dialog_inform = DialogInform(self)
|
||||||
dialog_inform.information("系统密码修改", "系统密码修改成功")
|
dialog_inform.information("系统密码修改", "系统密码修改成功")
|
||||||
|
|
||||||
|
elif system == "FaceRecogTimeout":
|
||||||
|
dialog_modify_text = DialogModifyValue(self)
|
||||||
|
caption_str = "修改人脸识别超时时间(秒)"
|
||||||
|
frt = system_parameter()
|
||||||
|
dialog_modify_text.update_modify_info("", str(frt.get_verify_timeout()), caption_str)
|
||||||
|
|
||||||
|
if dialog_modify_text.exec() == QDialog.Accepted:
|
||||||
|
modify_screen_time_str = dialog_modify_text.value
|
||||||
|
result = frt.set_verify_timeout(modify_screen_time_str)
|
||||||
|
|
||||||
|
if result is not None:
|
||||||
|
self.FaceRecogTimeoutEdit.setText(str(result))
|
||||||
|
dialog_inform = DialogInform(self)
|
||||||
|
dialog_inform.information("人脸识别超时时间修改", "人脸识别超时时间修改成功")
|
||||||
|
|
||||||
def on_line_edit_modify_click(self, sender :QLineEdit) :
|
def on_line_edit_modify_click(self, sender :QLineEdit) :
|
||||||
match_object : QLineEdit = None
|
match_object : QLineEdit = None
|
||||||
match_object, menu_index = self.search_menu_match_object(sender)
|
match_object, menu_index = self.search_menu_match_object(sender)
|
||||||
@ -1665,6 +1726,20 @@ class UIFrameWork(QMainWindow, class_comm_mqtt_interface):
|
|||||||
self.param_dict[mqtt_str] = ALIAS_QUERY_NONE
|
self.param_dict[mqtt_str] = ALIAS_QUERY_NONE
|
||||||
self.para_or_measure_query(child_widget)
|
self.para_or_measure_query(child_widget)
|
||||||
|
|
||||||
|
def para_face(self, child = None) :
|
||||||
|
widget :QWidget = self
|
||||||
|
if child == None :
|
||||||
|
self.param_dict = {}
|
||||||
|
else :
|
||||||
|
widget = child
|
||||||
|
for child_widget in widget.children():
|
||||||
|
if hasattr(child_widget, "statusTip") :
|
||||||
|
tip_str : str = child_widget.statusTip()
|
||||||
|
if "FaceRecogTimeout" in tip_str :
|
||||||
|
frt = system_parameter()
|
||||||
|
child_widget.setText(str(frt.get_verify_timeout()))
|
||||||
|
continue
|
||||||
|
self.para_face(child_widget)
|
||||||
|
|
||||||
def flush_system_cycle(self) :
|
def flush_system_cycle(self) :
|
||||||
self.flush_system_info()
|
self.flush_system_info()
|
||||||
|
|||||||
@ -68,7 +68,7 @@ def save_user(user_id: int, user_name: str) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
class UserManageDialog(QDialog):
|
class UserManageDialog(QDialog):
|
||||||
def __init__(self, parent, send_func):
|
def __init__(self, parent=None, send_func=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.send_func = send_func
|
self.send_func = send_func
|
||||||
uic.loadUi(users_ui_file_path, self)
|
uic.loadUi(users_ui_file_path, self)
|
||||||
@ -91,7 +91,7 @@ class UserManageDialog(QDialog):
|
|||||||
def delete_selected(self):
|
def delete_selected(self):
|
||||||
row = self.table.currentRow()
|
row = self.table.currentRow()
|
||||||
if row < 0:
|
if row < 0:
|
||||||
QMessageBox.warning(self, "提示", "请选择要删除的用户")
|
QMessageBox.warning(self, "提示", "删除选择用户")
|
||||||
return
|
return
|
||||||
uid = self.table.item(row, 0).text()
|
uid = self.table.item(row, 0).text()
|
||||||
uname = self.table.item(row, 1).text()
|
uname = self.table.item(row, 1).text()
|
||||||
|
|||||||
@ -87,6 +87,8 @@ CMD_NAMES = {
|
|||||||
CMD_GET_VERSION: "获取版本信息",
|
CMD_GET_VERSION: "获取版本信息",
|
||||||
CMD_INIT_ENCRYPTION: "初始化加密",
|
CMD_INIT_ENCRYPTION: "初始化加密",
|
||||||
CMD_ENROLL_WITH_PHOTO: "照片录入注册",
|
CMD_ENROLL_WITH_PHOTO: "照片录入注册",
|
||||||
|
CMD_FACE_VIEW: "人脸框显示切换",
|
||||||
|
CMD_UVC_VIEW: "视频模式切换",
|
||||||
}
|
}
|
||||||
|
|
||||||
# 结果码名称映射(结果码 -> 中文名称)
|
# 结果码名称映射(结果码 -> 中文名称)
|
||||||
@ -218,7 +220,7 @@ def build_led_control(state: int) -> bytes:
|
|||||||
|
|
||||||
#pd_rightaway: int,验证成功后是否立即断电(0=不立即断电,1=立即断电),仅保留低8位有效(通过&0xFF确保)
|
#pd_rightaway: int,验证成功后是否立即断电(0=不立即断电,1=立即断电),仅保留低8位有效(通过&0xFF确保)
|
||||||
#timeout: int,验证超时时间(单位:秒),范围通常为1-255秒,仅保留低8位有效(通过&0xFF确保)
|
#timeout: int,验证超时时间(单位:秒),范围通常为1-255秒,仅保留低8位有效(通过&0xFF确保)
|
||||||
def build_verify(pd_rightaway: int = 0, timeout: int = 10) -> bytes:
|
def build_verify(pd_rightaway, timeout: int = 10) -> bytes:
|
||||||
data = struct.pack("BB", pd_rightaway & 0xFF, timeout & 0xFF)
|
data = struct.pack("BB", pd_rightaway & 0xFF, timeout & 0xFF)
|
||||||
return pack_frame(CMD_VERIFY, data)
|
return pack_frame(CMD_VERIFY, data)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -149,7 +149,8 @@ class system_parameter :
|
|||||||
default_config = {
|
default_config = {
|
||||||
'screen_blanking_time': '360',
|
'screen_blanking_time': '360',
|
||||||
'system_password': '2008',
|
'system_password': '2008',
|
||||||
'language': 'zh_CN'
|
'language': 'zh_CN',
|
||||||
|
"facerecognition_timeout": '10',
|
||||||
}
|
}
|
||||||
|
|
||||||
# 如果配置文件存在,加载配置
|
# 如果配置文件存在,加载配置
|
||||||
@ -161,6 +162,7 @@ class system_parameter :
|
|||||||
self.screen_blanking_time = system_param.get('blanking_time', default_config['screen_blanking_time'])
|
self.screen_blanking_time = system_param.get('blanking_time', default_config['screen_blanking_time'])
|
||||||
self.system_password = system_param.get('password', default_config['system_password'])
|
self.system_password = system_param.get('password', default_config['system_password'])
|
||||||
self.language = system_param.get('language', default_config['language'])
|
self.language = system_param.get('language', default_config['language'])
|
||||||
|
self.facerecognition_timeout = system_param.get('facerecognition_timeout', default_config['facerecognition_timeout'])
|
||||||
except (configparser.Error, KeyError) as e:
|
except (configparser.Error, KeyError) as e:
|
||||||
# 处理读取配置文件时的错误
|
# 处理读取配置文件时的错误
|
||||||
print(f"读取配置错误: {e}。使用默认设置。")
|
print(f"读取配置错误: {e}。使用默认设置。")
|
||||||
@ -174,6 +176,7 @@ class system_parameter :
|
|||||||
self.screen_blanking_time = default_config['screen_blanking_time']
|
self.screen_blanking_time = default_config['screen_blanking_time']
|
||||||
self.system_password = default_config['system_password']
|
self.system_password = default_config['system_password']
|
||||||
self.language = default_config['language']
|
self.language = default_config['language']
|
||||||
|
self.facerecognition_timeout = default_config['facerecognition_timeout']
|
||||||
|
|
||||||
def write_to_ini(self):
|
def write_to_ini(self):
|
||||||
"""将默认配置写入ini文件。"""
|
"""将默认配置写入ini文件。"""
|
||||||
@ -181,7 +184,8 @@ class system_parameter :
|
|||||||
config['SystemParam'] = {
|
config['SystemParam'] = {
|
||||||
'blanking_time': self.screen_blanking_time,
|
'blanking_time': self.screen_blanking_time,
|
||||||
'password': self.system_password,
|
'password': self.system_password,
|
||||||
'language': self.language
|
'language': self.language,
|
||||||
|
'facerecognition_timeout': self.facerecognition_timeout
|
||||||
}
|
}
|
||||||
with open("system_parameter.ini", 'w') as configfile:
|
with open("system_parameter.ini", 'w') as configfile:
|
||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
@ -208,12 +212,21 @@ class system_parameter :
|
|||||||
def get_system_language(self):
|
def get_system_language(self):
|
||||||
return self.language
|
return self.language
|
||||||
|
|
||||||
|
def set_verify_timeout(self, timeout):
|
||||||
|
self.facerecognition_timeout = timeout
|
||||||
|
self.write_to_ini()
|
||||||
|
|
||||||
|
def get_verify_timeout(self):
|
||||||
|
return int(self.facerecognition_timeout)
|
||||||
|
|
||||||
# 向文件存储系统信息
|
# 向文件存储系统信息
|
||||||
def write_to_ini(self):
|
def write_to_ini(self):
|
||||||
system_param = configparser.ConfigParser()
|
system_param = configparser.ConfigParser()
|
||||||
system_param['SystemParam'] = {'language': self.language,
|
system_param['SystemParam'] = {'language': self.language,
|
||||||
'blanking_time': self.screen_blanking_time,
|
'blanking_time': self.screen_blanking_time,
|
||||||
'password': self.system_password}
|
'password': self.system_password,
|
||||||
|
'facerecognition_timeout': self.facerecognition_timeout}
|
||||||
|
|
||||||
with open('system_parameter.ini', 'w') as f:
|
with open('system_parameter.ini', 'w') as f:
|
||||||
system_param.write(f)
|
system_param.write(f)
|
||||||
|
|
||||||
@ -1,104 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>MainWindow</class>
|
|
||||||
<widget class="QMainWindow" name="MainWindow">
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>人脸识别测试软件 (PyQt5)</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="centralwidget">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_root">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>8</number>
|
|
||||||
</property>
|
|
||||||
|
|
||||||
<!-- 顶部:串口配置 -->
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="group_serial">
|
|
||||||
<property name="title">
|
|
||||||
<string>串口设置</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="layout_serial">
|
|
||||||
<item><widget class="QLabel" name="lbl_port"><property name="text"><string>Port:</string></property></widget></item>
|
|
||||||
<item><widget class="QComboBox" name="cb_port"/></item>
|
|
||||||
<item><widget class="QLabel" name="lbl_baud"><property name="text"><string>Baud:</string></property></widget></item>
|
|
||||||
<item><widget class="QComboBox" name="cb_baud"/></item>
|
|
||||||
<item><widget class="QPushButton" name="btn_refresh"><property name="text"><string>刷新端口</string></property></widget></item>
|
|
||||||
<item><widget class="QPushButton" name="btn_conn"><property name="text"><string>连接</string></property></widget></item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
|
|
||||||
<!-- 中间:命令区 + 视频区 -->
|
|
||||||
<item>
|
|
||||||
<widget class="QSplitter" name="splitter_main">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
|
|
||||||
<!-- 左侧命令区 -->
|
|
||||||
<widget class="QGroupBox" name="group_cmd">
|
|
||||||
<property name="title"><string>命令</string></property>
|
|
||||||
<layout class="QVBoxLayout" name="layout_cmd">
|
|
||||||
<property name="spacing"><number>6</number></property>
|
|
||||||
<item><widget class="QPushButton" name="btn_reset"><property name="text"><string>复位</string></property></widget></item>
|
|
||||||
<item><widget class="QPushButton" name="btn_video_mode"><property name="text"><string>视频模式</string></property></widget></item>
|
|
||||||
<item><widget class="QCheckBox" name="chk_face_box"><property name="text"><string>显示人脸框</string></property></widget></item>
|
|
||||||
<item><widget class="QPushButton" name="btn_verify"><property name="text"><string>识别</string></property></widget></item>
|
|
||||||
<item><widget class="QPushButton" name="btn_enroll"><property name="text"><string>ITG注册</string></property></widget></item>
|
|
||||||
<item><widget class="QPushButton" name="btn_users"><property name="text"><string>用户管理</string></property></widget></item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_cmd">
|
|
||||||
<property name="orientation"><enum>Qt::Vertical</enum></property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size><width>20</width><height>40</height></size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
|
|
||||||
<!-- 右侧视频区 -->
|
|
||||||
<widget class="QGroupBox" name="group_video">
|
|
||||||
<property name="title"><string>USB 视频流</string></property>
|
|
||||||
<layout class="QVBoxLayout" name="layout_video">
|
|
||||||
<property name="spacing"><number>6</number></property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="video_label">
|
|
||||||
<property name="text"><string>未打开</string></property>
|
|
||||||
<property name="alignment"><set>Qt::AlignCenter</set></property>
|
|
||||||
<property name="minimumSize"><size><width>360</width><height>480</height></size></property>
|
|
||||||
<property name="frameShape"><enum>QFrame::Box</enum></property>
|
|
||||||
<property name="frameShadow"><enum>QFrame::Sunken</enum></property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item><widget class="QPushButton" name="btn_video"><property name="text"><string>打开视频</string></property></widget></item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
|
|
||||||
<!-- 底部日志 -->
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="group_log">
|
|
||||||
<property name="title"><string>日志</string></property>
|
|
||||||
<layout class="QVBoxLayout" name="layout_log">
|
|
||||||
<property name="spacing"><number>6</number></property>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="txt_log">
|
|
||||||
<property name="readOnly"><bool>true</bool></property>
|
|
||||||
<property name="font">
|
|
||||||
<font><family>Consolas</family><pointsize>10</pointsize></font>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item><widget class="QPushButton" name="btn_save"><property name="text"><string>保存日志</string></property></widget></item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
@ -1 +1 @@
|
|||||||
1,冯佳,2025-09-02 09:05:45
|
1,1,2025-09-11 16:21:21
|
||||||
|
|||||||
|
@ -2,4 +2,5 @@
|
|||||||
language = zh_CN
|
language = zh_CN
|
||||||
blanking_time = 360
|
blanking_time = 360
|
||||||
password = 2008
|
password = 2008
|
||||||
|
facerecognition_timeout = 20
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user