Commit c52fd2bd authored by Pedro Henrique Kopper's avatar Pedro Henrique Kopper

Initial commit

parents
.vscode
\ No newline at end of file
{
"python.pythonPath": "/home/phckopper/.local/share/virtualenvs/Processamento-UQ7p_2mK/bin/python"
}
\ No newline at end of file
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
pylint = "*"
[packages]
sacada-python = "*"
pyqtgraph = "*"
pyqt5 = "*"
[requires]
python_version = "3.8"
This diff is collapsed.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Classe Main (Principal) #
# Autores: Pedro Henrique Kopper (pedro.kopper@ufrgs.br) -> https://lief.if.ufrgs.br/~phckopper #
# Licença: GNU GPLv2 #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import sys
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import QTimer
from util.Graph import Graph
from ui.MainWindow import Ui_MainWindow
UPDATE_INTERVAL = 250 # milisegundos
class App(object):
def __init__(self):
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True) #enable highdpi scaling
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True) #use highdpi icons
self.app = QtWidgets.QApplication(sys.argv)
self.mainWindow = QtWidgets.QMainWindow()
self.dialog = QtWidgets.QDialog(self.mainWindow)
self.timer = QTimer(self.app)
self.running = False
self.elapsedTime = 0
self.ui = Ui_MainWindow()
self.ui.setupUi(self.mainWindow)
self.setupConnections()
self.pressurePlot = Graph(self.ui.pressaoGraph, "Pressão", "bar")
self.temperaturaPlot = Graph(self.ui.temperaturaGraph, "Temperatura", "ºC")
self.mainWindow.showMaximized()
def setupConnections(self):
self.ui.controlBtn.clicked.connect(self.startStop)
self.timer.timeout.connect(self.updateData)
def startStop(self):
if self.running:
self.timer.stop()
self.running = False
self.ui.controlBtn.setText("COMEÇAR")
else:
self.timer.start()
self.running = True
self.ui.controlBtn.setText("PARAR")
def updateData(self):
self.elapsedTime += UPDATE_INTERVAL * 0.001
if __name__ == '__main__':
app = App()
sys.exit(app.app.exec_())
\ No newline at end of file
# Software para processamento de materiais em altas pressões
Este software é uma reescrita da interface do SADAPMAP para uso nos processamentos, e não nas calibrações.
Ele visa ter um código mais limpo, porém menos genérico, e ser base para futuros desenvolvimentos no SADAPMAP.
A ideia é ter bases de código separadas para o SACADA e para o SADAPMAP, visto que seus objetivos muitas vezes conflitam e acabam
levando a soluções inadequadas pros problemas, vide a interface e seu código spaghetti.
# Instalação
Assim como o software original, este software também faz uso do pipenv, ferramenta padrão de ambientes virtuais do Python3. Ela pode ser encontrada no pacote `python3-pip` na maioria das distribuições. É importante frisar que este software suporta _apenas_ Python 3.
Ao clonar o repositório, basta rodar `pipenv install` para baixar e instalar as dependências automaticamente.
# Licença
Este programa é um software livre; você pode redistribuí-lo e/ou
modificá-lo sob os termos da Licença Pública Geral GNU como publicada
pela Free Software Foundation; na versão 3 da Licença, ou
(a seu critério) qualquer versão posterior.
Este programa é distribuído na esperança de que possa ser útil,
mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO
a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a
Licença Pública Geral GNU para mais detalhes.
Uma cópia da licença (em inglês) está disponível no arquivo LICENSE.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>961</width>
<height>583</height>
</rect>
</property>
<property name="windowTitle">
<string>SADAPMAP - Processamento</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="centralwidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="1,2">
<item row="0" column="0">
<layout class="QVBoxLayout" name="esquerda" stretch="1,2">
<item>
<layout class="QVBoxLayout" name="botoes" stretch="2,1">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>../logo.jpg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="controlBtn">
<property name="text">
<string>COMEÇAR</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="configuracoes">
<item row="0" column="0">
<widget class="QLabel" name="amostraLabel">
<property name="text">
<string>Amostra</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="amostraLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="pressaoLabel">
<property name="text">
<string>Pressão</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="pressaoLineEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="temperaturaLabel">
<property name="text">
<string>Temperatura</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="temperaturaLineEdit"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="gaxetaLabel">
<property name="text">
<string>Gaxeta</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="gaxetaLineEdit"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="configuracaoLabel">
<property name="text">
<string>Configuração</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="configuracaoLineEdit"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="observacoesLabel">
<property name="text">
<string>Observações</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="graficos" stretch="1,3,3">
<item>
<widget class="QLabel" name="infos">
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>36</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>1250ºC | 127 bar | 00:00:00</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="PlotWidget" name="pressaoGraph" native="true"/>
</item>
<item>
<widget class="PlotWidget" name="temperaturaGraph" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>PlotWidget</class>
<extends>QWidget</extends>
<header>pyqtgraph</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'resources/ui/MainWindow.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(961, 583)
MainWindow.setStyleSheet("")
self.centralwidget = QtWidgets.QWidget(MainWindow)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth())
self.centralwidget.setSizePolicy(sizePolicy)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.esquerda = QtWidgets.QVBoxLayout()
self.esquerda.setObjectName("esquerda")
self.botoes = QtWidgets.QVBoxLayout()
self.botoes.setObjectName("botoes")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setText("")
self.label.setPixmap(QtGui.QPixmap("resources/ui/../logo.jpg"))
self.label.setScaledContents(True)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.botoes.addWidget(self.label)
self.controlBtn = QtWidgets.QPushButton(self.centralwidget)
self.controlBtn.setObjectName("controlBtn")
self.botoes.addWidget(self.controlBtn)
self.botoes.setStretch(0, 2)
self.botoes.setStretch(1, 1)
self.esquerda.addLayout(self.botoes)
self.configuracoes = QtWidgets.QFormLayout()
self.configuracoes.setObjectName("configuracoes")
self.amostraLabel = QtWidgets.QLabel(self.centralwidget)
self.amostraLabel.setObjectName("amostraLabel")
self.configuracoes.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.amostraLabel)
self.amostraLineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.amostraLineEdit.setObjectName("amostraLineEdit")
self.configuracoes.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.amostraLineEdit)
self.pressaoLabel = QtWidgets.QLabel(self.centralwidget)
self.pressaoLabel.setObjectName("pressaoLabel")
self.configuracoes.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pressaoLabel)
self.pressaoLineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.pressaoLineEdit.setObjectName("pressaoLineEdit")
self.configuracoes.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.pressaoLineEdit)
self.temperaturaLabel = QtWidgets.QLabel(self.centralwidget)
self.temperaturaLabel.setObjectName("temperaturaLabel")
self.configuracoes.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.temperaturaLabel)
self.temperaturaLineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.temperaturaLineEdit.setObjectName("temperaturaLineEdit")
self.configuracoes.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.temperaturaLineEdit)
self.gaxetaLabel = QtWidgets.QLabel(self.centralwidget)
self.gaxetaLabel.setObjectName("gaxetaLabel")
self.configuracoes.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.gaxetaLabel)
self.gaxetaLineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.gaxetaLineEdit.setObjectName("gaxetaLineEdit")
self.configuracoes.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.gaxetaLineEdit)
self.configuracaoLabel = QtWidgets.QLabel(self.centralwidget)
self.configuracaoLabel.setObjectName("configuracaoLabel")
self.configuracoes.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.configuracaoLabel)
self.configuracaoLineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.configuracaoLineEdit.setObjectName("configuracaoLineEdit")
self.configuracoes.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.configuracaoLineEdit)
self.observacoesLabel = QtWidgets.QLabel(self.centralwidget)
self.observacoesLabel.setObjectName("observacoesLabel")
self.configuracoes.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.observacoesLabel)
self.plainTextEdit = QtWidgets.QPlainTextEdit(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.plainTextEdit.sizePolicy().hasHeightForWidth())
self.plainTextEdit.setSizePolicy(sizePolicy)
self.plainTextEdit.setObjectName("plainTextEdit")
self.configuracoes.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.plainTextEdit)
self.esquerda.addLayout(self.configuracoes)
self.esquerda.setStretch(0, 1)
self.esquerda.setStretch(1, 2)
self.gridLayout.addLayout(self.esquerda, 0, 0, 1, 1)
self.graficos = QtWidgets.QVBoxLayout()
self.graficos.setObjectName("graficos")
self.infos = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setFamily("Liberation Mono")
font.setPointSize(36)
font.setBold(True)
font.setItalic(False)
font.setWeight(75)
self.infos.setFont(font)
self.infos.setAlignment(QtCore.Qt.AlignCenter)
self.infos.setWordWrap(True)
self.infos.setObjectName("infos")
self.graficos.addWidget(self.infos)
self.pressaoGraph = PlotWidget(self.centralwidget)
self.pressaoGraph.setObjectName("pressaoGraph")
self.graficos.addWidget(self.pressaoGraph)
self.temperaturaGraph = PlotWidget(self.centralwidget)
self.temperaturaGraph.setObjectName("temperaturaGraph")
self.graficos.addWidget(self.temperaturaGraph)
self.graficos.setStretch(0, 1)
self.graficos.setStretch(1, 3)
self.graficos.setStretch(2, 3)
self.gridLayout.addLayout(self.graficos, 0, 1, 1, 1)
self.gridLayout.setColumnStretch(0, 1)
self.gridLayout.setColumnStretch(1, 2)
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 - Processamento"))
self.controlBtn.setText(_translate("MainWindow", "COMEÇAR"))
self.amostraLabel.setText(_translate("MainWindow", "Amostra"))
self.pressaoLabel.setText(_translate("MainWindow", "Pressão"))
self.temperaturaLabel.setText(_translate("MainWindow", "Temperatura"))
self.gaxetaLabel.setText(_translate("MainWindow", "Gaxeta"))
self.configuracaoLabel.setText(_translate("MainWindow", "Configuração"))
self.observacoesLabel.setText(_translate("MainWindow", "Observações"))
self.infos.setText(_translate("MainWindow", "1250ºC | 127 bar | 00:00:00"))
from pyqtgraph import PlotWidget
from pyqtgraph import mkColor, mkPen
class Graph(object):
def __init__(self, graph, name, units):
self.graph = graph
self.plot = graph.plot(pen=mkPen(mkColor("#FF0000"), width=2))
self.dataX = []
self.dataY = []
self.setupGraphics(name, units)
def setupGraphics(self, name, units):
self.graph.setBackground((240, 240, 240))
self.graph.setClipToView(True)
self.graph.showGrid(True)
self.graph.getViewBox().enableAutoRange(self.graph.getPlotItem().getViewBox().YAxis)
self.graph.setLabel("left", text=name, units=units)
self.graph.setLabel("bottom", text="Tempo", units="s")
self.graph.getViewBox().setMouseEnabled(False, False) # Previne uso do mouse para controle do zoom
self.graph.setMenuEnabled(False)
def addPoint(self, point):
x, y = point
self.dataX.append(x)
self.dataY.append(y)
self.plot.setData(self.dataX, self.dataY)
\ No newline at end of file
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