LiquidGUI [1.0.3.2] Release
- Refactored some code. - Corrected fonts and updated styles.
This commit is contained in:
@@ -1,46 +1,50 @@
|
|||||||
import sys
|
import sys
|
||||||
import win32mica
|
import win32mica
|
||||||
import resources, pkg_resources.extern
|
|
||||||
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QProgressBar
|
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QProgressBar
|
||||||
from PySide6.QtCore import Qt, QTimer, QThreadPool
|
from PySide6.QtCore import Qt, QTimer, QThreadPool
|
||||||
from PySide6.QtGui import QFont, QIcon
|
from PySide6.QtGui import QFont, QIcon
|
||||||
from LiquidCTL_Helper import LiquidCTL_Helper
|
from LiquidCTL_Helper import LiquidCTL_Helper
|
||||||
from MessageHandler import MessageHandler
|
from MessageHandler import MessageHandler
|
||||||
|
import resources, pkg_resources.extern
|
||||||
|
from styles.SubLabel import SubLabel
|
||||||
|
from styles.SubLabelValue import SubLabelValue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MainWindow(QMainWindow):
|
class MainWindow(QMainWindow):
|
||||||
|
""" Main application window. """
|
||||||
def __init__(self, lctl):
|
def __init__(self, lctl):
|
||||||
super(MainWindow, self).__init__()
|
super(MainWindow, self).__init__()
|
||||||
self.setWindowTitle("LiquidGUI (v.1.0.3.0)")
|
self.setWindowTitle("LiquidGUI (v.1.0.3.2)")
|
||||||
self.setFixedSize(450, 385)
|
self.setFixedSize(450, 385)
|
||||||
|
|
||||||
self.lctl = lctl
|
self.lctl = lctl
|
||||||
|
|
||||||
# Widgets Style ####################################
|
|
||||||
lbl_style = QFont("Calibri", 12, weight=QFont.Weight.Bold)
|
|
||||||
lbl_align = Qt.AlignmentFlag.AlignCenter
|
|
||||||
|
|
||||||
# Widgets ##########################################
|
# Widgets ##########################################
|
||||||
self.lbl_device_name = QLabel(font=QFont("Calibri", 16, weight=QFont.Weight.Bold))
|
self.lbl_device_name = QLabel(font=QFont("Calibre",
|
||||||
self.lbl_temp = QLabel("💧 Liquid Temperature:",
|
14,
|
||||||
font=lbl_style)
|
weight=QFont.Weight.Bold),
|
||||||
|
alignment=Qt.AlignmentFlag.AlignCenter)
|
||||||
|
|
||||||
|
self.lbl_temp = SubLabel(value="💧 Liquid Temperature:")
|
||||||
self.prg_temp = QProgressBar(textVisible=False,
|
self.prg_temp = QProgressBar(textVisible=False,
|
||||||
minimum=0,
|
minimum=0,
|
||||||
maximum=50)
|
maximum=50)
|
||||||
self.lbl_prg_temp = QLabel(alignment=lbl_align)
|
self.lbl_value_prg_temp = SubLabelValue()
|
||||||
self.lbl_fanSpeed = QLabel("🍃 Fan Speed:",
|
|
||||||
font=lbl_style)
|
self.lbl_fanspeed = SubLabel(value="🍃 Fan Speed:")
|
||||||
self.prg_fanSpeed = QProgressBar(textVisible=False,
|
self.prg_fanspeed = QProgressBar(textVisible=False,
|
||||||
minimum=520,
|
minimum=520,
|
||||||
maximum=1700)
|
maximum=1700)
|
||||||
self.lbl_prg_fanSpeed = QLabel(alignment=lbl_align)
|
self.lbl_value_prg_fanspeed = SubLabelValue()
|
||||||
self.lbl_pumpSpeed = QLabel("⛽ Pump Speed:",
|
|
||||||
font=lbl_style)
|
self.lbl_pumpspeed = SubLabel(value="⛽ Pump Speed:")
|
||||||
self.prg_pumpSpeed = QProgressBar(textVisible=False,
|
self.prg_pumpspeed = QProgressBar(textVisible=False,
|
||||||
minimum=1900,
|
minimum=1900,
|
||||||
maximum=2700)
|
maximum=2700)
|
||||||
self.lbl_prg_pumpSpeed = QLabel(alignment=lbl_align)
|
self.lbl_value_prg_pumpspeed = SubLabelValue()
|
||||||
self.lbl_fwVers = QLabel(alignment=Qt.AlignmentFlag.AlignRight)
|
|
||||||
|
self.lbl_fwvers = SubLabelValue()
|
||||||
|
|
||||||
# Layout ##########################################
|
# Layout ##########################################
|
||||||
widget = QWidget(self)
|
widget = QWidget(self)
|
||||||
@@ -48,14 +52,14 @@ class MainWindow(QMainWindow):
|
|||||||
layout.addWidget(self.lbl_device_name)
|
layout.addWidget(self.lbl_device_name)
|
||||||
layout.addWidget(self.lbl_temp)
|
layout.addWidget(self.lbl_temp)
|
||||||
layout.addWidget(self.prg_temp)
|
layout.addWidget(self.prg_temp)
|
||||||
layout.addWidget(self.lbl_prg_temp)
|
layout.addWidget(self.lbl_value_prg_temp)
|
||||||
layout.addWidget(self.lbl_fanSpeed)
|
layout.addWidget(self.lbl_fanspeed)
|
||||||
layout.addWidget(self.prg_fanSpeed)
|
layout.addWidget(self.prg_fanspeed)
|
||||||
layout.addWidget(self.lbl_prg_fanSpeed)
|
layout.addWidget(self.lbl_value_prg_fanspeed)
|
||||||
layout.addWidget(self.lbl_pumpSpeed)
|
layout.addWidget(self.lbl_pumpspeed)
|
||||||
layout.addWidget(self.prg_pumpSpeed)
|
layout.addWidget(self.prg_pumpspeed)
|
||||||
layout.addWidget(self.lbl_prg_pumpSpeed)
|
layout.addWidget(self.lbl_value_prg_pumpspeed)
|
||||||
layout.addWidget(self.lbl_fwVers)
|
layout.addWidget(self.lbl_fwvers)
|
||||||
layout.setSpacing(10)
|
layout.setSpacing(10)
|
||||||
|
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
@@ -72,18 +76,20 @@ class MainWindow(QMainWindow):
|
|||||||
self.timer.start()
|
self.timer.start()
|
||||||
|
|
||||||
def update_widgets(self):
|
def update_widgets(self):
|
||||||
self.lbl_device_name.setText("- "+self.lctl.device_name+" -")
|
""" Update widgets using LiquidCTL library."""
|
||||||
|
self.lbl_device_name.setText("- " + self.lctl.device_name + " -")
|
||||||
self.prg_temp.setValue(self.lctl.device_temp)
|
self.prg_temp.setValue(self.lctl.device_temp)
|
||||||
self.lbl_prg_temp.setText(str(self.lctl.device_temp)+"°C")
|
self.lbl_value_prg_temp.setText(str(self.lctl.device_temp) + "°C")
|
||||||
self.prg_fanSpeed.setValue(self.lctl.device_fanSpeed)
|
self.prg_fanspeed.setValue(self.lctl.device_fanSpeed)
|
||||||
self.lbl_prg_fanSpeed.setText(str(self.lctl.device_fanSpeed)+" rpm")
|
self.lbl_value_prg_fanspeed.setText(str(self.lctl.device_fanSpeed) + " rpm")
|
||||||
self.prg_pumpSpeed.setValue(self.lctl.device_pumpSpeed)
|
self.prg_pumpspeed.setValue(self.lctl.device_pumpSpeed)
|
||||||
self.lbl_prg_pumpSpeed.setText(str(self.lctl.device_pumpSpeed)+" rpm")
|
self.lbl_value_prg_pumpspeed.setText(str(self.lctl.device_pumpSpeed) + " rpm")
|
||||||
if self.lctl.device_fwVers is not None:
|
if self.lctl.device_fwVers is not None:
|
||||||
self.lbl_fwVers.setText(f"Firmware: v{self.lctl.device_fwVers}")
|
self.lbl_fwvers.setText(f"Firmware: v{self.lctl.device_fwVers}")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
""" Initialize application and setup window parameters. """
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
icon = QIcon(":/icons/LiquidGUI.ico")
|
icon = QIcon(":/icons/LiquidGUI.ico")
|
||||||
app.setWindowIcon(icon)
|
app.setWindowIcon(icon)
|
||||||
@@ -93,7 +99,7 @@ def main():
|
|||||||
window.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
window.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
||||||
|
|
||||||
# Show error and quit app if no devices are found
|
# Show error and quit app if no devices are found
|
||||||
if window.lctl.TestConnectionState() == True:
|
if window.lctl.TestConnectionState():
|
||||||
MessageHandler().ShowNoDevicesFoundError()
|
MessageHandler().ShowNoDevicesFoundError()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,9 @@
|
|||||||
|
from PySide6.QtWidgets import QLabel
|
||||||
|
from PySide6.QtGui import QFont
|
||||||
|
|
||||||
|
class SubLabel(QLabel):
|
||||||
|
""" Formatting for sub-labels. """
|
||||||
|
def __init__(self, value):
|
||||||
|
super().__init__()
|
||||||
|
self.setFont(QFont("Calibre", 10, weight=QFont.Weight.Bold))
|
||||||
|
self.setText(value)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
from PySide6.QtWidgets import QLabel
|
||||||
|
from PySide6.QtGui import QFont
|
||||||
|
from PySide6.QtCore import Qt
|
||||||
|
|
||||||
|
class SubLabelValue(QLabel):
|
||||||
|
""" Formatting for values. """
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.setAlignment(Qt.AlignmentFlag.AlignRight)
|
||||||
|
self.setFont(QFont("Cascadia Code", 8))
|
||||||
Reference in New Issue
Block a user