Commit 6124f4f3 authored by Alisson Claudino's avatar Alisson Claudino
Browse files

ADD: MainWindow and it's functionalities

parent 57c1b0c8
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Resources/MainWindow.ui'
#
# Created by: PyQt5 UI code generator 5.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
from PressCalib import PressCalib
from TempCalib import TempCalib
from Process import Process
from SystemEngine import SystemEngine
class Ui_MainWindow(object):
def __init__(self):
self.app = QtWidgets.QApplication(sys.argv)
self.dialog = QtWidgets.QMainWindow()
self.setupUi(self.dialog)
self.dialog.show()
self.pressButton.pressed.connect(self.startPress)
def startPress(self):
self.dialog.close()
self.ui = PressCalib()
self.ui.setupUi(self.dialog)
self.dialog.showMaximized()
engine = SystemEngine(0,self.ui)
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
MainWindow.setStyleSheet("background-color:rgb(0, 0, 0);\n"
"color: rgb(255,255,255);")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(30, 130, 741, 71))
self.label.setStyleSheet("background-color:rgb(0,0,0);\n"
"font: 15pt \"Noto Serif\";")
self.label.setObjectName("label")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(310, 30, 141, 81))
self.label_2.setStyleSheet("background-color:rgb(0,0,0);\n"
"font: 22pt \"Noto Serif\";")
self.label_2.setObjectName("label_2")
self.pressButton = QtWidgets.QToolButton(self.centralwidget)
self.pressButton.setGeometry(QtCore.QRect(50, 300, 171, 51))
self.pressButton.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"")
self.pressButton.setObjectName("pressButton")
self.tempButton = QtWidgets.QToolButton(self.centralwidget)
self.tempButton.setGeometry(QtCore.QRect(310, 300, 181, 51))
self.tempButton.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"")
self.tempButton.setObjectName("tempButton")
self.procButton = QtWidgets.QToolButton(self.centralwidget)
self.procButton.setGeometry(QtCore.QRect(570, 300, 181, 51))
self.procButton.setStyleSheet("background-color:rgb(53, 53, 53);")
self.procButton.setObjectName("procButton")
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(40, 420, 151, 141))
self.label_3.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"font: 15pt \"Noto Serif\";")
self.label_3.setText("")
self.label_3.setPixmap(QtGui.QPixmap("Resources/logo_pt.jpg"))
self.label_3.setScaledContents(True)
self.label_3.setObjectName("label_3")
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setGeometry(QtCore.QRect(590, 420, 171, 141))
self.label_4.setStyleSheet("background-color:rgb(0,0,0);\n"
"font: 15pt \"Noto Serif\";")
self.label_4.setText("")
self.label_4.setPixmap(QtGui.QPixmap("Resources/750px-Ufrgs.svg.png"))
self.label_4.setScaledContents(True)
self.label_4.setObjectName("label_4")
self.label_5 = QtWidgets.QLabel(self.centralwidget)
self.label_5.setGeometry(QtCore.QRect(260, 420, 281, 151))
self.label_5.setStyleSheet("")
self.label_5.setText("")
self.label_5.setPixmap(QtGui.QPixmap("Resources/LogoCTA_2015_vetorial_cor.png"))
self.label_5.setScaledContents(True)
self.label_5.setObjectName("label_5")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "SADAPMAP"))
self.label.setText(_translate("MainWindow", " Sistema de Aquisição de Dados para Análise de Materiais em Altas Pressões"))
self.label_2.setText(_translate("MainWindow", "SADAMAP"))
self.pressButton.setText(_translate("MainWindow", "Calibração de Pressão"))
self.tempButton.setText(_translate("MainWindow", "Calibração de Temperatura"))
self.procButton.setText(_translate("MainWindow", "Processamento"))
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from InterfaceTimer import InterfaceTimer from InterfaceTimer import InterfaceTimer
class Ui_MainWindow(InterfaceTimer): class PressCalib(InterfaceTimer):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
self.MainWindow=MainWindow self.MainWindow=MainWindow
MainWindow.setObjectName("MainWindow") MainWindow.setObjectName("MainWindow")
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object): class Process(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow") MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600) MainWindow.resize(800, 600)
......
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>SADAPMAP</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color:rgb(53, 53, 53); <string notr="true">background-color:rgb(0, 0, 0);
color: rgb(255,255,255);</string> color: rgb(255,255,255);</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
...@@ -28,7 +28,7 @@ color: rgb(255,255,255);</string> ...@@ -28,7 +28,7 @@ color: rgb(255,255,255);</string>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color:rgb(53, 53, 53); <string notr="true">background-color:rgb(0,0,0);
font: 15pt &quot;Noto Serif&quot;;</string> font: 15pt &quot;Noto Serif&quot;;</string>
</property> </property>
<property name="text"> <property name="text">
...@@ -45,7 +45,7 @@ font: 15pt &quot;Noto Serif&quot;;</string> ...@@ -45,7 +45,7 @@ font: 15pt &quot;Noto Serif&quot;;</string>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color:rgb(53, 53, 53); <string notr="true">background-color:rgb(0,0,0);
font: 22pt &quot;Noto Serif&quot;;</string> font: 22pt &quot;Noto Serif&quot;;</string>
</property> </property>
<property name="text"> <property name="text">
...@@ -55,12 +55,16 @@ font: 22pt &quot;Noto Serif&quot;;</string> ...@@ -55,12 +55,16 @@ font: 22pt &quot;Noto Serif&quot;;</string>
<widget class="QToolButton" name="pressButton"> <widget class="QToolButton" name="pressButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>50</x>
<y>340</y> <y>300</y>
<width>171</width> <width>171</width>
<height>51</height> <height>51</height>
</rect> </rect>
</property> </property>
<property name="styleSheet">
<string notr="true">background-color:rgb(53, 53, 53);
</string>
</property>
<property name="text"> <property name="text">
<string>Calibração de Pressão</string> <string>Calibração de Pressão</string>
</property> </property>
...@@ -69,11 +73,15 @@ font: 22pt &quot;Noto Serif&quot;;</string> ...@@ -69,11 +73,15 @@ font: 22pt &quot;Noto Serif&quot;;</string>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>310</x> <x>310</x>
<y>340</y> <y>300</y>
<width>181</width> <width>181</width>
<height>51</height> <height>51</height>
</rect> </rect>
</property> </property>
<property name="styleSheet">
<string notr="true">background-color:rgb(53, 53, 53);
</string>
</property>
<property name="text"> <property name="text">
<string>Calibração de Temperatura</string> <string>Calibração de Temperatura</string>
</property> </property>
...@@ -81,16 +89,87 @@ font: 22pt &quot;Noto Serif&quot;;</string> ...@@ -81,16 +89,87 @@ font: 22pt &quot;Noto Serif&quot;;</string>
<widget class="QToolButton" name="procButton"> <widget class="QToolButton" name="procButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>580</x> <x>570</x>
<y>340</y> <y>300</y>
<width>181</width> <width>181</width>
<height>51</height> <height>51</height>
</rect> </rect>
</property> </property>
<property name="styleSheet">
<string notr="true">background-color:rgb(53, 53, 53);</string>
</property>
<property name="text"> <property name="text">
<string>Processamento</string> <string>Processamento</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>40</x>
<y>420</y>
<width>151</width>
<height>141</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color:rgb(53, 53, 53);
font: 15pt &quot;Noto Serif&quot;;</string>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>logo_pt.jpg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>590</x>
<y>420</y>
<width>171</width>
<height>141</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color:rgb(0,0,0);
font: 15pt &quot;Noto Serif&quot;;</string>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>750px-Ufrgs.svg.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>260</x>
<y>420</y>
<width>281</width>
<height>151</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>LogoCTA_2015_vetorial_cor.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/> <widget class="QStatusBar" name="statusbar"/>
</widget> </widget>
......
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import sys import sys
from SystemEngine import SystemEngine from MainWindow import Ui_MainWindow
if __name__ == '__main__': if __name__ == '__main__':
engine=SystemEngine() mainWindow = Ui_MainWindow()
sys.exit(engine.app.exec_()) #engine=SystemEngine()
sys.exit(mainWindow.app.exec_())
...@@ -18,23 +18,24 @@ import sys ...@@ -18,23 +18,24 @@ import sys
from PyQt5 import QtCore,QtGui,QtWidgets from PyQt5 import QtCore,QtGui,QtWidgets
from pyqtgraph import GraphicsLayout from pyqtgraph import GraphicsLayout
from SerialManager import SerialManager from SerialManager import SerialManager
from CalibracaoP import Ui_MainWindow from PressCalib import PressCalib
from TempCalib import TempCalib
from Process import Process
from Graph import Graph from Graph import Graph
import numpy as np
from math import sin,log
class SystemEngine(object):
def __init__(self): #Construtor da classe class SystemEngine(object):
def __init__(self, interType,ui): #Construtor da classe
self.timer=QtCore.QTimer() self.timer=QtCore.QTimer()
self.app = QtWidgets.QApplication(sys.argv) self.ui=ui
self.dialog = QtWidgets.QMainWindow()
self.ser1 = SerialManager() self.ser1 = SerialManager()
self.ser1.startPort(str(self.ser1.portList[1].device), 115200) self.ser1.startPort(str(self.ser1.portList[1].device), 115200)
self.uiCalibra1 = Ui_MainWindow()
self.uiCalibra1.setupUi(self.dialog)
self.ser1.serialListPanel(self.uiCalibra1)
self.ser1.serialListPanel(self.ui)
...@@ -77,55 +78,59 @@ class SystemEngine(object): ...@@ -77,55 +78,59 @@ class SystemEngine(object):
self.sceneSelector(self.scene) self.sceneSelector(self.scene)
self.uiCalibra1.menuPlay_Pause = QtWidgets.QAction(self.dialog) self.ui.menuPlay_Pause = QtWidgets.QAction(self.ui.MainWindow)
self.uiCalibra1.menuPlay_Pause.setText("Play") self.ui.menuPlay_Pause.setText("Play")
self.uiCalibra1.menuPlay_Pause.setObjectName("menuPlay_Pause") self.ui.menuPlay_Pause.setObjectName("menuPlay_Pause")
self.uiCalibra1.menuBar.addAction(self.uiCalibra1.menuPlay_Pause)
self.uiCalibra1.menuPlay_Pause.setCheckable(True) self.ui.menuBar.addAction(self.ui.menuPlay_Pause)
self.ui.menuPlay_Pause.setCheckable(True)
self.ui.menuPlay_Pause.triggered.connect(self.playPauseButtonAnimation)
self.uiCalibra1.menuPlay_Pause.toggled.connect(self.playPauseButtonAnimation) self.ui.linkActions()
self.uiCalibra1.linkActions()
self.dialog.showMaximized()
self.uiCalibra1.t_max.returnPressed.connect(self.updateScale) self.ui.t_max.returnPressed.connect(self.updateScale)
self.uiCalibra1.f_max.returnPressed.connect(self.updateScale) self.ui.f_max.returnPressed.connect(self.updateScale)
self.uiCalibra1.f_min.returnPressed.connect(self.updateScale) self.ui.f_min.returnPressed.connect(self.updateScale)
self.uiCalibra1.p_max.returnPressed.connect(self.updateScale) self.ui.p_max.returnPressed.connect(self.updateScale)
self.uiCalibra1.p_min.returnPressed.connect(self.updateScale) self.ui.p_min.returnPressed.connect(self.updateScale)
self.uiCalibra1.samplingCBox.currentIndexChanged.connect(self.updateTimer) self.ui.samplingCBox.currentIndexChanged.connect(self.updateTimer)
self.timeant=time.time() self.timeant=time.time()
self.timer.timeout.connect(self.updateData) self.timer.timeout.connect(self.updateData)
self.timer.start(100)
thread_instance = QtCore.QThread()
thread_instance.start()
thread_instance.exec_()
self.timer.start(100)
def playPauseButtonAnimation(self): def playPauseButtonAnimation(self):
if (self.uiCalibra1.menuPlay_Pause.text() == "Play"): if (self.ui.menuPlay_Pause.text() == "Play"):
self.uiCalibra1.menuPlay_Pause.setText("Pause") self.ui.menuPlay_Pause.setText("Pause")
self.uiCalibra1.startTimeLabel.setText(self.uiCalibra1.currentTimeLabel.text()) self.ui.startTimeLabel.setText(self.ui.currentTimeLabel.text())
else: else:
self.uiCalibra1.menuPlay_Pause.setText("Play") self.ui.menuPlay_Pause.setText("Play")
def sceneSelector(self, scene): def sceneSelector(self, scene):
self.uiCalibra1.CentralGraph.setScene(scene) self.ui.CentralGraph.setScene(scene)
self.uiCalibra1.CentralGraph.setBackgroundBrush(QtCore.Qt.black) self.ui.CentralGraph.setBackgroundBrush(QtCore.Qt.black)
self.uiCalibra1.CentralGraph.setInteractive(False) self.ui.CentralGraph.setInteractive(False)
def updateData(self): def updateData(self):
#print(time.time()-self.timeant) #print(time.time()-self.timeant)
if(self.uiCalibra1.menuPlay_Pause.isChecked()==True): if(self.ui.menuPlay_Pause.isChecked()==True):
readData = self.ser1.read() # Lê o dado da serial readData = self.ser1.read() # Lê o dado da serial
readData = readData.decode('utf8') readData = readData.decode('utf8')
dado = readData.split(' ', self.nCurves+1) dado = readData.split(' ', self.nCurves+1)
dado[len(dado)-1]=dado[len(dado)-1].split('\n',2)[0] dado[len(dado)-1]=dado[len(dado)-1].split('\n',2)[0]
try: try:
self.uiCalibra1.forceLabel.setText(str(dado[0])+" Tonf") self.ui.forceLabel.setText(str(dado[0])+" Tonf")
self.uiCalibra1.calibratorLabel.setText(str(dado[1].split()[0])+" mV") self.ui.calibratorLabel.setText(str(dado[1].split()[0])+" mV")
pass pass
except IndexError: except IndexError:
print("Erro no Indice do Array Enviado pela Serial") print("Erro no Indice do Array Enviado pela Serial")
...@@ -143,11 +148,11 @@ class SystemEngine(object): ...@@ -143,11 +148,11 @@ class SystemEngine(object):
def updateScale(self): def updateScale(self):
try: try:
self.x_scale = int(self.uiCalibra1.t_max.text()) self.x_scale = int(self.ui.t_max.text())
self.y_min[0] = int(self.uiCalibra1.f_min.text()) self.y_min[0] = int(self.ui.f_min.text())
self.y_max[0] = int(self.uiCalibra1.f_max.text()) self.y_max[0] = int(self.ui.f_max.text())
self.y_min[1] = int(self.uiCalibra1.p_min.text()) self.y_min[1] = int(self.ui.p_min.text())
self.y_max[1] = int(self.uiCalibra1.p_max.text()) self.y_max[1] = int(self.ui.p_max.text())
except ValueError: except ValueError:
self.x_scale = 100 self.x_scale = 100
self.y_min[0] = 0 self.y_min[0] = 0
...@@ -168,7 +173,7 @@ class SystemEngine(object): ...@@ -168,7 +173,7 @@ class SystemEngine(object):
self.scene.focusItem() self.scene.focusItem()
def updateTimer(self): def updateTimer(self):
self.time=self.uiCalibra1.samplingCBox.currentText().split(" ") self.time=self.ui.samplingCBox.currentText().split(" ")
self.time[0]=int(self.time[0]) self.time[0]=int(self.time[0])
print(self.time[0]) print(self.time[0])
if(self.time[0]<100): if(self.time[0]<100):
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from InterfaceTimer import InterfaceTimer from InterfaceTimer import InterfaceTimer
class Ui_MainWindow(InterfaceTimer): class TempCalib(InterfaceTimer):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
self.MainWindow = MainWindow self.MainWindow = MainWindow
MainWindow.setObjectName("MainWindow") MainWindow.setObjectName("MainWindow")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment