Commit 28d55da4 authored by Alisson Claudino's avatar Alisson Claudino
Browse files

Padronização das interfaces e gráficos genéricos com n eixos

parent b4282bcb
This diff is collapsed.
......@@ -2,19 +2,17 @@
# Form implementation generated from reading ui file 'Resources/CalibracaoT.ui'
#
# Created: Fri Nov 24 19:35:13 2017
# Created: Wed Nov 29 17:01:02 2017
# by: PyQt5 UI code generator 5.2.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from datetime import datetime
import time
from InterfaceTimer import InterfaceTimer
class Ui_MainWindow(InterfaceTimer):
def setupUi(self, MainWindow):
self.MainWindow=MainWindow
self.MainWindow = MainWindow
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1366, 695)
MainWindow.setMinimumSize(QtCore.QSize(817, 0))
......@@ -30,12 +28,7 @@ class Ui_MainWindow(InterfaceTimer):
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.CentralGraph.sizePolicy().hasHeightForWidth())
self.CentralGraph.setSizePolicy(sizePolicy)
self.CentralGraph.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.CentralGraph.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.CentralGraph.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
self.CentralGraph.setAlignment(QtCore.Qt.AlignJustify)
self.CentralGraph.setObjectName("CentralGraph")
self.scaleBox = QtWidgets.QGroupBox(self.centralWidget)
self.scaleBox.setGeometry(QtCore.QRect(10, 10, 401, 231))
self.scaleBox.setToolTip("")
......@@ -154,13 +147,8 @@ class Ui_MainWindow(InterfaceTimer):
self.cronometroBox.setStyleSheet("background-color: rgb(86, 86, 86);\n"
"border:1px solid rgb(123, 0, 129);")
self.cronometroBox.setObjectName("cronometroBox")
self.startTimerButton = QtWidgets.QPushButton(self.cronometroBox)
self.startTimerButton.setGeometry(QtCore.QRect(170, 30, 51, 31))
self.startTimerButton.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"border: 1px solid rgb(44, 0, 47);")
self.startTimerButton.setObjectName("startTimerButton")
self.timerGBox = QtWidgets.QGroupBox(self.cronometroBox)
self.timerGBox.setGeometry(QtCore.QRect(10, 30, 141, 71))
self.timerGBox.setGeometry(QtCore.QRect(10, 30, 211, 71))
self.timerGBox.setStyleSheet("background-color:rgb(53, 53, 53)")
self.timerGBox.setObjectName("timerGBox")
self.timerLabel = QtWidgets.QLabel(self.timerGBox)
......@@ -170,8 +158,28 @@ class Ui_MainWindow(InterfaceTimer):
"border: 1px solid rgb(44, 0, 47);\n"
"font: 75 12pt \"Noto Serif\";")
self.timerLabel.setObjectName("timerLabel")
self.startTimerButton = QtWidgets.QPushButton(self.timerGBox)
self.startTimerButton.setGeometry(QtCore.QRect(130, 10, 51, 21))
self.startTimerButton.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"border: 1px solid rgb(44, 0, 47);")
self.startTimerButton.setObjectName("startTimerButton")
self.stopTimerButton = QtWidgets.QPushButton(self.timerGBox)
self.stopTimerButton.setGeometry(QtCore.QRect(130, 40, 51, 21))
self.stopTimerButton.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"border: 1px solid rgb(44, 0, 47);")
self.stopTimerButton.setObjectName("stopTimerButton")
self.startTimeGBox = QtWidgets.QGroupBox(self.cronometroBox)
self.startTimeGBox.setGeometry(QtCore.QRect(240, 30, 151, 71))
self.startTimeGBox.setStyleSheet("background-color:rgb(53, 53, 53)")
self.startTimeGBox.setObjectName("startTimeGBox")
self.startTimeLabel = QtWidgets.QLabel(self.startTimeGBox)
self.startTimeLabel.setGeometry(QtCore.QRect(30, 30, 91, 31))
self.startTimeLabel.setStyleSheet("background-color:rgb(80, 80,80);\n"
"color:rgb(255,255,255);\n"
"font: 14pt \"Noto Serif\";")
self.startTimeLabel.setObjectName("startTimeLabel")
self.currentTimeGBox = QtWidgets.QGroupBox(self.cronometroBox)
self.currentTimeGBox.setGeometry(QtCore.QRect(240, 30, 151, 71))
self.currentTimeGBox.setGeometry(QtCore.QRect(240, 120, 151, 71))
self.currentTimeGBox.setStyleSheet("background-color:rgb(53, 53, 53)")
self.currentTimeGBox.setObjectName("currentTimeGBox")
self.currentTimeLabel = QtWidgets.QLabel(self.currentTimeGBox)
......@@ -180,39 +188,24 @@ class Ui_MainWindow(InterfaceTimer):
"color:rgb(255,255,255);\n"
"font: 14pt \"Noto Serif\";")
self.currentTimeLabel.setObjectName("currentTimeLabel")
self.horaAtualGBox = QtWidgets.QGroupBox(self.cronometroBox)
self.horaAtualGBox.setGeometry(QtCore.QRect(240, 120, 151, 71))
self.horaAtualGBox.setStyleSheet("background-color:rgb(53, 53, 53)")
self.horaAtualGBox.setObjectName("horaAtualGBox")
self.horaAtualLabel = QtWidgets.QLabel(self.horaAtualGBox)
self.horaAtualLabel.setGeometry(QtCore.QRect(30, 30, 91, 31))
self.horaAtualLabel.setStyleSheet("background-color:rgb(80, 80,80);\n"
"color:rgb(255,255,255);\n"
"font: 14pt \"Noto Serif\";")
self.horaAtualLabel.setObjectName("horaAtualLabel")
self.stopTimerButton = QtWidgets.QPushButton(self.cronometroBox)
self.stopTimerButton.setGeometry(QtCore.QRect(170, 70, 51, 31))
self.stopTimerButton.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"border: 1px solid rgb(44, 0, 47);")
self.stopTimerButton.setObjectName("stopTimerButton")
self.regTimerGBox = QtWidgets.QGroupBox(self.cronometroBox)
self.regTimerGBox.setGeometry(QtCore.QRect(10, 120, 141, 71))
self.regTimerGBox.setGeometry(QtCore.QRect(10, 120, 211, 71))
self.regTimerGBox.setStyleSheet("background-color:rgb(53, 53, 53)")
self.regTimerGBox.setObjectName("regTimerGBox")
self.regTimerLabel = QtWidgets.QLabel(self.regTimerGBox)
self.regTimerLabel = QtWidgets.QLineEdit(self.regTimerGBox)
self.regTimerLabel.setGeometry(QtCore.QRect(20, 30, 81, 31))
self.regTimerLabel.setStyleSheet("background-color: rgb(80,80,80);\n"
"border: 1px solid rgb(255,255,255);\n"
"color:rgb(255,255,255);\n"
"font: 75 12pt \"Noto Serif\";")
self.regTimerLabel.setObjectName("regTimerLabel")
self.startRegTimerButton = QtWidgets.QPushButton(self.cronometroBox)
self.startRegTimerButton.setGeometry(QtCore.QRect(170, 120, 51, 31))
self.startRegTimerButton = QtWidgets.QPushButton(self.regTimerGBox)
self.startRegTimerButton.setGeometry(QtCore.QRect(130, 10, 51, 21))
self.startRegTimerButton.setStyleSheet("border: 1px solid rgb(255,255,255);\n"
"background-color:rgb(53, 53, 53)")
self.startRegTimerButton.setObjectName("startRegTimerButton")
self.stopRegTimerButton = QtWidgets.QPushButton(self.cronometroBox)
self.stopRegTimerButton.setGeometry(QtCore.QRect(170, 160, 51, 31))
self.stopRegTimerButton.setGeometry(QtCore.QRect(140, 160, 51, 21))
self.stopRegTimerButton.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"border: 1px solid rgb(255,255,255);")
self.stopRegTimerButton.setObjectName("stopRegTimerButton")
......@@ -288,18 +281,18 @@ class Ui_MainWindow(InterfaceTimer):
self.menuBar = QtWidgets.QMenuBar(MainWindow)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 1366, 23))
self.menuBar.setObjectName("menuBar")
self.menuArquivo = QtWidgets.QMenu(self.menuBar)
self.menuArquivo.setObjectName("menuArquivo")
self.menuEtapa = QtWidgets.QMenu(self.menuBar)
self.menuEtapa.setObjectName("menuEtapa")
self.menuPorta = QtWidgets.QMenu(self.menuBar)
self.menuPorta.setObjectName("menuPorta")
self.menuPlay_Pause = QtWidgets.QMenu(self.menuBar)
self.menuPlay_Pause.setObjectName("menuPlay_Pause")
self.menuTermopar = QtWidgets.QMenu(self.menuBar)
self.menuTermopar.setObjectName("menuTermopar")
self.menuFinalizar = QtWidgets.QMenu(self.menuBar)
self.menuFinalizar.setObjectName("menuFinalizar")
self.fileMenu = QtWidgets.QMenu(self.menuBar)
self.fileMenu.setObjectName("fileMenu")
self.stageMenu = QtWidgets.QMenu(self.menuBar)
self.stageMenu.setObjectName("stageMenu")
self.serialMenu = QtWidgets.QMenu(self.menuBar)
self.serialMenu.setObjectName("serialMenu")
self.playPauseButton = QtWidgets.QMenu(self.menuBar)
self.playPauseButton.setObjectName("playPauseButton")
self.ThermocoupleMenu = QtWidgets.QMenu(self.menuBar)
self.ThermocoupleMenu.setObjectName("ThermocoupleMenu")
self.finalizeButton = QtWidgets.QMenu(self.menuBar)
self.finalizeButton.setObjectName("finalizeButton")
MainWindow.setMenuBar(self.menuBar)
self.alternaCalibraP = QtWidgets.QAction(MainWindow)
self.alternaCalibraP.setObjectName("alternaCalibraP")
......@@ -307,78 +300,39 @@ class Ui_MainWindow(InterfaceTimer):
self.alternaCalibraT.setObjectName("alternaCalibraT")
self.alternaProc = QtWidgets.QAction(MainWindow)
self.alternaProc.setObjectName("alternaProc")
self.botaoAbrir = QtWidgets.QAction(MainWindow)
self.botaoAbrir.setEnabled(False)
self.botaoAbrir.setIconVisibleInMenu(True)
self.botaoAbrir.setObjectName("botaoAbrir")
self.openButton = QtWidgets.QAction(MainWindow)
self.openButton.setEnabled(False)
self.openButton.setIconVisibleInMenu(True)
self.openButton.setObjectName("openButton")
self.actionSalvar = QtWidgets.QAction(MainWindow)
self.actionSalvar.setObjectName("actionSalvar")
self.actionSalvar_Como = QtWidgets.QAction(MainWindow)
self.actionSalvar_Como.setObjectName("actionSalvar_Como")
self.botaoSalvar = QtWidgets.QAction(MainWindow)
self.botaoSalvar.setObjectName("botaoSalvar")
self.botaoSalvarComo = QtWidgets.QAction(MainWindow)
self.botaoSalvarComo.setObjectName("botaoSalvarComo")
self.saveButton = QtWidgets.QAction(MainWindow)
self.saveButton.setObjectName("saveButton")
self.saveAsButton = QtWidgets.QAction(MainWindow)
self.saveAsButton.setObjectName("saveAsButton")
self.selectPortaUSB = QtWidgets.QAction(MainWindow)
self.selectPortaUSB.setObjectName("selectPortaUSB")
self.menuArquivo.addAction(self.botaoAbrir)
self.menuArquivo.addAction(self.botaoSalvar)
self.menuArquivo.addAction(self.botaoSalvarComo)
self.menuEtapa.addAction(self.alternaCalibraP)
self.menuEtapa.addAction(self.alternaCalibraT)
self.menuEtapa.addAction(self.alternaProc)
self.menuBar.addAction(self.menuArquivo.menuAction())
self.menuBar.addAction(self.menuEtapa.menuAction())
self.menuBar.addAction(self.menuPorta.menuAction())
self.menuBar.addAction(self.menuTermopar.menuAction())
self.menuBar.addAction(self.menuFinalizar.menuAction())
self.fileMenu.addAction(self.openButton)
self.fileMenu.addAction(self.saveButton)
self.fileMenu.addAction(self.saveAsButton)
self.stageMenu.addAction(self.alternaCalibraP)
self.stageMenu.addAction(self.alternaCalibraT)
self.stageMenu.addAction(self.alternaProc)
self.menuBar.addAction(self.fileMenu.menuAction())
self.menuBar.addAction(self.stageMenu.menuAction())
self.menuBar.addAction(self.serialMenu.menuAction())
self.menuBar.addAction(self.ThermocoupleMenu.menuAction())
self.menuBar.addAction(self.playPauseButton.menuAction())
self.menuBar.addAction(self.finalizeButton.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.pauseTimerButton = self.startRegTimerButton
self.menuPlay_Pause = QtWidgets.QAction(MainWindow)
self.menuPlay_Pause.setText("Play")
self.menuPlay_Pause.setObjectName("menuPlay_Pause")
self.menuBar.addAction(self.menuPlay_Pause)
self.menuPlay_Pause.setCheckable(True)
self.menuPlay_Pause.toggled.connect(self.playPauseButtonAnimation)
self.linkActions()
self.retranslateUi(MainWindow)
def sceneSelector(self, scene):
self.CentralGraph.setScene(scene)
self.CentralGraph.setBackgroundBrush(QtCore.Qt.black)
self.CentralGraph.setInteractive(False)
def serialListPanel(self, seriaList):
self.usb = []
for i in range(0, len(seriaList)):
self.usb.append(QtWidgets.QAction(self.MainWindow))
self.usb[i].setText(seriaList[i].device)
self.usb[i].setCheckable(True)
self.menuPorta.addAction(self.usb[i])
def playPauseButtonAnimation(self):
if (self.menuPlay_Pause.text() == "Play"):
self.menuPlay_Pause.setText("Pause")
self.startTimeLabel.setText(self.currentTimeLabel.text)
else:
self.menuPlay_Pause.setText("Play")
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "SADAMAP - Análise de Dados: Etapa 2 - Calibração de Temperatura"))
MainWindow.setWindowTitle(_translate("MainWindow", "SADAMAP - Análise de Dados: Etapa 1 - Calibração de Pressão"))
self.scaleBox.setTitle(_translate("MainWindow", "Escalas de Visualização (Range)"))
self.tempBox.setTitle(_translate("MainWindow", "Temperatura (ºC)"))
self.temp_max.setText(_translate("MainWindow", "1000"))
......@@ -409,16 +363,16 @@ class Ui_MainWindow(InterfaceTimer):
self.samplingCBox.setItemText(7, _translate("MainWindow", "5 seg"))
self.samplingCBox.setItemText(8, _translate("MainWindow", "10 seg"))
self.cronometroBox.setTitle(_translate("MainWindow", "Timer"))
self.startTimerButton.setText(_translate("MainWindow", "Iniciar"))
self.timerGBox.setTitle(_translate("MainWindow", "Cronômetro"))
self.timerLabel.setText(_translate("MainWindow", "10.2674 s"))
self.currentTimeGBox.setTitle(_translate("MainWindow", "Horário de Início"))
self.currentTimeLabel.setText(_translate("MainWindow", "16:30:15"))
self.horaAtualGBox.setTitle(_translate("MainWindow", "Horário Atual"))
self.horaAtualLabel.setText(_translate("MainWindow", "17:05:56"))
self.timerLabel.setText(_translate("MainWindow", "0.00 s"))
self.startTimerButton.setText(_translate("MainWindow", "Iniciar"))
self.stopTimerButton.setText(_translate("MainWindow", "Parar"))
self.startTimeGBox.setTitle(_translate("MainWindow", "Horário de Início"))
self.startTimeLabel.setText(_translate("MainWindow", "16:30:15"))
self.currentTimeGBox.setTitle(_translate("MainWindow", "Horário Atual"))
self.currentTimeLabel.setText(_translate("MainWindow", "17:05:56"))
self.regTimerGBox.setTitle(_translate("MainWindow", "Cont. Regressivo"))
self.regTimerLabel.setText(_translate("MainWindow", "10.2674 s"))
self.regTimerLabel.setText(_translate("MainWindow", "0.00 s"))
self.startRegTimerButton.setText(_translate("MainWindow", "Iniciar"))
self.stopRegTimerButton.setText(_translate("MainWindow", "Parar"))
self.prensaNameGBox.setTitle(_translate("MainWindow", "Prensa"))
......@@ -434,19 +388,19 @@ class Ui_MainWindow(InterfaceTimer):
self.powLabel.setText(_translate("MainWindow", "23.567 kW"))
self.forceGBox.setTitle(_translate("MainWindow", "Força"))
self.forceLabel.setText(_translate("MainWindow", "340.34 kN"))
self.menuArquivo.setTitle(_translate("MainWindow", "Arquivo"))
self.menuEtapa.setTitle(_translate("MainWindow", "Etapa"))
self.menuPorta.setTitle(_translate("MainWindow", "Porta"))
# self.menuPlay_Pause.setTitle(_translate("MainWindow", "Iniciar/Pausar"))
self.menuTermopar.setTitle(_translate("MainWindow", "Termopar"))
self.menuFinalizar.setTitle(_translate("MainWindow", "Finalizar"))
self.fileMenu.setTitle(_translate("MainWindow", "Arquivo"))
self.stageMenu.setTitle(_translate("MainWindow", "Etapa"))
self.serialMenu.setTitle(_translate("MainWindow", "Porta"))
self.playPauseButton.setTitle(_translate("MainWindow", "Iniciar/Pausar"))
self.ThermocoupleMenu.setTitle(_translate("MainWindow", "Termopar"))
self.finalizeButton.setTitle(_translate("MainWindow", "Finalizar"))
self.alternaCalibraP.setText(_translate("MainWindow", "Calibração P"))
self.alternaCalibraT.setText(_translate("MainWindow", "Calibração T"))
self.alternaProc.setText(_translate("MainWindow", "Processamento"))
self.botaoAbrir.setText(_translate("MainWindow", "Abrir"))
self.openButton.setText(_translate("MainWindow", "Abrir"))
self.actionSalvar.setText(_translate("MainWindow", "Salvar"))
self.actionSalvar_Como.setText(_translate("MainWindow", "Salvar Como"))
self.botaoSalvar.setText(_translate("MainWindow", "Salvar"))
self.botaoSalvarComo.setText(_translate("MainWindow", "Salvar Como"))
self.saveButton.setText(_translate("MainWindow", "Salvar"))
self.saveAsButton.setText(_translate("MainWindow", "Salvar Como"))
self.selectPortaUSB.setText(_translate("MainWindow", "Selecionar porta USB"))
......@@ -5,60 +5,72 @@ import time
class Graph(PlotItem):
index = 0
def __init__(self,x_sampling, x_range, y1_min, y1_max, y2_min, y2_max, x_size, y_size, color1, color2, name1, name2):
def __init__(self,x_sampling, x_range, n_axis, y_min, y_max, x_size, y_size, color, name,unit):
super(Graph, self).__init__()
self.x_sampling=1
self.x_range = x_range/x_sampling
self.y1_min = y1_min
self.y1_max = y1_max
self.y2_min = y2_min
self.y2_max = y2_max
self.x_size = x_size
self.y_size = y_size
self.color1 = color1
self.color2 = color2
self.name1 = name1
self.name2 = name2
self.curve1 = self.plot(pen=color1, name=self.name1)
self.curve2 = self.plot(pen=color2, name=self.name2)
self.curve = []
self.axis = []
self.y=[]
self.curve.append(self.plot(pen=color[0], name=name[0]))
self.axis.append(AxisItem("left",color[0]))
self.axis[0].setLabel(name[0], unit[0])
self.axis[0].setRange(y_min[0], y_max[0])
y_axis = [0]
self.y.append(y_axis)
try:
for n in range(1,n_axis):
self.curve.append(self.plot(pen=color[n], name=name[n]))
self.axis.append(AxisItem("right",color[n]))
self.axis[n].setLabel(name[n],unit[n])
self.axis[n].setRange(y_min[n],y_max[n])
self.y.append(y_axis)
print(y_axis)
except Exception as e:
print(e)
self.axisTime = AxisItem("bottom", 'w')
self.axis2 = AxisItem("right", color2)
self.axis1 = AxisItem("left", color1)
self.axis1.setLabel(self.name1,'Tonf')
self.axis2.setLabel(self.name2,'mV')
self.axisTime.setLabel("Tempo", 's')
self.axisTime.setRange(0, x_range)
self.x=[]
self.x.append(0)
self.showAxis("left", False)
self.showAxis("bottom", False)
self.axisTime.setRange(0,x_range)
self.axis1.setRange(y1_min,y1_max)
self.axis2.setRange(y2_min,y2_max)
self.showAxis("left",False)
self.showAxis("bottom",False)
self.setMinimumSize(x_size,y_size)
self.setMinimumSize(x_size, y_size)
self.setXRange(0, self.x_range, padding=0)
self.setYRange(min(self.y1_min,self.y2_min), max(self.y1_max,self.y2_max), padding=0)
self.x1 = []
self.y1 = []
self.y2 = []
self.timeant = time.time()
self.setYRange(min(y_min), max(y_max), padding=0)
self.timeant = time.time()
def updateGraph(self, y1, y2):
def updateGraph(self, y):
# print(time.time()-self.timeant)
self.y1.append(y1)
self.y2.append(y2)
if len(self.y1) > self.x_range + 1:
self.y1.pop(0)
self.y2.pop(0)
for n in range(0,len(y)):
print(y[n])
print(self.y[n])
self.y[n].append(y[n])
if len(self.y[0]) > self.x_range+1 :
for n in range(0,len(y)):
self.y[n].pop(0)
self.index = self.x_range
else:
self.x1.append(self.index)
self.x.append(self.index)
self.index = self.index + 1
self.curve1.setData(self.x1, self.y1)
self.curve2.setData(self.x1, self.y2)
#self.timeant = time.time()
for n in range(0,len(y)):
self.curve[0].setData(self.x, self.y[0])
self.timeant = time.time()
from datetime import datetime
from PyQt5 import QtWidgets,QtCore
from PyQt5 import QtWidgets,QtCore,QtGui
class InterfaceTimer(object):
def __init__(self):
self.startTimerButton = QtWidgets.QPushButton()
self.pauseTimerButton = QtWidgets.QPushButton()
self.stopTimerButton = QtWidgets.QPushButton()
self.startRegTimerButton = QtWidgets.QPushButton()
self.stopRegTimerButton = QtWidgets.QPushButton()
self.regTimerLabel=QtWidgets.QLabel()
self.screenTimerLabel = QtWidgets.QLabel()
self.timerLabel = QtWidgets.QLabel()
self.currentTimeLabel = QtWidgets.QLabel()
self.currentTimer = QtCore.QTimer()
self.regTimer=QtCore.QTimer()
self.MainWindow=QtWidgets.QDialog()
self.regTimerLabel.setText("0 s")
self.regTimerLabel.setText("0.0 s")
self.timerLabel.setText("0.0 s")
self.timeValue=0
self.regTimerValue=0
self.regTimerValue=1000
def linkActions(self):
self.startTimerButton.pressed.connect(self.startScreenTimer)
self.pauseTimerButton.pressed.connect(self.playPauseScreenTimer)
self.stopTimerButton.pressed.connect(self.stopScreenTimer)
self.currentTimer.timeout.connect(self.updateCurrentTime)
self.startRegTimerButton.pressed.connect(self.startRegressiveTimer)
self.stopRegTimerButton.pressed.connect(self.startRegressiveTimer)
self.stopRegTimerButton.pressed.connect(self.stopRegressiveTimer)
self.currentTimer.start(500)
self.screenTimerFlag = False
def startRegressiveTimer(self):
try:
if(self.regTimerLabel.text().split(" ",3)[1]=="s"):
self.regTimerValue=self.regTimerLabel.text().split(" ",3)[0]
else:
self.regTimerValue=self.regTimerLabel.text()
print(self.regTimerValue)
self.regTimerValue=float(self.regTimerValue)
except(IndexError):
self.regTimerValue=self.regTimerLabel.text()
self.regTimerValue.split(" ", 3)
self.regTimerValue=float(self.regTimerValue[0])
except(ValueError):
print(self.regTimerLabel.text)
except(ValueError,TypeError):
error=QtWidgets.QMessageBox(self.MainWindow)
error.setText("Valor Inválido! Definindo valor padrão de 1000 segundos")
error.setWindowTitle("ERRO!")
error.exec()
self.regTimerValue = 1000
print(self.regTimerValue)
self.regTimerValue = float(self.regTimerValue)
self.regTimer=QtCore.QTimer()
self.regTimer.timeout.connect(self.updateRegTimer)
......@@ -55,53 +71,39 @@ class InterfaceTimer(object):
self.regTimer.stop()
self.startRegTimerButton.setText("Iniciar")
self.startRegTimerButton.pressed.disconnect()
self.startRegTimerButton.pressed.connect(startRegressiveTimer)
self.startRegTimerButton.pressed.connect(self.startRegressiveTimer)
self.regTimerLabel.setText("0.00 s")
def updateRegTimer(self):
while(self.regTimerValue!=0):
if(self.regTimerValue>=0.1):
self.regTimerValue -= 0.1
self.regTimerLabel.setText("%.1f seg"%self.regTimerValue)
self.regTimerLabel.setText("%.1f s"%self.regTimerValue)
def startScreenTimer(self):
self.timeValue = 0
self.screenTimer = QtCore.QTimer()
self.screenTimer.timeout.connect(self.updateScreenTimer)
self.screenTimer.start(100)
self.startTimerButton.setText("Reiniciar")
self.pauseTimerButton.setText("Pausar")
self.screenTimerFlag = True
def playPauseScreenTimer(self):
self.startTimerButton.setText("Reiniciar")
if (self.pauseTimerButton == "Iniciar"):
self.startScreenTimer()
if (self.screenTimerFlag == True):
self.screenTimer.stop()
self.screenTimerFlag = False
self.pauseTimerButton.setText("Continuar")
else:
try:
self.screenTimer.start(100)
self.screenTimerFlag = True
self.pauseTimerButton.setText("Pausar")
except:
self.startScreenTimer()
self.startTimerButton.pressed.disconnect()
self.startTimerButton.pressed.connect(self.pauseScreenTimer)
self.startTimerButton.setText("Pausar")
def pauseScreenTimer(self):
self.screenTimer.stop()
self.startTimerButton.setText("Continuar")
self.startTimerButton.pressed.disconnect()
self.startTimerButton.pressed.connect(self.startScreenTimer)
def stopScreenTimer(self):
self.screenTimer.stop()
self.screenTimerLabel.setText("0.00 seg")
self.timerLabel.setText("0.00 s")
self.timeValue = 0
self.screenTimerFlag = False
self.startTimerButton.setText("Iniciar")
self.pauseTimerButton.setText("Iniciar")
def updateScreenTimer(self):
self.timeValue += 0.1
self.screenTimerLabel.setText("%.1f seg" % self.timeValue)
self.timerLabel.setText("%.1f s" % self.timeValue)
def updateCurrentTime(self):
self.currentTime = (str(datetime.now().time()))
......
......@@ -30,10 +30,10 @@ color: rgb(255,255,255);</string>
<widget class="QGraphicsView" name="CentralGraph">
<property name="geometry">
<rect>
<x>420</x>
<x>430</x>
<y>10</y>
<width>931</width>
<height>621</height>
<width>921</width>
<height>611</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -60,8 +60,8 @@ color: rgb(255,255,255);</string>
<rect>
<x>20</x>
<y>10</y>
<width>391</width>
<height>231</height>
<width>401</width>
<height>221</height>