# encoding:utf-8
from PyQt5 import QtCore,QtGui,QtWidgets
import sys
import cv2
from PyQt5 import QtWidgets,QtMultimediaWidgets
from PyQt5.QtWidgets import QMessageBox,QFileDialog,QDesktopWidget
from PyQt5.QtMultimedia import QCamera,QCameraImageCapture,QCameraViewfinderSettings
import requests
from IDCardOCR import MyIDCardOCR as MyIECard
import os,shutil
from HouseHold import MyHouseHold as HH
from itertools import groupby
#import PyQt5.sip
class Ui_MainWindow(QtWidgets.QWidget):
def __init__(self,parent=None):
super().__init__(parent) #父类的构造函数
self.set_ui() #初始化程序界面
self.slot_init() #初始化槽函数
self.setWindowTitle('证件信息采集工具 Beta version 0.2')
self.i = 0
self.cwd = os.getcwd() # 获取当前程序文件位置
#self.setStyleSheet("background-color:black;")
self.center()
#self.StatusBar.showMessage('准备就绪...')
self.label_LuJing.setText(MyIECard.Read_ini('FunFolder','folder'))
self.pmgd = 500
self.pmkd = 1024
def center(self):
self.deskSize = QDesktopWidget().screenGeometry()#获取桌面窗体参数
windowSize=self.geometry()#获取窗体本身参数
self.move(100,20)#居中设置
#self.resize(200,deskSize.height()-80)
'''程序界面布局'''
def set_ui(self):
self.__layout_main = QtWidgets.QHBoxLayout() #总布局
self.__layout_fun_button = QtWidgets.QVBoxLayout() #按键布局
self.label_ShiYongCiShu = QtWidgets.QLabel(MyIECard.Upgrade_UsageCount(0))
self.label_ShiYongCiShu.setStyleSheet("color:green;font-size:12px;font-family:Microsoft YaHei;")
#self.label_ShiYongCiShu.setWordWrap(True)
self.__layout_fun_button.addWidget(self.label_ShiYongCiShu)
self.label_CameraNum = QtWidgets.QLabel(MyIECard.Camera_Num_label())
self.label_CameraNum.setStyleSheet("color:blue;font-size:12px;font-family:Microsoft YaHei;")
#self.label_ShiYongCiShu.setWordWrap(True)
self.__layout_fun_button.addWidget(self.label_CameraNum)
pdsxtt = MyIECard.Read_ini('CameraSettings','Camera')
self.button_DingYiSheXiangTou = QtWidgets.QPushButton('设置摄像头')
self.button_DingYiSheXiangTou.setMinimumHeight(30)
self.button_DingYiSheXiangTou.setStyleSheet("background-color:red;font-size:13px;font-family:Microsoft YaHei;")
self.__layout_fun_button.addWidget(self.button_DingYiSheXiangTou)
if pdsxtt == ''or pdsxtt == '99':
self.button_DingYiSheXiangTou.setText('设置摄像头')
else:
self.button_DingYiSheXiangTou.setText('重新设置摄像头')
#Qlabel显示路径
self.label_LuJing = QtWidgets.QLabel(MyIECard.Read_ini('FunFolder','folder'))
#MyIECard.CreateFolder(MyIECard.Read_ini('FunFolder','folder'))
self.label_LuJing.setStyleSheet("background-color:black;color:rgb(127,255,0);font-size:15px;font-family:Microsoft YaHei;")
self.label_LuJing.setMinimumHeight(30)
self.__layout_fun_button.addWidget(self.label_LuJing)
#QPushButton点击选择路径
self.button_XuanZeLuJing = QtWidgets.QPushButton('选择保存路径')
self.button_XuanZeLuJing.setStyleSheet("background-color:orange;font-size:13px;font-family:Microsoft YaHei;")
self.button_XuanZeLuJing.setMinimumHeight(30)
self.__layout_fun_button.addWidget(self.button_XuanZeLuJing)
self.radio_BuShiBie = QtWidgets.QRadioButton("不识别身份证")
self.radio_BuShiBie.setStyleSheet("color:blue;font-size:13px;font-family:Microsoft YaHei;")
self.__layout_fun_button.addWidget(self.radio_BuShiBie)
self.radio_ShiBie = QtWidgets.QRadioButton("识别身份证")
chinanet = MyIECard.isNetOK()
sfzxx = '身份证'
if chinanet:
self.radio_ShiBie.setChecked(True)
sfzxx = '身份证识别'
else:
self.radio_BuShiBie.setChecked(True) #设置按钮点点击状态
sfzzx = '身份证'
self.radio_ShiBie.setStyleSheet("color:blue;font-size:13px;font-family:Microsoft YaHei;")
self.__layout_fun_button.addWidget(self.radio_ShiBie)
self.label_BianMa = QtWidgets.QLabel('编码(字母一位大写A-Z,数字三位0-9):')
self.label_BianMa.setStyleSheet("color:red;font-size:12px;font-family:Microsoft YaHei;")
self.__layout_fun_button.addWidget(self.label_BianMa)
self.lineEdit_BianMa = QtWidgets.QLineEdit('A001')
self.__layout_fun_button.addWidget(self.lineEdit_BianMa)
self.label_XingMing = QtWidgets.QLabel('姓名(自动识别身份证):')
self.label_XingMing.setStyleSheet("color:red;font-size:12px;font-family:Microsoft YaHei;")
self.__layout_fun_button.addWidget(self.label_XingMing)
self.lineEdit_XingMing = QtWidgets.QLineEdit('XXX')
self.__layout_fun_button.addWidget(self.lineEdit_XingMing)
if self.radio_ShiBie.isChecked() == True:
sfzxx = '身份证识别'
elif self.radio_BuShiBie.isChecked() == True:
sfzzx = '身份证'
self.button_open_camera = QtWidgets.QPushButton(sfzxx) #建立用于打开摄像头的按键
self.button_open_camera .setStyleSheet("background-color:yellow;font-size:13px;font-family:Microsoft YaHei;")
self.__layout_fun_button.addWidget(self.button_open_camera)
self.button_open_camera.setMinimumHeight(30)
self.button_pz_camera = QtWidgets.QPushButton('户口本首页')
self.button_pz_camera.setMinimumHeight(30)
self.button_pz_camera .setStyleSheet("background-color:green;font-size:13px;font-family:Microsoft YaHei;")
self.__layout_fun_button.addWidget(self.button_pz_camera)
self.button_HuKouBen = QtWidgets.QPushButton('户口本')
self.button_HuKouBen.setMinimumHeight(30)
self.button_HuKouBen.setStyleSheet("background-color:cyan;font-size:13px;font-family:Microsoft YaHei;")
self.__layout_fun_button.addWidget(self.button_HuKouBen)
self.button_QiTaQuanYuanZiLiao = QtWidgets.QPushButton('其他权源资料')
self.button_QiTaQuanYuanZiLiao.setMinimumHeight(30)
self.button_QiTaQuanYuanZiLiao.setStyleSheet("background-color:blue;font-size:13px;font-family:Microsoft YaHei;");
self.__layout_fun_button.addWidget(self.button_QiTaQuanYuanZiLiao)
self.button_Next = QtWidgets.QPushButton('下一户')
self.button_Next.setStyleSheet("background-color:purple;font-size:13px;font-family:Microsoft YaHei;");
self.button_Next.setMinimumHeight(30)
self.__layout_fun_button.addWidget(self.button_Next)
self.StatusBarl_ShuoMing = QtWidgets.QLabel('准备就绪')
self.StatusBarl_ShuoMing.setStyleSheet("color:purple;font-size:12px;font-family:Microsoft YaHei;")
self.__layout_fun_button.addWidget(self.StatusBarl_ShuoMing)
#把打开摄像头的按键放到按键布局中
#把按键放入布局中
#把退出程序的按键放到按键布局中
'''把某些控件加入到总布局中'''
self.__layout_main.addLayout(self.__layout_fun_button) #把按键布局加入到总布局中
'''总布局布置好后就可以把总布局作为参数传入下面函数'''
self.setLayout(self.__layout_main) #到这步才会显示所有控件
'''初始化所有槽函数'''
def slot_init(self):
sel
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
证件信息采集程序.zip (5个子文件)
HouseHold.py 5KB
Main_BaiDuOCR.py 20KB
IDCardOCR.ini 305B
CameraClass.py 2KB
IDCardOCR.py 11KB
共 5 条
- 1
资源评论
h19801224
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功