From 28d55da493bb19f167cd02b4be01e28dcebd775e Mon Sep 17 00:00:00 2001 From: Alisson Claudino Date: Wed, 29 Nov 2017 21:59:05 -0200 Subject: [PATCH] =?UTF-8?q?Padroniza=C3=A7=C3=A3o=20das=20interfaces=20e?= =?UTF-8?q?=20gr=C3=A1ficos=20gen=C3=A9ricos=20com=20n=20eixos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Interface/CalibracaoP.py | 332 +++++++++++----------- Interface/CalibracaoT.py | 202 +++++-------- Interface/Graph.py | 90 +++--- Interface/InterfaceTimer.py | 82 +++--- Interface/Resources/CalibracaoP.ui | 440 +++++++++++++++++------------ Interface/Resources/CalibracaoT.ui | 176 ++++++------ Interface/SerialManager.py | 11 +- Interface/SystemEngine.py | 75 +++-- 8 files changed, 730 insertions(+), 678 deletions(-) diff --git a/Interface/CalibracaoP.py b/Interface/CalibracaoP.py index 0bba657..fcdf798 100644 --- a/Interface/CalibracaoP.py +++ b/Interface/CalibracaoP.py @@ -2,31 +2,27 @@ # Form implementation generated from reading ui file 'Resources/CalibracaoP.ui' # -# Created: Thu Nov 23 09:19:47 2017 +# Created: Wed Nov 29 18:20:09 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 from InterfaceTimer import InterfaceTimer -import time - 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)) MainWindow.setStyleSheet("background-color:rgb(53, 53, 53);\n" - "color: rgb(255,255,255);") +"color: rgb(255,255,255);") self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setAutoFillBackground(False) self.centralWidget.setObjectName("centralWidget") self.CentralGraph = QtWidgets.QGraphicsView(self.centralWidget) - self.CentralGraph.setGeometry(QtCore.QRect(420, 10, 931, 621)) + self.CentralGraph.setGeometry(QtCore.QRect(430, 10, 921, 611)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) @@ -35,14 +31,17 @@ class Ui_MainWindow(InterfaceTimer): 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.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignJustify) self.CentralGraph.setObjectName("CentralGraph") self.scaleBox = QtWidgets.QGroupBox(self.centralWidget) - self.scaleBox.setGeometry(QtCore.QRect(20, 10, 391, 231)) + self.scaleBox.setGeometry(QtCore.QRect(20, 10, 401, 221)) + self.scaleBox.setToolTip("") + self.scaleBox.setStatusTip("") + self.scaleBox.setWhatsThis("") self.scaleBox.setAutoFillBackground(False) self.scaleBox.setStyleSheet("background-color: rgb(86, 86, 86);\n" - "border:1px solid rgb(194, 8, 6);\n" - "color: rgb(255, 255, 255);") +"border:1px solid rgb(194, 8, 6);\n" +"color: rgb(255, 255, 255);") self.scaleBox.setFlat(False) self.scaleBox.setCheckable(False) self.scaleBox.setObjectName("scaleBox") @@ -53,7 +52,7 @@ class Ui_MainWindow(InterfaceTimer): self.f_max = QtWidgets.QLineEdit(self.forceBox) self.f_max.setGeometry(QtCore.QRect(80, 30, 61, 21)) self.f_max.setStyleSheet("background-color: rgb(80,80,80);\n" - "color:rgb(255,255,255);") +"color:rgb(255,255,255);") self.f_max.setObjectName("f_max") self.f_max_label = QtWidgets.QLabel(self.forceBox) self.f_max_label.setGeometry(QtCore.QRect(20, 30, 57, 21)) @@ -66,16 +65,16 @@ class Ui_MainWindow(InterfaceTimer): self.f_min = QtWidgets.QLineEdit(self.forceBox) self.f_min.setGeometry(QtCore.QRect(80, 60, 61, 21)) self.f_min.setStyleSheet("background-color: rgb(80,80,80);\n" - "color:rgb(255,255,255);") +"color:rgb(255,255,255);") self.f_min.setObjectName("f_min") self.pressureBox = QtWidgets.QGroupBox(self.scaleBox) - self.pressureBox.setGeometry(QtCore.QRect(200, 30, 181, 101)) + self.pressureBox.setGeometry(QtCore.QRect(210, 30, 181, 101)) self.pressureBox.setStyleSheet("background-color:rgb(53, 53, 53)") self.pressureBox.setObjectName("pressureBox") self.p_max = QtWidgets.QLineEdit(self.pressureBox) self.p_max.setGeometry(QtCore.QRect(80, 30, 61, 21)) self.p_max.setStyleSheet("background-color: rgb(80,80,80);\n" - "color:rgb(255,255,255);") +"color:rgb(255,255,255);") self.p_max.setObjectName("p_max") self.p_max_label = QtWidgets.QLabel(self.pressureBox) self.p_max_label.setGeometry(QtCore.QRect(20, 30, 57, 21)) @@ -88,26 +87,26 @@ class Ui_MainWindow(InterfaceTimer): self.p_min = QtWidgets.QLineEdit(self.pressureBox) self.p_min.setGeometry(QtCore.QRect(80, 60, 61, 21)) self.p_min.setStyleSheet("background-color: rgb(80,80,80);\n" - "color:rgb(255,255,255);") +"color:rgb(255,255,255);") self.p_min.setObjectName("p_min") self.timeGBox = QtWidgets.QGroupBox(self.scaleBox) - self.timeGBox.setGeometry(QtCore.QRect(90, 140, 211, 81)) + self.timeGBox.setGeometry(QtCore.QRect(90, 140, 211, 71)) self.timeGBox.setStyleSheet("background-color:rgb(53, 53, 53)") self.timeGBox.setObjectName("timeGBox") self.t_max = QtWidgets.QLineEdit(self.timeGBox) self.t_max.setGeometry(QtCore.QRect(140, 30, 61, 21)) self.t_max.setStyleSheet("background-color: rgb(80,80,80);\n" - "color:rgb(255,255,255);") +"color:rgb(255,255,255);") self.t_max.setObjectName("t_max") self.t_max_label = QtWidgets.QLabel(self.timeGBox) self.t_max_label.setGeometry(QtCore.QRect(10, 30, 131, 21)) self.t_max_label.setStyleSheet("border: rgb(255,255,255)") self.t_max_label.setObjectName("t_max_label") self.samplingBox = QtWidgets.QGroupBox(self.centralWidget) - self.samplingBox.setGeometry(QtCore.QRect(20, 250, 181, 71)) + self.samplingBox.setGeometry(QtCore.QRect(20, 240, 191, 71)) self.samplingBox.setStyleSheet("background-color: rgb(86, 86, 86);\n" - "border: 1px solid rgb(255, 75, 0);\n" - "color: rgb(255, 255, 255);") +"border: 1px solid rgb(255, 75, 0);\n" +"color: rgb(255, 255, 255);") self.samplingBox.setObjectName("samplingBox") self.samplingCBox = QtWidgets.QComboBox(self.samplingBox) self.samplingCBox.setGeometry(QtCore.QRect(40, 30, 101, 27)) @@ -122,105 +121,129 @@ class Ui_MainWindow(InterfaceTimer): self.samplingCBox.addItem("") self.samplingCBox.addItem("") self.samplingCBox.addItem("") - self.currentTimeBox = QtWidgets.QGroupBox(self.centralWidget) - self.currentTimeBox.setGeometry(QtCore.QRect(20, 330, 391, 171)) - self.currentTimeBox.setStyleSheet("border:1px solid rgb(123, 0, 129);\n" - "background-color: rgb(86, 86, 86);") - self.currentTimeBox.setObjectName("currentTimeBox") - self.startTimerButton = QtWidgets.QPushButton(self.currentTimeBox) - self.startTimerButton.setGeometry(QtCore.QRect(150, 20, 61, 31)) - self.startTimerButton.setStyleSheet("background-color:rgb(53, 53, 53)") - self.startTimerButton.setObjectName("startTimerButton") - self.screenTimerGBox = QtWidgets.QGroupBox(self.currentTimeBox) - self.screenTimerGBox.setGeometry(QtCore.QRect(10, 30, 120, 131)) - self.screenTimerGBox.setStyleSheet("background-color:rgb(53, 53, 53)") - self.screenTimerGBox.setObjectName("screenTimerGBox") - self.screenTimerLabel = QtWidgets.QLabel(self.screenTimerGBox) - self.screenTimerLabel.setGeometry(QtCore.QRect(10, 60, 101, 31)) - self.screenTimerLabel.setStyleSheet("background-color: rgb(80,80,80);\n" - "color:rgb(255,255,255);\n" - "font: 75 12pt \"Noto Serif\";") - self.screenTimerLabel.setObjectName("screenTimerLabel") - self.startTimeGBox = QtWidgets.QGroupBox(self.currentTimeBox) - self.startTimeGBox.setGeometry(QtCore.QRect(230, 10, 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.currentTimeBox) - self.currentTimeGBox.setGeometry(QtCore.QRect(230, 90, 151, 71)) - self.currentTimeGBox.setStyleSheet("background-color:rgb(53, 53, 53)") - self.currentTimeGBox.setObjectName("currentTimeGBox") - self.currentTimeLabel = QtWidgets.QLabel(self.currentTimeGBox) - self.currentTimeLabel.setGeometry(QtCore.QRect(30, 30, 91, 31)) - self.currentTimeLabel.setStyleSheet("background-color: rgb(80,80,80);\n" - "color:rgb(255,255,255);\n" - "font: 14pt \"Noto Serif\";") - self.currentTimeLabel.setObjectName("currentTimeLabel") - self.stopTimerButton = QtWidgets.QPushButton(self.currentTimeBox) - self.stopTimerButton.setGeometry(QtCore.QRect(150, 120, 61, 31)) - self.stopTimerButton.setStyleSheet("background-color:rgb(53, 53, 53)") - self.stopTimerButton.setObjectName("stopTimerButton") - self.pauseTimerButton = QtWidgets.QPushButton(self.currentTimeBox) - self.pauseTimerButton.setGeometry(QtCore.QRect(150, 70, 61, 31)) - self.pauseTimerButton.setStyleSheet("background-color:rgb(53, 53, 53)") - self.pauseTimerButton.setObjectName("pauseTimerButton") self.pressNameGBox = QtWidgets.QGroupBox(self.centralWidget) - self.pressNameGBox.setGeometry(QtCore.QRect(220, 250, 191, 71)) + self.pressNameGBox.setGeometry(QtCore.QRect(220, 240, 201, 71)) self.pressNameGBox.setStyleSheet("border: 1px solid rgb(27, 144, 0);\n" - "background-color: rgb(86, 86, 86);") +"background-color: rgb(86, 86, 86);") self.pressNameGBox.setObjectName("pressNameGBox") self.pressName = QtWidgets.QLineEdit(self.pressNameGBox) - self.pressName.setGeometry(QtCore.QRect(50, 20, 111, 41)) + self.pressName.setGeometry(QtCore.QRect(50, 30, 111, 31)) self.pressName.setStyleSheet("font: 12pt \"Noto Serif\";\n" - "background-color:rgb(53, 53, 53);\n" - "color:rgb(255,255,255);") +"background-color:rgb(53, 53, 53);\n" +"color:rgb(255,255,255);") self.pressName.setObjectName("pressName") self.absValGBox = QtWidgets.QGroupBox(self.centralWidget) - self.absValGBox.setGeometry(QtCore.QRect(20, 510, 391, 111)) + self.absValGBox.setGeometry(QtCore.QRect(20, 530, 401, 101)) self.absValGBox.setStyleSheet("border: 1px solid rgb(26, 149, 172);\n" - "background-color: rgb(86, 86, 86);") +"background-color: rgb(86, 86, 86);") self.absValGBox.setObjectName("absValGBox") self.forceGBox = QtWidgets.QGroupBox(self.absValGBox) - self.forceGBox.setGeometry(QtCore.QRect(20, 30, 161, 71)) + self.forceGBox.setGeometry(QtCore.QRect(20, 30, 161, 61)) self.forceGBox.setStyleSheet("background-color:rgb(53, 53, 53)") self.forceGBox.setObjectName("forceGBox") self.forceLabel = QtWidgets.QLabel(self.forceGBox) - self.forceLabel.setGeometry(QtCore.QRect(20, 30, 121, 31)) + self.forceLabel.setGeometry(QtCore.QRect(20, 20, 121, 31)) self.forceLabel.setStyleSheet("background-color: rgb(80,80,80);\n" - "color:rgb(255,255,255);\n" - "font: 14pt \"Noto Serif\";") +"color:rgb(255,255,255);\n" +"font: 14pt \"Noto Serif\";") self.forceLabel.setObjectName("forceLabel") self.calibratorGBox = QtWidgets.QGroupBox(self.absValGBox) - self.calibratorGBox.setGeometry(QtCore.QRect(220, 30, 161, 71)) + self.calibratorGBox.setGeometry(QtCore.QRect(220, 30, 161, 61)) self.calibratorGBox.setStyleSheet("background-color:rgb(53, 53, 53)") self.calibratorGBox.setObjectName("calibratorGBox") self.calibratorLabel = QtWidgets.QLabel(self.calibratorGBox) - self.calibratorLabel.setGeometry(QtCore.QRect(20, 30, 131, 31)) + self.calibratorLabel.setGeometry(QtCore.QRect(20, 20, 131, 31)) self.calibratorLabel.setStyleSheet("background-color: rgb(80,80,80);\n" - "color:rgb(255,255,255);\n" - "font: 14pt \"Noto Serif\";") +"color:rgb(255,255,255);\n" +"font: 14pt \"Noto Serif\";") self.calibratorLabel.setObjectName("calibratorLabel") self.arquivoSalvoLabel = QtWidgets.QLabel(self.centralWidget) - self.arquivoSalvoLabel.setGeometry(QtCore.QRect(20, 630, 111, 16)) + self.arquivoSalvoLabel.setGeometry(QtCore.QRect(430, 630, 111, 16)) self.arquivoSalvoLabel.setObjectName("arquivoSalvoLabel") self.arqSalvoLabel = QtWidgets.QLabel(self.centralWidget) - self.arqSalvoLabel.setGeometry(QtCore.QRect(140, 630, 241, 16)) + self.arqSalvoLabel.setGeometry(QtCore.QRect(540, 630, 241, 16)) self.arqSalvoLabel.setObjectName("arqSalvoLabel") + self.cronometroBox = QtWidgets.QGroupBox(self.centralWidget) + self.cronometroBox.setGeometry(QtCore.QRect(20, 320, 401, 201)) + self.cronometroBox.setStyleSheet("background-color: rgb(86, 86, 86);\n" +"border:1px solid rgb(123, 0, 129);") + self.cronometroBox.setObjectName("cronometroBox") + self.timerGBox = QtWidgets.QGroupBox(self.cronometroBox) + 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) + self.timerLabel.setGeometry(QtCore.QRect(20, 30, 81, 31)) + self.timerLabel.setStyleSheet("background-color: rgb(80,80,80);\n" +"color:rgb(255,255,255);\n" +"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, 120, 151, 71)) + self.currentTimeGBox.setStyleSheet("background-color:rgb(53, 53, 53)") + self.currentTimeGBox.setObjectName("currentTimeGBox") + self.currentTimeLabel = QtWidgets.QLabel(self.currentTimeGBox) + self.currentTimeLabel.setGeometry(QtCore.QRect(30, 30, 91, 31)) + self.currentTimeLabel.setStyleSheet("background-color:rgb(80, 80,80);\n" +"color:rgb(255,255,255);\n" +"font: 14pt \"Noto Serif\";") + self.currentTimeLabel.setObjectName("currentTimeLabel") + self.regTimerGBox = QtWidgets.QGroupBox(self.cronometroBox) + self.regTimerGBox.setGeometry(QtCore.QRect(10, 120, 211, 71)) + self.regTimerGBox.setStyleSheet("background-color:rgb(53, 53, 53)") + self.regTimerGBox.setObjectName("regTimerGBox") + 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.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.stopRegTimerButton = QtWidgets.QPushButton(self.cronometroBox) + 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") MainWindow.setCentralWidget(self.centralWidget) 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.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.finalizeButton = QtWidgets.QMenu(self.menuBar) + self.finalizeButton.setObjectName("finalizeButton") MainWindow.setMenuBar(self.menuBar) self.menuStatusBar = QtWidgets.QStatusBar(MainWindow) self.menuStatusBar.setObjectName("menuStatusBar") @@ -231,92 +254,51 @@ class Ui_MainWindow(InterfaceTimer): self.alternaCalibraT.setObjectName("alternaCalibraT") self.alternaProc = QtWidgets.QAction(MainWindow) self.alternaProc.setObjectName("alternaProc") - self.botaoAbrir = QtWidgets.QAction(MainWindow) - self.botaoAbrir.setIconVisibleInMenu(True) - self.botaoAbrir.setObjectName("botaoAbrir") + self.openButton = QtWidgets.QAction(MainWindow) + 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.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.playPauseButton.menuAction()) + self.menuBar.addAction(self.finalizeButton.menuAction()) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) - 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.pauseTimerButton.setText("Iniciar") - self.screenTimerFlag = False - self.startTimerButton.pressed.connect(self.startScreenTimer) - self.stopTimerButton.pressed.connect(self.stopScreenTimer) - self.pauseTimerButton.pressed.connect(self.playPauseScreenTimer) - self.currentTimer = QtCore.QTimer() - self.currentTimer.timeout.connect(self.updateCurrentTime) - self.currentTimer.start(500) - - self.screenTimerFlag = False - 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 1 - Calibração de Pressão")) + 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.forceBox.setTitle(_translate("MainWindow", "Força (kN)")) + self.forceBox.setTitle(_translate("MainWindow", "Força")) self.f_max.setText(_translate("MainWindow", "32700")) self.f_max_label.setText(_translate("MainWindow", "Máximo:")) self.f_min_label.setText(_translate("MainWindow", "Mínimo:")) self.f_min.setText(_translate("MainWindow", "0")) - self.pressureBox.setTitle(_translate("MainWindow", "Tensão no Calibrante (mV)")) + self.pressureBox.setTitle(_translate("MainWindow", "Tensão no Calibrante")) self.p_max.setText(_translate("MainWindow", "32700")) self.p_max_label.setText(_translate("MainWindow", "Máximo:")) self.p_min_label.setText(_translate("MainWindow", "Mínimo:")) self.p_min.setText(_translate("MainWindow", "0")) - self.timeGBox.setTitle(_translate("MainWindow", "Tempo (s)")) + self.timeGBox.setTitle(_translate("MainWindow", "Tempo")) self.t_max.setText(_translate("MainWindow", "100")) - self.t_max_label.setText(_translate("MainWindow", "Intervalo:")) + self.t_max_label.setText(_translate("MainWindow", "Intervalo (amostras):")) self.samplingBox.setTitle(_translate("MainWindow", "Amostragem")) self.samplingCBox.setItemText(0, _translate("MainWindow", "100 mseg")) self.samplingCBox.setItemText(1, _translate("MainWindow", "200 mseg")) @@ -327,16 +309,6 @@ class Ui_MainWindow(InterfaceTimer): self.samplingCBox.setItemText(6, _translate("MainWindow", "2.5 seg")) self.samplingCBox.setItemText(7, _translate("MainWindow", "5 seg")) self.samplingCBox.setItemText(8, _translate("MainWindow", "10 seg")) - self.currentTimeBox.setTitle(_translate("MainWindow", "Timer")) - self.startTimerButton.setText(_translate("MainWindow", "Iniciar")) - self.screenTimerGBox.setTitle(_translate("MainWindow", "Cronômetro")) - self.screenTimerLabel.setText(_translate("MainWindow", "0 seg")) - self.startTimeGBox.setTitle(_translate("MainWindow", "Horário de Início")) - self.startTimeLabel.setText(_translate("MainWindow", "00:00:00")) - self.currentTimeGBox.setTitle(_translate("MainWindow", "Horário Atual")) - self.currentTimeLabel.setText(_translate("MainWindow", "00:00:00")) - self.stopTimerButton.setText(_translate("MainWindow", "Parar")) - self.pauseTimerButton.setText(_translate("MainWindow", "Pausar")) self.pressNameGBox.setTitle(_translate("MainWindow", "Prensa")) self.pressName.setText(_translate("MainWindow", "Pr 400 Tonf")) self.absValGBox.setTitle(_translate("MainWindow", "Valores Absolutos")) @@ -346,15 +318,31 @@ class Ui_MainWindow(InterfaceTimer): self.calibratorLabel.setText(_translate("MainWindow", "0 mV")) self.arquivoSalvoLabel.setText(_translate("MainWindow", "Arquivo Salvo em:")) self.arqSalvoLabel.setText(_translate("MainWindow", "/home/LAPMA/Pressao/1025565.pre")) - self.menuArquivo.setTitle(_translate("MainWindow", "Arquivo")) - self.menuEtapa.setTitle(_translate("MainWindow", "Etapa")) - self.menuPorta.setTitle(_translate("MainWindow", "Porta")) + self.cronometroBox.setTitle(_translate("MainWindow", "Timer")) + self.timerGBox.setTitle(_translate("MainWindow", "Cronômetro")) + 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.startRegTimerButton.setText(_translate("MainWindow", "Iniciar")) + self.regTimerLabel.setText(_translate("MainWindow", "0.00s")) + self.stopRegTimerButton.setText(_translate("MainWindow", "Parar")) + 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.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")) + diff --git a/Interface/CalibracaoT.py b/Interface/CalibracaoT.py index 399e2b2..bb4199f 100644 --- a/Interface/CalibracaoT.py +++ b/Interface/CalibracaoT.py @@ -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")) diff --git a/Interface/Graph.py b/Interface/Graph.py index e7bb8f4..8f5b2bb 100644 --- a/Interface/Graph.py +++ b/Interface/Graph.py @@ -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() diff --git a/Interface/InterfaceTimer.py b/Interface/InterfaceTimer.py index 3fb6c30..73a5f14 100644 --- a/Interface/InterfaceTimer.py +++ b/Interface/InterfaceTimer.py @@ -1,42 +1,58 @@ 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())) diff --git a/Interface/Resources/CalibracaoP.ui b/Interface/Resources/CalibracaoP.ui index 30da7df..bfb07e1 100644 --- a/Interface/Resources/CalibracaoP.ui +++ b/Interface/Resources/CalibracaoP.ui @@ -30,10 +30,10 @@ color: rgb(255,255,255); - 420 + 430 10 - 931 - 621 + 921 + 611 @@ -60,8 +60,8 @@ color: rgb(255,255,255); 20 10 - 391 - 231 + 401 + 221 @@ -175,7 +175,7 @@ color:rgb(255,255,255); - 200 + 210 30 181 101 @@ -260,7 +260,7 @@ color:rgb(255,255,255); 90 140 211 - 81 + 71 @@ -308,8 +308,8 @@ color:rgb(255,255,255); 20 - 250 - 181 + 240 + 191 71 @@ -380,93 +380,112 @@ color: rgb(255, 255, 255); - + - 20 - 330 - 391 - 171 + 220 + 240 + 201 + 71 - border:1px solid rgb(123, 0, 129); + border: 1px solid rgb(27, 144, 0); background-color: rgb(86, 86, 86); - Timer + Prensa - + - 150 - 20 - 61 + 50 + 30 + 111 31 - background-color:rgb(53, 53, 53) + font: 12pt "Noto Serif"; +background-color:rgb(53, 53, 53); +color:rgb(255,255,255); - Iniciar + Pr 400 Tonf - + + + + + 20 + 530 + 401 + 101 + + + + border: 1px solid rgb(26, 149, 172); +background-color: rgb(86, 86, 86); + + + Valores Absolutos + + - 10 + 20 30 - 120 - 131 + 161 + 61 background-color:rgb(53, 53, 53) - Cronômetro + Força - + - 10 - 60 - 101 + 20 + 20 + 121 31 background-color: rgb(80,80,80); color:rgb(255,255,255); -font: 75 12pt "Noto Serif"; +font: 14pt "Noto Serif"; - 0 seg + 0 Tonf - + - 230 - 10 - 151 - 71 + 220 + 30 + 161 + 61 background-color:rgb(53, 53, 53) - Horário de Início + Tensão no Calibrante - + - 30 - 30 - 91 + 20 + 20 + 131 31 @@ -476,16 +495,59 @@ color:rgb(255,255,255); font: 14pt "Noto Serif"; - 00:00:00 + 0 mV - + + + + + 430 + 630 + 111 + 16 + + + + Arquivo Salvo em: + + + + + + 540 + 630 + 241 + 16 + + + + /home/LAPMA/Pressao/1025565.pre + + + + + + 20 + 320 + 401 + 201 + + + + background-color: rgb(86, 86, 86); +border:1px solid rgb(123, 0, 129); + + + Timer + + - 230 - 90 - 151 + 10 + 30 + 211 71 @@ -493,117 +555,102 @@ font: 14pt "Noto Serif"; background-color:rgb(53, 53, 53) - Horário Atual + Cronômetro - + - 30 + 20 30 - 91 + 81 31 background-color: rgb(80,80,80); +border: 1px solid rgb(255,255,255); color:rgb(255,255,255); -font: 14pt "Noto Serif"; +font: 75 12pt "Noto Serif"; - 00:00:00 + 0.00 s + + + + + + 130 + 10 + 61 + 21 + + + + border: 1px solid rgb(255,255,255); +background-color: rgb(80,80,80); + + + Iniciar + + + + + + 130 + 40 + 61 + 21 + + + + border: 1px solid rgb(255,255,255); +background-color: rgb(80,80,80); + + + Parar - - - - 150 - 120 - 61 - 31 - - - - background-color:rgb(53, 53, 53) - - - Parar - - - + - 150 - 70 - 61 - 31 + 240 + 30 + 151 + 71 background-color:rgb(53, 53, 53) - - Pausar - - - - - - - 220 - 250 - 191 - 71 - - - - border: 1px solid rgb(27, 144, 0); -background-color: rgb(86, 86, 86); - - - Prensa - - - - - 50 - 20 - 111 - 41 - - - - font: 12pt "Noto Serif"; -background-color:rgb(53, 53, 53); -color:rgb(255,255,255); - - - Pr 400 Tonf + + Horário de Início + + + + 30 + 30 + 91 + 31 + + + + background-color:rgb(80, 80,80); +color:rgb(255,255,255); +font: 14pt "Noto Serif"; + + + 16:30:15 + + - - - - - 20 - 510 - 391 - 111 - - - - border: 1px solid rgb(26, 149, 172); -background-color: rgb(86, 86, 86); - - - Valores Absolutos - - + - 20 - 30 - 161 + 240 + 120 + 151 71 @@ -611,33 +658,33 @@ background-color: rgb(86, 86, 86); background-color:rgb(53, 53, 53) - Força + Horário Atual - + - 20 + 30 30 - 121 + 91 31 - background-color: rgb(80,80,80); + background-color:rgb(80, 80,80); color:rgb(255,255,255); font: 14pt "Noto Serif"; - 0 Tonf + 17:05:56 - + - 220 - 30 - 161 + 10 + 120 + 211 71 @@ -645,53 +692,62 @@ font: 14pt "Noto Serif"; background-color:rgb(53, 53, 53) - Tensão no Calibrante + Cont. Regressivo - + + + + 130 + 10 + 61 + 21 + + + + border: 1px solid rgb(255,255,255); +background-color: rgb(80,80,80); + + + Iniciar + + + 20 30 - 131 + 81 31 background-color: rgb(80,80,80); +border: 1px solid rgb(255,255,255); color:rgb(255,255,255); -font: 14pt "Noto Serif"; +font: 75 12pt "Noto Serif"; - 0 mV + 0.00s - - - - - 20 - 630 - 111 - 16 - - - - Arquivo Salvo em: - - - - - - 140 - 630 - 241 - 16 - - - - /home/LAPMA/Pressao/1025565.pre - + + + + 140 + 160 + 61 + 21 + + + + background-color: rgb(80,80,80); +border: 1px solid rgb(255,255,255); + + + Parar + + @@ -703,15 +759,15 @@ font: 14pt "Noto Serif"; 23 - + Arquivo - - - + + + - + Etapa @@ -719,14 +775,26 @@ font: 14pt "Noto Serif"; - + Porta - - - + + + Iniciar/Pausar + + + + + Finalizar + + + + + + + @@ -744,7 +812,7 @@ font: 14pt "Noto Serif"; Processamento - + Abrir @@ -762,12 +830,12 @@ font: 14pt "Noto Serif"; Salvar Como - + Salvar - + Salvar Como diff --git a/Interface/Resources/CalibracaoT.ui b/Interface/Resources/CalibracaoT.ui index 6938647..7caa1a8 100644 --- a/Interface/Resources/CalibracaoT.ui +++ b/Interface/Resources/CalibracaoT.ui @@ -473,29 +473,12 @@ border:1px solid rgb(123, 0, 129); Timer - - - - 170 - 30 - 51 - 31 - - - - background-color:rgb(53, 53, 53); -border: 1px solid rgb(44, 0, 47); - - - Iniciar - - 10 30 - 141 + 211 71 @@ -521,14 +504,45 @@ border: 1px solid rgb(44, 0, 47); font: 75 12pt "Noto Serif"; - 10.2674 s + 0.00 s + + + + + + 130 + 10 + 51 + 21 + + + + background-color:rgb(53, 53, 53); +border: 1px solid rgb(44, 0, 47); + + + Iniciar + + + + + + 130 + 40 + 51 + 21 + + + + background-color:rgb(53, 53, 53); +border: 1px solid rgb(44, 0, 47); + + + Parar - timerLabel - startTimerButton - stopTimerButton - + 240 @@ -543,7 +557,7 @@ font: 75 12pt "Noto Serif"; Horário de Início - + 30 @@ -562,7 +576,7 @@ font: 14pt "Noto Serif"; - + 240 @@ -577,7 +591,7 @@ font: 14pt "Noto Serif"; Horário Atual - + 30 @@ -596,29 +610,12 @@ font: 14pt "Noto Serif"; - - - - 170 - 70 - 51 - 31 - - - - background-color:rgb(53, 53, 53); -border: 1px solid rgb(44, 0, 47); - - - Parar - - 10 120 - 141 + 211 71 @@ -628,7 +625,24 @@ border: 1px solid rgb(44, 0, 47); Cont. Regressivo - + + + + 130 + 10 + 51 + 21 + + + + border: 1px solid rgb(255,255,255); +background-color:rgb(53, 53, 53) + + + Iniciar + + + 20 @@ -643,35 +657,15 @@ border: 1px solid rgb(255,255,255); color:rgb(255,255,255); font: 75 12pt "Noto Serif"; - - 10.2674 s - - - - - 170 - 120 - 51 - 31 - - - - border: 1px solid rgb(255,255,255); -background-color:rgb(53, 53, 53) - - - Iniciar - - - 170 + 140 160 51 - 31 + 21 @@ -742,7 +736,7 @@ background-color:rgb(53, 53, 53) - /home/LAPMA/Pressao/1025565.pre + /home/LAPMA/Pressao/1025565.temp @@ -900,16 +894,6 @@ font: 14pt "Noto Serif"; - CentralGraph - scaleBox - samplingBox - cronometroBox - prensaNameGBox - arquivoSalvoLabel - arqSalvoLabel - ambientTempGBox - amostragemBox_2 - absolValGBox @@ -921,15 +905,15 @@ font: 14pt "Noto Serif"; 23 - + Arquivo - - - + + + - + Etapa @@ -937,32 +921,32 @@ font: 14pt "Noto Serif"; - + Porta - + Iniciar/Pausar - + Termopar - + Finalizar - - - - - - + + + + + + @@ -979,7 +963,7 @@ font: 14pt "Noto Serif"; Processamento - + false @@ -1000,12 +984,12 @@ font: 14pt "Noto Serif"; Salvar Como - + Salvar - + Salvar Como diff --git a/Interface/SerialManager.py b/Interface/SerialManager.py index 4f97e83..90ee877 100644 --- a/Interface/SerialManager.py +++ b/Interface/SerialManager.py @@ -1,6 +1,7 @@ import serial import serial.tools.list_ports import time +from PyQt5 import QtWidgets class SerialManager(object): @@ -21,4 +22,12 @@ class SerialManager(object): if(self.ser.inWaiting()==0): pass self.ser.flushInput() - return self.ser.readline() \ No newline at end of file + return self.ser.readline() + + def serialListPanel(self, uiWindow): + uiWindow.usb = [] + for i in range(0, len(self.portList)): + uiWindow.usb.append(QtWidgets.QAction(uiWindow.MainWindow)) + uiWindow.usb[i].setText(self.portList[i].device) + uiWindow.usb[i].setCheckable(True) + uiWindow.serialMenu.addAction(uiWindow.usb[i]) \ No newline at end of file diff --git a/Interface/SystemEngine.py b/Interface/SystemEngine.py index f2da399..85e5dac 100644 --- a/Interface/SystemEngine.py +++ b/Interface/SystemEngine.py @@ -4,7 +4,7 @@ import sys from PyQt5 import QtCore,QtGui,QtWidgets from pyqtgraph import GraphicsLayout from SerialManager import SerialManager -from CalibracaoT import Ui_MainWindow +from CalibracaoP import Ui_MainWindow from Graph import Graph import numpy as np from math import sin,log @@ -19,22 +19,29 @@ class SystemEngine(object): self.ser1.startPort(str(self.ser1.portList[0].device), 115200) self.uiCalibra1 = Ui_MainWindow() self.uiCalibra1.setupUi(self.dialog) - self.uiCalibra1.serialListPanel(self.ser1.portList) - - self.prev_x_scale=100 - self.x_scale=100 - self.y1_min=0 - self.y1_max=32700 - self.y2_min=0 - self.y2_max=10000 + self.ser1.serialListPanel(self.uiCalibra1) + + + + self.x_scale=10 + self.nCurves = 2 + self.y_min=[0,0] + self.y_max=[32700,10000] + + + self.color = ['r','g'] + self.name = ["Força","Tensão no Calibrante"] + self.unit = ["Tonf","mV"] + self.layout=GraphicsLayout() self.updateTimer() - self.graph = Graph(self.time[0]/1000,self.x_scale, self.y1_min, self.y1_max, self.y2_min, self.y2_max, 800, 500, 'r', 'g', "Força", "Tensão no Calibrante") + self.graph = Graph(self.time[0]/1000,self.x_scale,self.nCurves, self.y_min, self.y_max, 800, 500, self.color,self.name,self.unit) + + self.layout.addItem(self.graph.axis[0],row=1,col=1,rowspan=1,colspan=1) + for n in range(1,self.nCurves): + self.layout.addItem(self.graph.axis[n],row=1,col=n+2,rowspan=1,colspan=1) - self.layout.addItem(self.graph.axis2,row=1,col=3,rowspan=1,colspan=1) - self.layout.addItem(self.graph.axis1,row=1,col=1,rowspan=1,colspan=1) - self.layout.addItem(self.graph.axisTime,row=2,col=2,rowspan=1,colspan=1) self.layout.addItem(self.graph,row=1,col=2,rowspan=1,colspan=1) self.layout.setMinimumSize(500, 600) self.layout.setMaximumSize(500,600) @@ -52,7 +59,19 @@ class SystemEngine(object): #self.layout.setMaximumSize(770,550) self.scene.focusItem() - self.uiCalibra1.sceneSelector(self.scene) + self.sceneSelector(self.scene) + + self.uiCalibra1.menuPlay_Pause = QtWidgets.QAction(self.dialog) + self.uiCalibra1.menuPlay_Pause.setText("Play") + self.uiCalibra1.menuPlay_Pause.setObjectName("menuPlay_Pause") + self.uiCalibra1.menuBar.addAction(self.uiCalibra1.menuPlay_Pause) + self.uiCalibra1.menuPlay_Pause.setCheckable(True) + + self.uiCalibra1.menuPlay_Pause.toggled.connect(self.playPauseButtonAnimation) + + self.uiCalibra1.linkActions() + + self.dialog.showMaximized() @@ -68,22 +87,38 @@ class SystemEngine(object): self.timer.start(100) + def playPauseButtonAnimation(self): + if (self.uiCalibra1.menuPlay_Pause.text() == "Play"): + self.uiCalibra1.menuPlay_Pause.setText("Pause") + self.uiCalibra1.startTimeLabel.setText(self.uiCalibra1.currentTimeLabel.text()) + else: + self.uiCalibra1.menuPlay_Pause.setText("Play") + + def sceneSelector(self, scene): + self.uiCalibra1.CentralGraph.setScene(scene) + self.uiCalibra1.CentralGraph.setBackgroundBrush(QtCore.Qt.black) + self.uiCalibra1.CentralGraph.setInteractive(False) + def updateData(self): #print(time.time()-self.timeant) if(self.uiCalibra1.menuPlay_Pause.isChecked()==True): readData = self.ser1.read() # Lê o dado da serial readData = readData.decode('utf8') - dado = readData.split(' ', 3) + dado = readData.split(' ', self.nCurves+1) + dado[len(dado)-1]=dado[len(dado)-1].split('\n',2)[0] try: - self.uiCalibra1.forceLabel.setText(str(dado[0])+" Tonf") - self.uiCalibra1.calibratorLabel.setText(str(dado[1].split()[0])+" mV") + #self.uiCalibra1.forceLabel.setText(str(dado[0])+" Tonf") + #self.uiCalibra1.calibratorLabel.setText(str(dado[1].split()[0])+" mV") + pass except IndexError: print("Erro no Indice do Array Enviado pela Serial") try: - self.graph.updateGraph(float(dado[0]),float(dado[1])) - except ValueError: - print("Erro nos Valores do Array Enviado pela Serial") + print(dado) + self.graph.updateGraph(dado) + + except Exception as e: + print(e) except IndexError: print("Erro: Array inválido") print(dado) -- 2.22.0