From 50db5c740f8189cb3285aaa35b7020c3c68d3035 Mon Sep 17 00:00:00 2001 From: jens Date: Wed, 25 Nov 2020 11:03:10 +0100 Subject: [PATCH] - display heater power on LCD --- brewpi.ui | 489 +++++++++++++++++++++++++++++++++++++++++++++++--- brewpi_gui.py | 4 +- brewpi_win.py | 170 ++++++++++++++++-- 3 files changed, 619 insertions(+), 44 deletions(-) diff --git a/brewpi.ui b/brewpi.ui index 25c0f74..6e03d9e 100644 --- a/brewpi.ui +++ b/brewpi.ui @@ -967,30 +967,468 @@ - - - 4 + + + + 0 + 120 + - - - - - 0 - 0 - - - - - 0 - 0 - - - - 4 - - - - + + + + + + + 0 + 0 + 0 + + + + + + + 138 + 226 + 52 + + + + + + + 198 + 255 + 143 + + + + + + + 168 + 240 + 97 + + + + + + + 69 + 113 + 26 + + + + + + + 92 + 151 + 34 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 138 + 226 + 52 + + + + + + + 0 + 0 + 0 + + + + + + + 196 + 240 + 153 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 138 + 226 + 52 + + + + + + + 198 + 255 + 143 + + + + + + + 168 + 240 + 97 + + + + + + + 69 + 113 + 26 + + + + + + + 92 + 151 + 34 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 138 + 226 + 52 + + + + + + + 0 + 0 + 0 + + + + + + + 196 + 240 + 153 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 69 + 113 + 26 + + + + + + + 138 + 226 + 52 + + + + + + + 198 + 255 + 143 + + + + + + + 168 + 240 + 97 + + + + + + + 69 + 113 + 26 + + + + + + + 92 + 151 + 34 + + + + + + + 69 + 113 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 69 + 113 + 26 + + + + + + + 138 + 226 + 52 + + + + + + + 138 + 226 + 52 + + + + + + + 0 + 0 + 0 + + + + + + + 138 + 226 + 52 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + QFrame::Box + + + QFrame::Raised + + + false + + + 2037.000000000000000 + + @@ -1094,11 +1532,6 @@ - - QwtDial - QWidget -
qwt_dial.h
-
QwtSlider QWidget diff --git a/brewpi_gui.py b/brewpi_gui.py index e9961b6..9e109e4 100644 --- a/brewpi_gui.py +++ b/brewpi_gui.py @@ -42,13 +42,15 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow): async def on_pot_changed(self, msg): print("on_pot_changed {}".format(msg)) if "Power" in msg: - self.lcdNumber.display(msg['Power']) + self.lcdNumber_2.display(msg['Power']) async def on_sensor_changed(self, msg): print("on_sensor_changed {}".format(msg)) async def on_heater_changed(self, msg): print("on_heater_changed {}".format(msg)) + if "Power" in msg: + self.lcdNumber.display(msg['Power']) def closeEvent(self, event): print("Exitting gracefully!") diff --git a/brewpi_win.py b/brewpi_win.py index 233b171..23e004b 100644 --- a/brewpi_win.py +++ b/brewpi_win.py @@ -337,20 +337,160 @@ class Ui_MainWindow(object): self.lcdNumber.setProperty("value", 2037.0) self.lcdNumber.setObjectName("lcdNumber") self.verticalLayout.addWidget(self.lcdNumber) - self.horizontalLayout_3 = QtWidgets.QHBoxLayout() - self.horizontalLayout_3.setSpacing(4) - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.Dial = QwtDial(self.horizontalTabWidgetPage1) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.Dial.sizePolicy().hasHeightForWidth()) - self.Dial.setSizePolicy(sizePolicy) - self.Dial.setMinimumSize(QtCore.QSize(0, 0)) - self.Dial.setLineWidth(4) - self.Dial.setObjectName("Dial") - self.horizontalLayout_3.addWidget(self.Dial) - self.verticalLayout.addLayout(self.horizontalLayout_3) + self.lcdNumber_2 = QtWidgets.QLCDNumber(self.horizontalTabWidgetPage1) + self.lcdNumber_2.setMinimumSize(QtCore.QSize(0, 120)) + palette = QtGui.QPalette() + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) + brush = QtGui.QBrush(QtGui.QColor(138, 226, 52)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) + brush = QtGui.QBrush(QtGui.QColor(198, 255, 143)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) + brush = QtGui.QBrush(QtGui.QColor(168, 240, 97)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) + brush = QtGui.QBrush(QtGui.QColor(69, 113, 26)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) + brush = QtGui.QBrush(QtGui.QColor(92, 151, 34)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(138, 226, 52)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush) + brush = QtGui.QBrush(QtGui.QColor(196, 240, 153)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.PlaceholderText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) + brush = QtGui.QBrush(QtGui.QColor(138, 226, 52)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) + brush = QtGui.QBrush(QtGui.QColor(198, 255, 143)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) + brush = QtGui.QBrush(QtGui.QColor(168, 240, 97)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) + brush = QtGui.QBrush(QtGui.QColor(69, 113, 26)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) + brush = QtGui.QBrush(QtGui.QColor(92, 151, 34)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(138, 226, 52)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush) + brush = QtGui.QBrush(QtGui.QColor(196, 240, 153)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush) + brush = QtGui.QBrush(QtGui.QColor(69, 113, 26)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) + brush = QtGui.QBrush(QtGui.QColor(138, 226, 52)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) + brush = QtGui.QBrush(QtGui.QColor(198, 255, 143)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) + brush = QtGui.QBrush(QtGui.QColor(168, 240, 97)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) + brush = QtGui.QBrush(QtGui.QColor(69, 113, 26)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) + brush = QtGui.QBrush(QtGui.QColor(92, 151, 34)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) + brush = QtGui.QBrush(QtGui.QColor(69, 113, 26)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush) + brush = QtGui.QBrush(QtGui.QColor(69, 113, 26)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) + brush = QtGui.QBrush(QtGui.QColor(138, 226, 52)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(138, 226, 52)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush) + brush = QtGui.QBrush(QtGui.QColor(138, 226, 52)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.PlaceholderText, brush) + self.lcdNumber_2.setPalette(palette) + self.lcdNumber_2.setFrameShape(QtWidgets.QFrame.Box) + self.lcdNumber_2.setFrameShadow(QtWidgets.QFrame.Raised) + self.lcdNumber_2.setSmallDecimalPoint(False) + self.lcdNumber_2.setProperty("value", 2037.0) + self.lcdNumber_2.setObjectName("lcdNumber_2") + self.verticalLayout.addWidget(self.lcdNumber_2) self.horizontalLayout.addLayout(self.verticalLayout) self.horizontalTabWidget.addTab(self.horizontalTabWidgetPage1, "") self.tab = QtWidgets.QWidget() @@ -363,7 +503,7 @@ class Ui_MainWindow(object): self.Thermo.setGeometry(QtCore.QRect(890, 50, 56, 201)) self.Thermo.setObjectName("Thermo") self.Slider = QwtSlider(self.centralwidget) - self.Slider.setGeometry(QtCore.QRect(440, 110, 63, 250)) + self.Slider.setGeometry(QtCore.QRect(390, 90, 63, 250)) self.Slider.setObjectName("Slider") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow)