# -*- coding: utf-8 -*-
from __future__ import annotations
import sys, os, io, csv, time, datetime
from typing import Callable, Optional

# PyQt5
from PyQt5 import QtWidgets, uic
from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer, QSize
from PyQt5.QtGui import QImage, QPixmap, QKeySequence
from PyQt5.QtWidgets import (
    QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
    QLabel, QPushButton, QComboBox, QTextEdit, QFileDialog, QMessageBox,
    QGroupBox, QGridLayout, QDialog, QFormLayout, QSpinBox, QCheckBox,
    QLineEdit, QTableWidget, QTableWidgetItem,QDialogButtonBox,QShortcut
)

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import cv2
from PIL import Image
import serial
import serial.tools.list_ports

# ---------- 协议导入----------
from Shared_CODE.FaceRecognitionProtocol import (
    build_reset, build_uvc_view, build_face_view, build_verify,
    build_enroll_itg_single, build_delete_all, build_get_all_userid,build_delete_user,
    MID_REPLY, MID_NOTE, CMD_ENROLL, CMD_ENROLL_ITG,
    parse_reply, parse_note
)

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../Shared_UI'))

verify_ui_file_path = os.path.join(ui_path, "verify.ui")

class VerifyDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        uic.loadUi(verify_ui_file_path, self)
        self.cb_rightaway.setCurrentIndex(0)
        self.sb_timeout.setValue(10)
        self.btn_ok.clicked.connect(self.accept)

    def values(self):
        pd_val = self.cb_rightaway.currentIndex()
        timeout_val = self.sb_timeout.value()
        return pd_val, timeout_val


if __name__ == '__main__':
    app = QApplication(sys.argv)
    dialog = VerifyDialog()
    dialog.exec()
    sys.exit(0)
