class BoasVindas(QWidget): def __init__(self): super(BoasVindas, self).__init__() self.horario = QTime() def getNome(self): msg, ok = QInputDialog.getText(self, 'Bem Vindo!', 'Olá, qual é seu nome?') if ok: script = ( "Meu nome é Judite, e eu irei lhe auxiliar em sua viagem analisando seu estado físico e mental" + "para evitar qualquer desatenção durante o percurso...") if (self.horario.currentTime() > QTime(5, 59) and self.horario.currentTime() < QTime(12, 0)): tts = gTTS(text='Olá, bom dia ' + msg + "." + script, lang='pt') tts.save("Mensagens Faladas\\boas-vindas.mp3") return msg elif (self.horario.currentTime() > QTime(11, 59) and self.horario.currentTime() < QTime(18, 0)): tts = gTTS(text='Olá, boa tarde ' + msg + "." + script, lang='pt') tts.save("Mensagens Faladas\\boas-vindas.mp3") return msg else: tts = gTTS(text='Olá, boa noite ' + msg + "." + script, lang='pt') tts.save("Mensagens Faladas\\boas-vindas.mp3") return msg
def run(self): time = QTime() hora = time.currentTime().toString() self.startTelaDeLog.emit(hora + " - Inicialização do Sistema") while True: hora = time.currentTime().toString() self.horarioEmTempoReal.emit(hora)
def updateClock(self): # What time is it ? cur = QTime.currentTime() self.from_time_updater = True self.ui.timeEdit.setTime(cur) self.from_time_updater = False
def showTime(self): # 更新时间的显示 time = QTime.currentTime() # 获取当前时间 time_text = time.toString(Qt.DefaultLocaleLongDate) # 获取HH:MM:SS格式的时间 # 冒号闪烁 if self.__ShowColon == True: self.__ShowColon = False else: time_text = time_text.replace(':', ' ') self.__ShowColon = True self.display(time_text) # 显示时间
def show_time(self): # 更新时间 time_now = QTime.currentTime() time_text = time_now.toString(Qt.DefaultLocaleLongDate) # 冒号闪烁 if self.__ShowColon: self.__ShowColon = False else: time_text = time_text.replace(':', ' ') self.__ShowColon = True self.display(time_text)
def in_timer(self, action_time, action_type): try: while True: now = QTime.currentTime().toString() if now == action_time: print(123) os.system(action_type) raise StopIteration break elif self.action_time_thread_kill is True: print("Stop") self.restore() break except StopIteration: self.restore()
def showTime(self): #更新时间的显示 time = QTime.currentTime() #获取当前时间 time_text = time.toString( Qt.DefaultLocaleLongDate ) #获取HH:MM:SS格式的时间,在中国获取后是这个格式,其他国家我不知道,如果有土豪愿意送我去外国旅行的话我就可以试一试 #冒号闪烁 if self.__ShowColon == True: self.__ShowColon = False else: time_text = time_text.replace(':', ' ') self.__ShowColon = True self.display(time_text) #显示时间
def setupUi(self, my_win): super().setupUi(my_win) self.sub_menu_inicio.aboutToShow.connect(self.volver_incio) self.sub_menu_registro.triggered.connect(self.mostrar_registrar_cancion) self.sub_meni_listado_canciones.triggered.connect(self.mostrar_listado_canciones) self.sub_menu_tabla_Canciones.triggered.connect(self.mostrar_tabla_canciones) self.sub_menu_registro_usuario.triggered.connect(self.registrar_usuario) #incluir fecha date = QDate.currentDate() date = str(date.toPyDate()) self.txt_fecha.setText(date) #incluir hora hora = QTime.currentTime() hora_txt = hora.toString("hh:mm") self.lcdNumber.display(hora_txt)
def update_clock(self): self.clock_label.setText(QTime.currentTime().toString(Qt.SystemLocaleShortDate))
def _update(self): while self.time_thread_kill is False: time_now = QTime.currentTime() self.timeEdit.setTime(time_now) time.sleep(1)
class CalibrarPERCLOS(QThread): #Capitura de Imagem changePixmap = pyqtSignal(QPixmap) #Contador para calcular o FPS contadorLoop = pyqtSignal(str) #Resumo da Calibragem PERCLOS valorMaxPERCLOS = pyqtSignal(str) valorMinPERCLOS = pyqtSignal(str) PThreshold = pyqtSignal(str) #Alimenta��o de dados dos Gr�ficos plotarCalibragem = pyqtSignal(pg.PlotItem) #Dados para a tela de log msgLog = pyqtSignal(str) def __init__(self, parent=None, nome="", framesCalibragem=100, threshold=70): QThread.__init__(self, parent=parent) self.framesCalibragem = framesCalibragem self.threshold = threshold self.usuario = nome self.arq_predicao = "IAs\\shape_predictor_68_face_landmarks.dat" self.detector = dlib.get_frontal_face_detector() self.predicao = dlib.shape_predictor(self.arq_predicao) self.judite = MensagemFalada() self.analisePERCLOS = AnalisePERCLOS() def __del__(self): self.wait() def run(self): #Habilitando a captura de v�deo cap = cv2.VideoCapture(0) self.hora = QTime() start_time = time.time() contFPS, fps, contImgCalibracao = 0, 0, 0 #Matriz da Raz�o de Aspecto self.matrizRA = np.zeros((5, self.framesCalibragem)) #Script inicial self.judite.scriptInicial() #contar self.judite.scriptContagem() b = True while b: _, frame = cap.read() frameRedimencionado = imutils.resize(frame, width=357, height=273) rgbImage = cv2.cvtColor(frameRedimencionado, cv2.COLOR_BGR2RGB) gray = cv2.cvtColor(frameRedimencionado, cv2.COLOR_BGR2GRAY) retangulos = self.detector(gray, 0) #Verificar se h� reconhecimento de pelo menos um rosto if len(retangulos) > 0: self.shape = self.verificarMaiorRetangulo(gray, retangulos) #Printa os landmark points do rosto for (x, y) in self.shape: cv2.circle(rgbImage, (x, y), 2, (0, 0, 255), -1) #Aquisi��o de dados para calibrar if (contImgCalibracao < self.framesCalibragem): if (contImgCalibracao == 0): self.msgLog.emit( self.hora.currentTime().toString() + " - Aquisição de dados para calibração") if (contImgCalibracao == (self.framesCalibragem // 2) - 1): self.judite.scriptRegulagemOlhosAbertos() #contar self.judite.scriptContagem() self.matrizRA[0][ contImgCalibracao] = self.analisePERCLOS.razaoDeAspecto( self.shape) self.matrizRA[1][ contImgCalibracao] = self.analisePERCLOS.desvioPadrao( contImgCalibracao, self.matrizRA) self.matrizRA[2][ contImgCalibracao] = self.analisePERCLOS.erroPadrao( contImgCalibracao, self.matrizRA) self.matrizRA = self.preencherDadosDeTeste( contImgCalibracao, self.matrizRA) #Calibragem e plotagem dos dados de calibragem no gr�fico elif (contImgCalibracao == self.framesCalibragem): self.judite.scriptFimCalibragem() eixoX_graficoDeCalibragem = np.arange( self.framesCalibragem) eixoX_graficoDeCalibragem = eixoX_graficoDeCalibragem.tolist( ) self.matrizRA = self.analisePERCLOS.calibragemAberturaOlhos( self.matrizRA) eixoY_graficoDeCalibragem = self.descreverDadosObtidosNoLog( self.matrizRA) # Gerar gráfico de análise grafico = pg.PlotWidget( title= "GRÁFICO AQUISIÇÃO DE DADOS INICIAL PARA CALIBRAGEM") grafico.setLabels(left="PERCLOS", bottom="Frames") grafico.setXRange(0, len(eixoX_graficoDeCalibragem) - 1, padding=0) grafico.getPlotItem().showGrid(True, True, 0.2) grafico.plot(eixoX_graficoDeCalibragem, eixoY_graficoDeCalibragem, pen=pg.mkPen('b')) self.plotarCalibragem.emit(grafico.getPlotItem()) self.preencherCampoDeTextoDeCalibragem() arquivoCalibracao = ArquivoCalibracao() arquivoCalibracao.gerarArquivoCalibracao( self.matrizRA[0], self.usuario) b = False contImgCalibracao += 1 height, width, channel = rgbImage.shape bytesPerLine = 3 * width convertToQtFormat = QImage(rgbImage.data, width, height, bytesPerLine, QImage.Format_RGB888) imagemDeExecucao = QPixmap.fromImage(convertToQtFormat) contFPS = contFPS + 1 tempoDoLoop = int(time.time() - start_time) if tempoDoLoop > 1 and tempoDoLoop < 3: fps = tempoDoLoop / contFPS contFPS = 0 start_time = time.time() self.changePixmap.emit(imagemDeExecucao) self.contadorLoop.emit(str(fps)) cap.release() def verificarMaiorRetangulo(self, imagemGray, retangulos): maiorRetangulo = 0 for retangulo in retangulos: shape = self.predicao(imagemGray, retangulo) shape = face_utils.shape_to_np(shape) #Calcular a distancia do rosto pertinente ao retangulo em an�lise distHorizontalRosto = distance.euclidean( (shape[0] + shape[1]) // 2, (shape[15] + shape[16]) // 2) distVerticalRosto = distance.euclidean( (shape[19] + shape[24]) // 2, (shape[7] + shape[8] + shape[9]) // 3) if ((distHorizontalRosto * distVerticalRosto) > maiorRetangulo): maiorRetangulo = distHorizontalRosto * distVerticalRosto shapeMaior = shape return shapeMaior def preencherDadosDeTeste(self, indiceFrameCalibragem, matrizRA): matrizRA[4][indiceFrameCalibragem] = 70 if (indiceFrameCalibragem < len(matrizRA[0])): matrizRA[3][indiceFrameCalibragem] = 0 else: matrizRA[3][indiceFrameCalibragem] = 1 return matrizRA def descreverDadosObtidosNoLog(self, matrizRA): dadosNoEixoY = [] for i in range(len(matrizRA[0])): if (i == 0): self.msgLog.emit( "Razão de Aspecto; Desvio Padrão; Erro Padrão") dadosNoEixoY.append(matrizRA[0][i]) msg = (str(round(matrizRA[0][i], 5)) + "; " + str(round(matrizRA[1][i], 5)) + "; " + str(round(matrizRA[2][i], 5)) + "; ") self.msgLog.emit(msg) self.msgLog.emit(self.hora.currentTime().toString() + " - Calibração Finalizada") return dadosNoEixoY def gerarArquivoDeDados(self, matrizRA): print(str(matrizRA)) arrayDados = self.matrizRA.tolist() print(str(arrayDados)) arquivo = GerarArquivoDeDados() arquivo.gerarCSV(arrayDados) def preencherCampoDeTextoDeCalibragem(self): self.valorMaxPERCLOS.emit(str(round(self.matrizRA[0].max(), 3))) self.valorMinPERCLOS.emit(str(round(self.matrizRA[0].min(), 3))) valorRAdoThreshold = ( (self.matrizRA[0].max() - self.matrizRA[0].min()) * (self.threshold / 100)) + self.matrizRA[0].min() self.PThreshold.emit(str(round(valorRAdoThreshold, 3)))
def tick(self): hora = QTime.currentTime() hora_txt = hora.toString("hh:mm") self.ui.lcd_hora.display(hora_txt)
def run(self): cap = cv2.VideoCapture(0) hora = QTime() start_time = time.time() cont = 0 fps = 0 contImgCalibracao = 0 self.matrizRA = np.zeros((5, 200)) p80_porcento = [] dados_tempo_real = [] eixox_dados_tempo_real = [] #Script inicial mixer.init() mixer.music.load("boas-vindas.mp3") mixer.music.play() time.sleep(18) mixer.music.load("auxilio-calibracao.mp3") mixer.music.play() time.sleep(6) mixer.music.load("auxilio-calibracao-olhos-fechados.mp3") mixer.music.play() time.sleep(10) #contar mixer.music.load("contar-um.mp3") mixer.music.play() time.sleep(1) mixer.music.load("contar-dois.mp3") mixer.music.play() time.sleep(1) mixer.music.load("contar-tres.mp3") mixer.music.play() time.sleep(1) camera = PiCamera() camera.resolution = (320, 240) camera.framerate = 30 rawCapture = PiRGBArray(camera, size=(320, 240)) for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True): frame = frame.array if frame is None: time.sleep(0.1) print('vazio') rgbImage = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) rects = self.detector(gray, 1) for rect in rects: self.shape = self.predicao(gray, rect) # Transforma os valores predicados do rosto para um array NumPy self.shape = face_utils.shape_to_np(self.shape) for (x, y) in self.shape: cv2.circle(rgbImage, (x, y), 4, (0, 0, 255), -1) if (contImgCalibracao < 200): if (contImgCalibracao == 99): mixer.music.load( "ok-auxilio-calibracao-olhos-abertos.mp3") mixer.music.play() time.sleep(12) mixer.music.load("contar-um.mp3") mixer.music.play() time.sleep(1) mixer.music.load("contar-dois.mp3") mixer.music.play() time.sleep(1) mixer.music.load("contar-tres.mp3") mixer.music.play() time.sleep(1) if (contImgCalibracao == 0): self.msgLog.emit( hora.currentTime().toString() + " - Aquisicao de dados para calibracao") self.matrizRA[0][contImgCalibracao] = self.razaoDeAspecto( self.shape) self.matrizRA[1][contImgCalibracao] = self.desvioPadrao( contImgCalibracao) self.matrizRA[2][contImgCalibracao] = self.erroPadrao( contImgCalibracao) self.matrizRA[4][contImgCalibracao] = 70 if (contImgCalibracao < 100): self.matrizRA[3][contImgCalibracao] = 0 else: self.matrizRA[3][contImgCalibracao] = 1 contImgCalibracao += 1 print("Estou coletando dados... ") elif (contImgCalibracao == 200): mixer.music.load("ok.mp3") mixer.music.play() x = np.arange(200) x = x.tolist() y = [] for i in range(len(self.matrizRA[0])): if (i == 0): self.msgLog.emit( "Razao de Aspecto; Desvio Padrao; Erro Padrao") y.append(self.matrizRA[0][i]) msg = (str(round(self.matrizRA[0][i], 5)) + "; " + str(round(self.matrizRA[1][i], 5)) + "; " + str(round(self.matrizRA[2][i], 5)) + "; ") self.msgLog.emit(msg) self.msgLog.emit(hora.currentTime().toString() + " - Calibracao") self.calibragemAberturaOlhos() self.matrizAnalitica = self.converterParaPorcentagem() contImgCalibracao += 1 grafico = pg.PlotWidget( title= "GRAFICO AQUISIÇAO DE DADOS INICIAL PARA CALIBRAGEM") grafico.setLabels(left="PERCLOS", bottom="Frames") grafico.getPlotItem().showGrid(True, True, 0.2) grafico.setXRange(0, 200, padding=0) #linhaPERCLOS = grafico.pl grafico.plot(x, y, pen=pg.mkPen('b')) self.plotarCalibragem.emit(grafico.getPlotItem()) self.valorMaxPERCLOS.emit( str(round(self.matrizRA[0].max(), 3))) self.valorMinPERCLOS.emit( str(round(self.matrizRA[0].min(), 3))) valorRAdoP80 = ( (self.matrizRA[0].max() - self.matrizRA[0].min()) * 0.8) + self.matrizRA[0].min() self.P80.emit(str(round(valorRAdoP80, 3))) arrayDados = self.matrizRA.tolist() print(arrayDados) arquivo = GerarArquivoDeDados() arquivo.gerarCSV(arrayDados) print("Estou calibrando os dados..." + str(contImgCalibracao)) else: if (contImgCalibracao == 201): self.msgLog.emit(hora.currentTime().toString() + " - Execucao do sistema") eixox_P80 = np.arange(200) eixox_P80 = eixox_P80.tolist() for i in range(200): p80_porcento.append(80) else: eixox_P80.append(len(eixox_P80) + 1) p80_porcento.append(80) dados_tempo_real.append( (self.razaoDeAspecto(self.shape) - self.matrizRA[0].min()) / (self.matrizRA[0].max() - self.matrizRA[0].min()) * 100) eixox_dados_tempo_real.append( len(eixox_dados_tempo_real) + 1) print( str((self.razaoDeAspecto(self.shape) - self.matrizRA[0].min()) / (self.matrizRA[0].max() - self.matrizRA[0].min()) * 100)) contImgCalibracao += 1 #self.calibracao.emit(self.matrizAnalitica) convertToQtFormat = QImage(rgbImage.data, rgbImage.shape[1], rgbImage.shape[0], QImage.Format_RGB888) convertToQtFormat = QPixmap.fromImage(convertToQtFormat) p = convertToQtFormat.scaled(357, 273, Qt.KeepAspectRatio) cont = cont + 1 if (contImgCalibracao > 201): #print("eixox_P80: " + type(eixox_P80)) #print("p80_porcento: " + type(p80_porcento)) #print("eixox_dados_tempo_real: " + type(eixox_dados_tempo_real)) #print("dados_tempo_real: " + type(dados_tempo_real)) grafico = pg.PlotWidget( title="GRAFICO EM TEMPO REAL - PERCLOS") grafico.setLabels(left="PERCLOS", bottom="Frames") grafico.getPlotItem().showGrid(True, True, 0.2) grafico.setXRange(0, 1000, padding=0) grafico.setYRange(0, 100, padding=0) #linhaPERCLOS = grafico.pl grafico.plot(eixox_P80, p80_porcento, pen=pg.mkPen('r', style=QtCore.Qt.DashLine)) grafico.plot(eixox_dados_tempo_real, dados_tempo_real, pen=pg.mkPen('b')) #print('percentual: ' + str(dados_tempo_real[len(dados_tempo_real)])) #return Declaraself.grafico.getPlotItem() self.plotar.emit(grafico.getPlotItem()) if (int(time.time() - start_time) == 1): print("Estou dentro do Time...") fps = cont cont = 0 start_time = time.time() rawCapture.truncate(0) #self.changePixmap.emit(p) self.contadorLoop.emit(str(fps))
#coding:utf-8
def setupUi(self, MainWindow): self.showFullScreen() self.setHidden(True) MainWindow.setObjectName("Segurança Veicular") MainWindow.setEnabled(True) MainWindow.resize(self.size()) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidgetLog = QtWidgets.QGroupBox(self.centralwidget) self.verticalLayoutWidgetLog.setTitle("Tela de Log") self.verticalLayoutWidgetLog.setGeometry( QtCore.QRect(920, 10, 435, 289)) self.verticalLayoutWidgetLog.setObjectName("verticalLayoutLog") self.verticalLayoutWidgetLog.setWindowTitle("LOG") self.verticalLayoutLog = QtWidgets.QVBoxLayout( self.verticalLayoutWidgetLog) self.verticalLayoutLog.setContentsMargins(2, 2, 2, 2) self.verticalLayoutLog.setObjectName("verticalLayoutLog") self.txtLog = QtWidgets.QPlainTextEdit(self.verticalLayoutWidgetLog) self.txtLog.setWindowTitle("Log") self.txtLog.setReadOnly(True) self.verticalLayoutLog.addWidget(self.txtLog) self.verticalLayoutWidgetCamera = QtWidgets.QGroupBox( self.centralwidget) self.verticalLayoutWidgetCamera.setTitle("Câmera") self.verticalLayoutWidgetCamera.setGeometry( QtCore.QRect(550, 10, 361, 289)) self.verticalLayoutWidgetCamera.setObjectName( "verticalLayoutWidgetCamera") self.verticalLayout = QtWidgets.QVBoxLayout( self.verticalLayoutWidgetCamera) self.verticalLayout.setContentsMargins(2, 2, 2, 2) self.verticalLayout.setObjectName("verticalLayout") self.label = QtWidgets.QLabel(self.verticalLayoutWidgetCamera) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.horizontalLayoutWidget = QtWidgets.QGroupBox(self.centralwidget) self.horizontalLayoutWidget.setGeometry( QtCore.QRect(10, 304, 1345, 241)) self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") self.horizontalLayout = QtWidgets.QHBoxLayout( self.horizontalLayoutWidget) self.horizontalLayout.setContentsMargins(2, 2, 2, 2) self.horizontalLayout.setObjectName("horizontalLayout") self.horizontalLayoutWidget.setLayout(self.horizontalLayout) pg.setConfigOption("background", "w") pg.setConfigOption("foreground", "k") self.graficoMicro = pg.PlotWidget( self.horizontalLayoutWidget, title="GRÁFICO EM REAL TIME - PERCLOS ANÁLISE") self.graficoMicro.setXRange(0, 1000, padding=0) self.graficoMicro.setYRange(0, 100, padding=0) self.graficoMicro.getPlotItem().showGrid(True, True, 0.2) self.horizontalLayout.addWidget(self.graficoMicro) self.horizontalLayoutWidget_2 = QtWidgets.QGroupBox(self.centralwidget) self.horizontalLayoutWidget_2.setGeometry( QtCore.QRect(10, 550, 1345, 150)) self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2") self.horizontalLayout_2 = QtWidgets.QHBoxLayout( self.horizontalLayoutWidget_2) self.horizontalLayout_2.setContentsMargins(2, 2, 2, 2) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.graficoMacro = pg.PlotWidget( self.horizontalLayoutWidget, title="GRÁFICO AQUISIÇÃO DE DADOS INICIAL PARA CALIBRAGEM") self.graficoMacro.setLabels(left="PERCLOS", bottom="Frames") self.graficoMacro.setXRange(0, 20, padding=0) self.graficoMacro.setYRange(0, 1, padding=0) self.graficoMacro.getPlotItem().showGrid(True, True, 0.2) self.horizontalLayout_2.addWidget(self.graficoMacro) self.horizontalLayoutWidget_3 = QtWidgets.QGroupBox(self.centralwidget) self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect( 10, 10, 531, 41)) self.horizontalLayoutWidget_3.setTitle("Estado do Sistema") self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3") self.layoutParteSuperior = QtWidgets.QHBoxLayout( self.horizontalLayoutWidget_3) self.layoutParteSuperior.setContentsMargins(2, 2, 2, 2) self.layoutParteSuperior.setObjectName("layoutParteSuperior") ##----------FPS----------## self.lbFPS = QtWidgets.QLabel(self.horizontalLayoutWidget_3) #self.lbFPS.setObjectName("lbFPS") self.lbFPS.setText("FPS") self.lcdFPS = QtWidgets.QLCDNumber(self.horizontalLayoutWidget_3) self.lcdFPS.setObjectName("lcdFPS") ##----------Marcador de Tempo----------## self.lbTempo = QtWidgets.QLabel(self.horizontalLayoutWidget_3) self.lbTempo.setText("Tempo") self.timeEdit = QtWidgets.QLineEdit(self.horizontalLayoutWidget_3) self.timeEdit.setObjectName("timeEdit") hora = QTime() self.timeEdit.setText(hora.currentTime().toString()) ##----------Marcador da Ultima Parada----------## self.lbProcessoCPU = QtWidgets.QLabel(self.horizontalLayoutWidget_3) #self.lbProcessoCPU.setObjectName("lbProcessoCPU") self.lbProcessoCPU.setText("CPU: ") self.txtProcessoCPU = QtWidgets.QLineEdit( self.horizontalLayoutWidget_3) self.txtProcessoCPU.setObjectName("txtProcessoCPU") ##---------- Botões de Execução ----------## self.btCalibrar = QtWidgets.QPushButton(self.horizontalLayoutWidget_3) self.btCalibrar.setObjectName("btCalibrar") self.btCalibrar.setText("Calibrar") self.btExecutar = QtWidgets.QPushButton(self.horizontalLayoutWidget_3) self.btExecutar.setObjectName("btExecutar") self.btExecutar.setText("Executar") #Layout da parte superior self.layoutParteSuperior.addWidget(self.lbFPS) self.layoutParteSuperior.addWidget(self.lcdFPS) self.layoutParteSuperior.addWidget(self.lbTempo) self.layoutParteSuperior.addWidget(self.timeEdit) self.layoutParteSuperior.addWidget(self.lbProcessoCPU) self.layoutParteSuperior.addWidget(self.txtProcessoCPU) self.layoutParteSuperior.addWidget(self.btCalibrar) self.layoutParteSuperior.addWidget(self.btExecutar) #---------- Layout de Análise PERCLOS ---------- self.layoutPERCLOS = QtWidgets.QGroupBox(self.centralwidget) self.layoutPERCLOS.setGeometry(QtCore.QRect(375, 55, 166, 93)) self.layoutPERCLOS.setObjectName("layoutPERCLOS") self.layoutPERCLOS.setTitle("Resumo de Calib. PERCLOS (RA)") self.formLayout = QtWidgets.QFormLayout(self.layoutPERCLOS) self.formLayout.setContentsMargins(2, 2, 2, 2) self.formLayout.setObjectName("formLayout") self.lbValorMaxPERCLOS = QtWidgets.QLabel(self.layoutPERCLOS) self.lbValorMaxPERCLOS.setObjectName("lbValorMaxPERCLOS") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.lbValorMaxPERCLOS) self.lbValorMinPERCLOS = QtWidgets.QLabel(self.layoutPERCLOS) self.lbValorMinPERCLOS.setObjectName("lbValorMinPERCLOS") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.lbValorMinPERCLOS) self.lbP80 = QtWidgets.QLabel(self.layoutPERCLOS) self.lbP80.setObjectName("lbP80") self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.lbP80) self.txtValorMaxPERCLOS = QtWidgets.QLineEdit(self.layoutPERCLOS) self.txtValorMaxPERCLOS.setObjectName("txtValorMaxPERCLOS") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.txtValorMaxPERCLOS) self.txtValorMinPERCLOS = QtWidgets.QLineEdit(self.layoutPERCLOS) self.txtValorMinPERCLOS.setObjectName("txtValorMinPERCLOS") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.txtValorMinPERCLOS) self.txtP80 = QtWidgets.QLineEdit(self.layoutPERCLOS) self.txtP80.setObjectName("txtP80") self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.txtP80) #---------- Layout de Análise Piscadas ---------- self.layoutPiscada = QtWidgets.QGroupBox(self.centralwidget) self.layoutPiscada.setGeometry(QtCore.QRect(10, 55, 351, 120)) #self.layoutPiscada.setFrameShape(QtWidgets.QFrame.StyledPanel) #self.layoutPiscada.setFrameShadow(QtWidgets.QFrame.Raised) self.layoutPiscada.setObjectName("layoutPiscada") self.layoutPiscada.setTitle("Análise Piscadas") self.gridLayoutPiscada = QtWidgets.QGridLayout(self.layoutPiscada) self.gridLayoutPiscada.setObjectName("gridLayoutPiscada") self.gridLayoutPiscada.setContentsMargins(2, 2, 2, 2) self.lbMinutosAntesPiscada = QtWidgets.QLabel(self.layoutPiscada) self.lbMinutosAntesPiscada.setObjectName("lbMinutosAntesPiscada") self.gridLayoutPiscada.addWidget(self.lbMinutosAntesPiscada, 0, 3, 1, 1, QtCore.Qt.AlignHCenter) self.txtMaximaPiscada = QtWidgets.QLineEdit(self.layoutPiscada) self.txtMaximaPiscada.setObjectName("txtMaximaPiscada") self.gridLayoutPiscada.addWidget(self.txtMaximaPiscada, 1, 1, 1, 1) self.lbMaximaPiscada = QtWidgets.QLabel(self.layoutPiscada) self.lbMaximaPiscada.setObjectName("lbMaximaPiscada") self.gridLayoutPiscada.addWidget(self.lbMaximaPiscada, 1, 0, 1, 1) self.lbMinimaPiscada = QtWidgets.QLabel(self.layoutPiscada) self.lbMinimaPiscada.setObjectName("lbMinimaPiscada") self.gridLayoutPiscada.addWidget(self.lbMinimaPiscada, 2, 0, 1, 1) self.txtMinimaPiscada = QtWidgets.QLineEdit(self.layoutPiscada) self.txtMinimaPiscada.setObjectName("txtMinimaPiscada") self.gridLayoutPiscada.addWidget(self.txtMinimaPiscada, 2, 1, 1, 1) self.lbReferenciaTempoPiscadaMax = QtWidgets.QLabel(self.layoutPiscada) self.lbReferenciaTempoPiscadaMax.setObjectName( "lbReferenciaTempoPiscadaMax") self.gridLayoutPiscada.addWidget(self.lbReferenciaTempoPiscadaMax, 1, 2, 1, 1) self.txtReferenciaTempoPiscadaMax = QtWidgets.QLineEdit( self.layoutPiscada) self.txtReferenciaTempoPiscadaMax.setObjectName( "txtReferenciaTempoPiscadaMax") self.gridLayoutPiscada.addWidget(self.txtReferenciaTempoPiscadaMax, 2, 3, 1, 1) self.txtReferenciaTempoPiscada_2 = QtWidgets.QLineEdit( self.layoutPiscada) self.txtReferenciaTempoPiscada_2.setObjectName( "txtReferenciaTempoPiscada_2") self.gridLayoutPiscada.addWidget(self.txtReferenciaTempoPiscada_2, 1, 3, 1, 1) self.lbPiscada = QtWidgets.QLabel(self.layoutPiscada) self.lbPiscada.setObjectName("lbPiscada") self.gridLayoutPiscada.addWidget(self.lbPiscada, 0, 0, 1, 1) self.lbPorMinutoPiscada = QtWidgets.QLabel(self.layoutPiscada) self.lbPorMinutoPiscada.setObjectName("lbPorMinutoPiscada") self.gridLayoutPiscada.addWidget(self.lbPorMinutoPiscada, 0, 1, 1, 1, QtCore.Qt.AlignHCenter) self.lbReferenciaTempoPiscadaMin = QtWidgets.QLabel(self.layoutPiscada) self.lbReferenciaTempoPiscadaMin.setObjectName( "lbReferenciaTempoPiscadaMin") self.gridLayoutPiscada.addWidget(self.lbReferenciaTempoPiscadaMin, 2, 2, 1, 1) self.lbMediana = QtWidgets.QLabel(self.layoutPiscada) self.lbMediana.setObjectName("lbMediana") self.gridLayoutPiscada.addWidget(self.lbMediana, 3, 0, 1, 1) self.txtMediana = QtWidgets.QLineEdit(self.layoutPiscada) self.txtMediana.setObjectName("txtMediana") self.gridLayoutPiscada.addWidget(self.txtMediana, 3, 1, 1, 1) #---------- Layout de Análise Bocejo ---------- self.layoutBocejo = QtWidgets.QGroupBox(self.centralwidget) self.layoutBocejo.setGeometry(QtCore.QRect(10, 179, 351, 120)) self.layoutBocejo.setObjectName("layoutBocejo") self.layoutBocejo.setTitle("Análise Bocejo") self.gridLayoutBocejo = QtWidgets.QGridLayout(self.layoutBocejo) self.gridLayoutBocejo.setObjectName("gridLayoutBocejo") self.lbMinAntesBocejo = QtWidgets.QLabel(self.layoutBocejo) self.lbMinAntesBocejo.setObjectName("lbMinAntesBocejo") self.gridLayoutBocejo.addWidget(self.lbMinAntesBocejo, 0, 3, 1, 1, QtCore.Qt.AlignHCenter) self.txtMaximaBocejo = QtWidgets.QLineEdit(self.layoutBocejo) self.txtMaximaBocejo.setObjectName("txtMaximaBocejo") self.gridLayoutBocejo.addWidget(self.txtMaximaBocejo, 1, 1, 1, 1) self.lbMaximaBocejo = QtWidgets.QLabel(self.layoutBocejo) self.lbMaximaBocejo.setObjectName("lbMaximaBocejo") self.gridLayoutBocejo.addWidget(self.lbMaximaBocejo, 1, 0, 1, 1) self.lbMinimaBocejo = QtWidgets.QLabel(self.layoutBocejo) self.lbMinimaBocejo.setObjectName("lbMinimaBocejo") self.gridLayoutBocejo.addWidget(self.lbMinimaBocejo, 2, 0, 1, 1) self.txtMinimoBocejo = QtWidgets.QLineEdit(self.layoutBocejo) self.txtMinimoBocejo.setObjectName("txtMinimoBocejo") self.gridLayoutBocejo.addWidget(self.txtMinimoBocejo, 2, 1, 1, 1) self.lbReferenciaTempoBocejoMax = QtWidgets.QLabel(self.layoutBocejo) self.lbReferenciaTempoBocejoMax.setObjectName( "lbReferenciaTempoBocejoMax") self.gridLayoutBocejo.addWidget(self.lbReferenciaTempoBocejoMax, 1, 2, 1, 1) self.txtReferenciaTempoBocejoMin = QtWidgets.QLineEdit( self.layoutBocejo) self.txtReferenciaTempoBocejoMin.setObjectName( "txtReferenciaTempoBocejoMin") self.gridLayoutBocejo.addWidget(self.txtReferenciaTempoBocejoMin, 2, 3, 1, 1) self.txtReferenciaTempoBocejoMax = QtWidgets.QLineEdit( self.layoutBocejo) self.txtReferenciaTempoBocejoMax.setObjectName( "txtReferenciaTempoBocejoMax") self.gridLayoutBocejo.addWidget(self.txtReferenciaTempoBocejoMax, 1, 3, 1, 1) self.lbBocejo = QtWidgets.QLabel(self.layoutBocejo) self.lbBocejo.setObjectName("lbBocejo") self.gridLayoutBocejo.addWidget(self.lbBocejo, 0, 0, 1, 1) self.lbPorMinutoBocejo = QtWidgets.QLabel(self.layoutBocejo) self.lbPorMinutoBocejo.setObjectName("lbPorMinutoBocejo") self.gridLayoutBocejo.addWidget(self.lbPorMinutoBocejo, 0, 1, 1, 1, QtCore.Qt.AlignHCenter) self.lbReferenciaTempoBocejoMin = QtWidgets.QLabel(self.layoutBocejo) self.lbReferenciaTempoBocejoMin.setObjectName( "lbReferenciaTempoBocejoMin") self.gridLayoutBocejo.addWidget(self.lbReferenciaTempoBocejoMin, 2, 2, 1, 1) self.lbMedianaBocejo = QtWidgets.QLabel(self.layoutBocejo) self.lbMedianaBocejo.setObjectName("lbMedianaBocejo") self.gridLayoutBocejo.addWidget(self.lbMedianaBocejo, 3, 0, 1, 1) self.txtMedianaBocejo = QtWidgets.QLineEdit(self.layoutBocejo) self.txtMedianaBocejo.setObjectName("txtMedianaBocejo") self.gridLayoutBocejo.addWidget(self.txtMedianaBocejo, 3, 1, 1, 1) #---------- Layout de Análise Estatisticas do PERCLOS ---------- self.layoutEstatisticaPERCLOS = QtWidgets.QGroupBox(self.centralwidget) self.layoutEstatisticaPERCLOS.setGeometry( QtCore.QRect(375, 152, 166, 147)) self.layoutEstatisticaPERCLOS.setObjectName("layoutEstatisticaPERCLOS") self.layoutEstatisticaPERCLOS.setTitle("Estatistica PERCLOS") self.gridLayoutPiscada_3 = QtWidgets.QGridLayout( self.layoutEstatisticaPERCLOS) self.gridLayoutPiscada_3.setContentsMargins(2, 2, 2, 2) self.gridLayoutPiscada_3.setObjectName("gridLayoutPiscada_3") self.lbBaixoPerclosMedia = QtWidgets.QLabel( self.layoutEstatisticaPERCLOS) self.lbBaixoPerclosMedia.setObjectName("lbBaixoPerclosMedia") self.gridLayoutPiscada_3.addWidget(self.lbBaixoPerclosMedia, 2, 0, 1, 1) self.txtBaixoPerclosMedia = QtWidgets.QLineEdit( self.layoutEstatisticaPERCLOS) self.txtBaixoPerclosMedia.setObjectName("txtBaixoPerclosMedia") self.gridLayoutPiscada_3.addWidget(self.txtBaixoPerclosMedia, 2, 1, 1, 1) self.txtAltoPerclos = QtWidgets.QLineEdit( self.layoutEstatisticaPERCLOS) self.txtAltoPerclos.setObjectName("txtAltoPerclos") self.gridLayoutPiscada_3.addWidget(self.txtAltoPerclos, 3, 1, 1, 1) self.txtBaixoPerclos = QtWidgets.QLineEdit( self.layoutEstatisticaPERCLOS) self.txtBaixoPerclos.setObjectName("txtBaixoPerclos") self.gridLayoutPiscada_3.addWidget(self.txtBaixoPerclos, 1, 1, 1, 1) self.lbAltoPerclos = QtWidgets.QLabel(self.layoutEstatisticaPERCLOS) self.lbAltoPerclos.setObjectName("lbAltoPerclos") self.gridLayoutPiscada_3.addWidget(self.lbAltoPerclos, 3, 0, 1, 1) self.lbPorMinutoResumoPerclos = QtWidgets.QLabel( self.layoutEstatisticaPERCLOS) self.lbPorMinutoResumoPerclos.setObjectName("lbPorMinutoResumoPerclos") self.gridLayoutPiscada_3.addWidget(self.lbPorMinutoResumoPerclos, 0, 1, 1, 1, QtCore.Qt.AlignHCenter) self.lbBaixoPerclos = QtWidgets.QLabel(self.layoutEstatisticaPERCLOS) self.lbBaixoPerclos.setObjectName("lbBaixoPerclos") self.gridLayoutPiscada_3.addWidget(self.lbBaixoPerclos, 1, 0, 1, 1) self.lbAltoPerclosMedia = QtWidgets.QLabel( self.layoutEstatisticaPERCLOS) self.lbAltoPerclosMedia.setObjectName("lbAltoPerclosMedia") self.gridLayoutPiscada_3.addWidget(self.lbAltoPerclosMedia, 4, 0, 1, 1) self.txtAltoPerclosMedia = QtWidgets.QLineEdit( self.layoutEstatisticaPERCLOS) self.txtAltoPerclosMedia.setObjectName("txtAltoPerclosMedia") self.gridLayoutPiscada_3.addWidget(self.txtAltoPerclosMedia, 4, 1, 1, 1) thCPU = DesempenhoProcessador(self) thCPU.desempenhoCPU.connect(self.txtProcessoCPU.setText) thCPU.start() thHora = Horario(self) thHora.horarioEmTempoReal.connect(self.timeEdit.setText) thHora.startTelaDeLog.connect(self.txtLog.setPlainText) thHora.start() self.btCalibrar.clicked.connect(self.executarCalibracao) self.btExecutar.clicked.connect(self.executarExecucao) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)