import time
from PyQt5.QtWidgets import *
from PyQt5 import QtCore,QtWidgets
from PyQt5.QtGui import *
import GUI,InformationGui,os
from functools import partial
from tkinter import *
import csv
#import dlib
import numpy as np
from skimage import io
import pandas as pd
#封装主界面
class firstwindow(QMainWindow,GUI.Ui_MainWindow):
def __init__(self,parent = None):
super().__init__(parent=parent)
self.ui = GUI.Ui_MainWindow
self.setupUi(self)
self.pushButton_3.clicked.connect(self.convert)
self.input = ''
self.informationwin = information()
self.show()
#自动识别按钮状态码,防止多点
self.stateButton = 0
#信息同步
def pushButton(self):
print('0')
#自动识别
def pushButton_2(self):
self.stateButton = self.stateButton + 1
#信息采集
def pushButton_4(self):
print(1)
#安全教育
def pushButton_5(self):
print(2)
#输入信息
def convert(self):
self.input = self.lineEdit.text()
f = open('tmp.txt', 'w', encoding='utf-8')
f.write(str(self.input))
f.close()
self.informationwin .show1(self.input)
#信息窗口
class information(QDialog,InformationGui.Ui_Dialog):
def __init__(self,parent = None):
super(information,self).__init__()
self.setupUi(self)
self.i = 0
self.data = pd.DataFrame(pd.read_excel("information.xlsx"))
#获取照片
def get_image(self,path):
file = os.listdir(path)
image = path + file[0]
return image
#姓名转换为ID
def get_id(self):
if self.input.isdigit() == FALSE:
name = self.input
if len(self.data.loc[self.data['姓名']==name])!=0:
if self.i >= len(self.data.loc[self.data['姓名'] == name]):
self.i = 0
result = self.data.loc[self.data['姓名'] == name]
id_excel = str(result.iat[self.i,1])
return id_excel
else:
id_excel = self.input
return id_excel
def pushButton_3(self):
#self.i = self.i +1
#self.show1()
print(33)
def show1(self,input):
#获取输入信息
self.input = input
id = self.get_id()
#根据ID搜索表格
if len(self.data.loc[self.data['身份证'] == id] == 0):
result = self.data.loc[self.data['身份证'] == id]
id_excel = str(result.iat[0, 1])
name = result.iat[0, 2]
workplace = result.iat[0, 4]
jobs = result.iat[0, 5]
work_data = result.iat[0, 6]
path = 'data/image/' + name + '/'
if os.path.exists(path) == True:
image_path = self.get_image('data/image/' + name + '/')
else:
image_path = '中金图标.jpg'
else:
name = '查无此人'
workplace = ' '
work_data = ''
jobs = ''
image_path = '中金图标.jpg'
self.label.setPixmap(QPixmap(image_path))
self.textBrowser.setText('姓名: ' + str(name)) # 修改姓名
self.textBrowser_2.setText(str('部门: ' + str(workplace)))
self.textBrowser_3.setText(str('上岗日期: ' + str(work_data)))
self.textBrowser_4.setText(str('培训记录:'))
self.textBrowser_5.setText(str('违章记录:'))
self.textBrowser_6.setText(str('岗位: ' + str(jobs)))
#按钮
self.pushButton.clicked.connect(self.pushButton_3())
#显示窗口
self.exec()
if __name__ == '__main__':
app = QApplication(sys.argv)
#informationwin = information()
first = firstwindow()
first.show()
sys.exit(app.exec())
Traceback (most recent call last):
File "D:/人员系统SVN/source code/-Personnel-information-management-system/the new code.py", line 44, in convert
self.informationwin .show1(self.input)
File "D:/人员系统SVN/source code/-Personnel-information-management-system/the new code.py", line 108, in show1
self.pushButton.clicked.connect(self.pushButton_3())
TypeError: 'QPushButton' object is not callable