LiquidGUI [1.1.0.1]

- Added support for minimum and maximum temperatures.
- Corrected typo in Calibri font name.
- UI tweaks.
This commit is contained in:
2024-07-13 21:30:28 +01:00
parent 5fab490885
commit 11b812cd37
5 changed files with 50 additions and 16 deletions
+20
View File
@@ -0,0 +1,20 @@
class MinMaxCurrent:
def __init__(self):
self.min = 0
self.max = 0
self.cur = 0
def builder(self, _cur: int, _unit: str):
self.cur = _cur
if 0 in [self.max, self.min]:
self.max = _cur
self.min = _cur
if self.cur > self.max:
self.max = _cur
if self.cur < self.min:
self.min = _cur
return f"Current: {self.cur}{_unit}\n(Min: {self.min}{_unit} / Max: {self.max}{_unit})"
+24 -12
View File
@@ -1,44 +1,50 @@
# External Dependencies
import sys import sys
import win32mica import win32mica
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
# Internal Imports
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.SubLabel import SubLabel
from styles.SubLabelValue import SubLabelValue from styles.SubLabelValue import SubLabelValue
import common
import resources, pkg_resources.extern
class MainWindow(QMainWindow): class MainWindow(QMainWindow):
""" Main application window. """ """ 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.2)") self.setWindowTitle("LiquidGUI (v.1.1.0.1)")
self.setFixedSize(450, 385) self.setFixedSize(450, 400)
self.lctl = lctl self.lctl = lctl
# Widgets ########################################## # Widgets ##########################################
self.lbl_device_name = QLabel(font=QFont("Calibre", self.lbl_device_name = QLabel(font=QFont("Calibri",
14, 18,
weight=QFont.Weight.Bold), weight=QFont.Weight.Bold),
alignment=Qt.AlignmentFlag.AlignCenter) alignment=Qt.AlignmentFlag.AlignCenter)
self.lbl_temp = SubLabel(value="💧 Liquid Temperature:") self.lbl_temp = SubLabel(value="💧 Liquid Temperature:")
self.min_max_cur_temp = common.MinMaxCurrent()
self.prg_temp = QProgressBar(textVisible=False, self.prg_temp = QProgressBar(textVisible=False,
minimum=0, minimum=0,
maximum=50) maximum=50)
self.lbl_value_prg_temp = SubLabelValue() self.lbl_value_prg_temp = SubLabelValue()
self.lbl_fanspeed = SubLabel(value="🍃 Fan Speed:") self.lbl_fanspeed = SubLabel(value="🍃 Fan Speed:")
self.min_max_cur_fanspeed = common.MinMaxCurrent()
self.prg_fanspeed = QProgressBar(textVisible=False, self.prg_fanspeed = QProgressBar(textVisible=False,
minimum=520, minimum=520,
maximum=1700) maximum=1700)
self.lbl_value_prg_fanspeed = SubLabelValue() self.lbl_value_prg_fanspeed = SubLabelValue()
self.lbl_pumpspeed = SubLabel(value="⛽ Pump Speed:") self.lbl_pumpspeed = SubLabel(value="⛽ Pump Speed:")
self.min_max_cur_pumpspeed = common.MinMaxCurrent()
self.prg_pumpspeed = QProgressBar(textVisible=False, self.prg_pumpspeed = QProgressBar(textVisible=False,
minimum=1900, minimum=1900,
maximum=2700) maximum=2700)
@@ -77,13 +83,19 @@ class MainWindow(QMainWindow):
def update_widgets(self): def update_widgets(self):
""" Update widgets using LiquidCTL library.""" """ Update widgets using LiquidCTL library."""
self.lbl_device_name.setText("- " + self.lctl.device_name + " -") 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_value_prg_temp.setText(str(self.lctl.device_temp) + "°C") self.lbl_value_prg_temp.setText(
self.min_max_cur_temp.builder(
self.lctl.device_temp, "°C"))
self.prg_fanspeed.setValue(self.lctl.device_fanSpeed) self.prg_fanspeed.setValue(self.lctl.device_fanSpeed)
self.lbl_value_prg_fanspeed.setText(str(self.lctl.device_fanSpeed) + " rpm") self.lbl_value_prg_fanspeed.setText(
self.min_max_cur_fanspeed.builder(
self.lctl.device_fanSpeed, " rpm"))
self.prg_pumpspeed.setValue(self.lctl.device_pumpSpeed) self.prg_pumpspeed.setValue(self.lctl.device_pumpSpeed)
self.lbl_value_prg_pumpspeed.setText(str(self.lctl.device_pumpSpeed) + " rpm") self.lbl_value_prg_pumpspeed.setText(
self.min_max_cur_pumpspeed.builder(
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}")
+1 -1
View File
@@ -1,4 +1,4 @@
Version: 1.0.3.2 Version: 1.1.0.1
CompanyName: Fil Sapia CompanyName: Fil Sapia
FileDescription: LiquidGUI FileDescription: LiquidGUI
InternalName: LiquidGUI InternalName: LiquidGUI
+1 -1
View File
@@ -2621,7 +2621,7 @@ qt_resource_struct = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ \x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\x90f\x0b\xfe\xb4\ \x00\x00\x01\x90\x7f\xe4x\x0d\
" "
def qInitResources(): def qInitResources():
+4 -2
View File
@@ -1,9 +1,11 @@
from PySide6.QtWidgets import QLabel from PySide6.QtWidgets import QLabel
from PySide6.QtGui import QFont from PySide6.QtGui import QFont
class SubLabel(QLabel): class SubLabel(QLabel):
""" Formatting for sub-labels. """ """ Formatting for sub-labels. """
def __init__(self, value): def __init__(self, value):
super().__init__() super().__init__()
self.setFont(QFont("Calibre", 10, weight=QFont.Weight.Bold)) self.setFont(QFont("Calibri", 12, weight=QFont.Weight.Bold))
self.setText(value) self.setText(value)