LiquidGUI [1.1.0.0] Dev

- Initial Linux support.
This commit is contained in:
2024-07-07 16:41:50 +01:00
parent 5fab490885
commit 495de03e39
6 changed files with 53 additions and 47 deletions
+20 -17
View File
@@ -1,11 +1,12 @@
from liquidctl import find_liquidctl_devices, cli
class LiquidCTL_Helper():
device_name = None
device_temp = 0
device_fanSpeed = 0
device_pumpSpeed = 0
device_fwVers = None
device_name = None
device_temp = 0
device_fanSpeed = 0
device_pumpSpeed = 0
device_fwVers = None
device_connect_error = False
devices = find_liquidctl_devices()
try:
@@ -14,8 +15,9 @@ class LiquidCTL_Helper():
#print(f'{dev.description}')
device_name = dev.description
device_fwVers = ''.join(map(str, dev.firmware_version))
except:
pass
except OSError:
print("ERROR: Connecting to LiquidCTL device!")
device_connect_error = True
def ForceInit(self):
init_status = self.dev.initialize()
@@ -31,16 +33,17 @@ class LiquidCTL_Helper():
return True
def Update(self):
with self.dev.connect():
status = self.dev.get_status()
for key, value, unit in status:
#print(f'- {key}: {value} {unit}')
if key == "Liquid temperature":
self.device_temp = value
elif key == "Fan speed":
self.device_fanSpeed = value
elif key == "Pump speed":
self.device_pumpSpeed = value
if self.device_connect_error == False:
with self.dev.connect():
status = self.dev.get_status()
for key, value, unit in status:
#print(f'- {key}: {value} {unit}')
if key == "Liquid temperature":
self.device_temp = value
elif key == "Fan speed":
self.device_fanSpeed = value
elif key == "Pump speed":
self.device_pumpSpeed = value
def SetFanSpeed(self, speed):
with self.dev.connect():
+1 -1
View File
@@ -1,4 +1,4 @@
from PySide6.QtWidgets import QMessageBox
from PyQt6.QtWidgets import QMessageBox
@staticmethod
class MessageHandler():
+26 -23
View File
@@ -1,24 +1,22 @@
import sys
import win32mica
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QProgressBar
from PySide6.QtCore import Qt, QTimer, QThreadPool
from PySide6.QtGui import QFont, QIcon
from PyQt6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QProgressBar
from PyQt6.QtCore import Qt, QTimer, QThreadPool
from PyQt6.QtGui import QFont, QIcon
from LiquidCTL_Helper import LiquidCTL_Helper
from MessageHandler import MessageHandler
import resources, pkg_resources.extern
import resources
from styles.SubLabel import SubLabel
from styles.SubLabelValue import SubLabelValue
class MainWindow(QMainWindow):
""" Main application window. """
def __init__(self, lctl):
def __init__(self):
super(MainWindow, self).__init__()
self.setWindowTitle("LiquidGUI (v.1.0.3.2)")
self.setWindowTitle("LiquidGUI (v.1.1.0.0)")
self.setFixedSize(450, 385)
self.lctl = lctl
self.lctl = LiquidCTL_Helper()
# Widgets ##########################################
self.lbl_device_name = QLabel(font=QFont("Calibre",
@@ -62,7 +60,6 @@ class MainWindow(QMainWindow):
layout.addWidget(self.lbl_fwvers)
layout.setSpacing(10)
self.setLayout(layout)
self.setCentralWidget(widget)
self.setContentsMargins(20, 20, 20, 20)
@@ -77,15 +74,16 @@ class MainWindow(QMainWindow):
def update_widgets(self):
""" Update widgets using LiquidCTL library."""
self.lbl_device_name.setText("- " + self.lctl.device_name + " -")
self.prg_temp.setValue(self.lctl.device_temp)
self.lbl_value_prg_temp.setText(str(self.lctl.device_temp) + "°C")
self.prg_fanspeed.setValue(self.lctl.device_fanSpeed)
self.lbl_value_prg_fanspeed.setText(str(self.lctl.device_fanSpeed) + " rpm")
self.prg_pumpspeed.setValue(self.lctl.device_pumpSpeed)
self.lbl_value_prg_pumpspeed.setText(str(self.lctl.device_pumpSpeed) + " rpm")
if self.lctl.device_fwVers is not None:
self.lbl_fwvers.setText(f"Firmware: v{self.lctl.device_fwVers}")
if self.lctl.device_name != None:
self.lbl_device_name.setText("- " + self.lctl.device_name + " -")
self.prg_temp.setValue(int(self.lctl.device_temp))
self.lbl_value_prg_temp.setText(str(self.lctl.device_temp) + "°C")
self.prg_fanspeed.setValue(self.lctl.device_fanSpeed)
self.lbl_value_prg_fanspeed.setText(str(self.lctl.device_fanSpeed) + " rpm")
self.prg_pumpspeed.setValue(self.lctl.device_pumpSpeed)
self.lbl_value_prg_pumpspeed.setText(str(self.lctl.device_pumpSpeed) + " rpm")
if self.lctl.device_fwVers is not None:
self.lbl_fwvers.setText(f"Firmware: v{self.lctl.device_fwVers}")
def main():
@@ -94,18 +92,23 @@ def main():
icon = QIcon(":/icons/LiquidGUI.ico")
app.setWindowIcon(icon)
window = MainWindow(LiquidCTL_Helper())
window = MainWindow()
window.setWindowIcon(icon)
window.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
# Show error and quit app if no devices are found
if window.lctl.TestConnectionState():
MessageHandler().ShowNoDevicesFoundError()
sys.exit(1)
else:
win32mica.ApplyMica(window.winId(), win32mica.MICAMODE.DARK)
try:
import win32mica
win32mica.ApplyMica(window.winId(), win32mica.MICAMODE.DARK)
window.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
except ImportError as e:
print(f"ERROR: Unable to import {e.name}")
window.show()
app.setStyle("Breeze")
app.exec()
+1 -1
View File
@@ -3,7 +3,7 @@
# Created by: The Resource Compiler for Qt version 6.7.2
# WARNING! All changes made in this file will be lost!
from PySide6 import QtCore
from PyQt6 import QtCore
qt_resource_data = b"\
\x00\x00\xa2\x14\
+2 -2
View File
@@ -1,5 +1,5 @@
from PySide6.QtWidgets import QLabel
from PySide6.QtGui import QFont
from PyQt6.QtWidgets import QLabel
from PyQt6.QtGui import QFont
class SubLabel(QLabel):
""" Formatting for sub-labels. """
+3 -3
View File
@@ -1,6 +1,6 @@
from PySide6.QtWidgets import QLabel
from PySide6.QtGui import QFont
from PySide6.QtCore import Qt
from PyQt6.QtWidgets import QLabel
from PyQt6.QtGui import QFont
from PyQt6.QtCore import Qt
class SubLabelValue(QLabel):
""" Formatting for values. """