Commit 41a19cda authored by Pedro Henrique Kopper's avatar Pedro Henrique Kopper

Resolver problemas de UI

parent 60fcb31e
......@@ -14,7 +14,7 @@ class SACADA(object):
def read(self, channel):
if channel["id"] == "TC":
try:
return self.s.readTemperature(channel["tc"], channel["type"])
return self.s.readTemperature("A0", channel["type"])
except:
# Should handle value errors better
return 0
......
......@@ -194,7 +194,71 @@ QGroupBox {
</layout>
</widget>
</item>
<item row="3" column="1" colspan="2">
<item row="3" column="4">
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>false</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>930</width>
<height>200</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="1">
<widget class="QLabel" name="consoleView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">padding: 2px;
border: 2px solid rgb(5, 5, 5);
font: 10pt &quot;Liberation Mono&quot;;</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QGroupBox" name="samplingBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
......@@ -355,70 +419,6 @@ QGroupBox {
</layout>
</widget>
</item>
<item row="3" column="3" colspan="2">
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>false</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>930</width>
<height>200</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="1">
<widget class="QLabel" name="consoleView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">padding: 2px;
border: 2px solid rgb(5, 5, 5);
font: 10pt &quot;Liberation Mono&quot;;</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
......
# Este arquivo define a interface a ser utilizada
device:
type: mock
location: "/dev/ttyACM0"
channels:
- id: "TC"
name: "Temperatura"
color: "#FF0000"
unit: "ºC"
- id: "PWR"
name: "Potência"
color: "#0000FF"
unit: "W"
......@@ -98,6 +98,11 @@ class Graph():
plotItem.setLabel("left", text=channel["name"], units=channel["unit"])
self.logger("[GRAPH]", "Added channel {}".format(channel["name"]))
self.logFile.write("{},".format(channel["name"]))
self.ui.min_amostra.setSuffix(self.device["channels"][0]["unit"])
self.ui.min_pressao.setSuffix(self.device["channels"][1]["unit"])
self.ui.max_amostra.setSuffix(self.device["channels"][0]["unit"])
self.ui.max_pressao.setSuffix(self.device["channels"][1]["unit"])
self.logFile.write("timestamp")
......@@ -109,8 +114,8 @@ class Graph():
self.combinedPlot.setClipToView(True)
self.combinedPlot.showGrid(True)
self.combinedPlot.getViewBox().enableAutoRange(plotItem.getViewBox().YAxis)
self.combinedPlot.setLabel("left", text="Amostra", units="V")
self.combinedPlot.setLabel("bottom", text="Pressão", units="bar")
self.combinedPlot.setLabel("left", text=self.device["channels"][0]["name"], units=self.device["channels"][0]["unit"])
self.combinedPlot.setLabel("bottom", text=self.device["channels"][1]["name"], units=self.device["channels"][1]["unit"])
self.combinedPlot.getViewBox().setMouseEnabled(False, False) # Previne uso do mouse para controle do zoom
self.combinedPlot.setMenuEnabled(False) # Previne acesso ao menu do pyqtgraph pelos usuários
qGraphicsGridLayout = self.debugLayout.layout
......
......@@ -126,6 +126,45 @@ class Ui_Generico(object):
self.horizontalLayout_2.addWidget(self.forceLabel, 0, QtCore.Qt.AlignRight)
self.verticalLayout.addWidget(self.forceGBox)
self.gridLayout_2.addWidget(self.absValGBox, 3, 0, 1, 1)
self.scrollArea = QtWidgets.QScrollArea(self.widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth())
self.scrollArea.setSizePolicy(sizePolicy)
self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.scrollArea.setWidgetResizable(False)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 930, 200))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.scrollAreaWidgetContents.sizePolicy().hasHeightForWidth())
self.scrollAreaWidgetContents.setSizePolicy(sizePolicy)
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.gridLayout_7 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents)
self.gridLayout_7.setContentsMargins(11, 11, 11, 11)
self.gridLayout_7.setSpacing(6)
self.gridLayout_7.setObjectName("gridLayout_7")
self.consoleView = QtWidgets.QLabel(self.scrollAreaWidgetContents)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.consoleView.sizePolicy().hasHeightForWidth())
self.consoleView.setSizePolicy(sizePolicy)
self.consoleView.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
self.consoleView.setStyleSheet("padding: 2px;\n"
"border: 2px solid rgb(5, 5, 5);\n"
"font: 10pt \"Liberation Mono\";")
self.consoleView.setText("")
self.consoleView.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.consoleView.setWordWrap(True)
self.consoleView.setObjectName("consoleView")
self.gridLayout_7.addWidget(self.consoleView, 0, 1, 1, 1)
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.gridLayout_2.addWidget(self.scrollArea, 3, 4, 1, 1)
self.samplingBox = QtWidgets.QGroupBox(self.widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
......@@ -192,46 +231,7 @@ class Ui_Generico(object):
self.max_pressao.setObjectName("max_pressao")
self.grid.addWidget(self.max_pressao, 1, 1, 1, 1)
self.verticalLayout_3.addWidget(self.scaleGBox)
self.gridLayout_2.addWidget(self.samplingBox, 3, 1, 1, 2)
self.scrollArea = QtWidgets.QScrollArea(self.widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth())
self.scrollArea.setSizePolicy(sizePolicy)
self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.scrollArea.setWidgetResizable(False)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 930, 200))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.scrollAreaWidgetContents.sizePolicy().hasHeightForWidth())
self.scrollAreaWidgetContents.setSizePolicy(sizePolicy)
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.gridLayout_7 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents)
self.gridLayout_7.setContentsMargins(11, 11, 11, 11)
self.gridLayout_7.setSpacing(6)
self.gridLayout_7.setObjectName("gridLayout_7")
self.consoleView = QtWidgets.QLabel(self.scrollAreaWidgetContents)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.consoleView.sizePolicy().hasHeightForWidth())
self.consoleView.setSizePolicy(sizePolicy)
self.consoleView.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
self.consoleView.setStyleSheet("padding: 2px;\n"
"border: 2px solid rgb(5, 5, 5);\n"
"font: 10pt \"Liberation Mono\";")
self.consoleView.setText("")
self.consoleView.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.consoleView.setWordWrap(True)
self.consoleView.setObjectName("consoleView")
self.gridLayout_7.addWidget(self.consoleView, 0, 1, 1, 1)
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.gridLayout_2.addWidget(self.scrollArea, 3, 3, 1, 2)
self.gridLayout_2.addWidget(self.samplingBox, 3, 1, 1, 3)
self.gridLayout_2.setColumnStretch(0, 1)
self.gridLayout_2.setColumnStretch(1, 1)
self.gridLayout_2.setColumnStretch(2, 1)
......
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