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
+5 -2
View File
@@ -6,6 +6,7 @@ class LiquidCTL_Helper():
device_fanSpeed = 0 device_fanSpeed = 0
device_pumpSpeed = 0 device_pumpSpeed = 0
device_fwVers = None device_fwVers = None
device_connect_error = False
devices = find_liquidctl_devices() devices = find_liquidctl_devices()
try: try:
@@ -14,8 +15,9 @@ class LiquidCTL_Helper():
#print(f'{dev.description}') #print(f'{dev.description}')
device_name = dev.description device_name = dev.description
device_fwVers = ''.join(map(str, dev.firmware_version)) device_fwVers = ''.join(map(str, dev.firmware_version))
except: except OSError:
pass print("ERROR: Connecting to LiquidCTL device!")
device_connect_error = True
def ForceInit(self): def ForceInit(self):
init_status = self.dev.initialize() init_status = self.dev.initialize()
@@ -31,6 +33,7 @@ class LiquidCTL_Helper():
return True return True
def Update(self): def Update(self):
if self.device_connect_error == False:
with self.dev.connect(): with self.dev.connect():
status = self.dev.get_status() status = self.dev.get_status()
for key, value, unit in status: for key, value, unit in status:
+1 -1
View File
@@ -1,4 +1,4 @@
from PySide6.QtWidgets import QMessageBox from PyQt6.QtWidgets import QMessageBox
@staticmethod @staticmethod
class MessageHandler(): class MessageHandler():
+16 -13
View File
@@ -1,24 +1,22 @@
import sys import sys
import win32mica from PyQt6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QProgressBar
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QProgressBar from PyQt6.QtCore import Qt, QTimer, QThreadPool
from PySide6.QtCore import Qt, QTimer, QThreadPool from PyQt6.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 import resources
from styles.SubLabel import SubLabel from styles.SubLabel import SubLabel
from styles.SubLabelValue import SubLabelValue from styles.SubLabelValue import SubLabelValue
class MainWindow(QMainWindow): class MainWindow(QMainWindow):
""" Main application window. """ """ Main application window. """
def __init__(self, lctl): def __init__(self):
super(MainWindow, self).__init__() 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.setFixedSize(450, 385)
self.lctl = lctl self.lctl = LiquidCTL_Helper()
# Widgets ########################################## # Widgets ##########################################
self.lbl_device_name = QLabel(font=QFont("Calibre", self.lbl_device_name = QLabel(font=QFont("Calibre",
@@ -62,7 +60,6 @@ class MainWindow(QMainWindow):
layout.addWidget(self.lbl_fwvers) layout.addWidget(self.lbl_fwvers)
layout.setSpacing(10) layout.setSpacing(10)
self.setLayout(layout)
self.setCentralWidget(widget) self.setCentralWidget(widget)
self.setContentsMargins(20, 20, 20, 20) self.setContentsMargins(20, 20, 20, 20)
@@ -77,8 +74,9 @@ class MainWindow(QMainWindow):
def update_widgets(self): def update_widgets(self):
""" Update widgets using LiquidCTL library.""" """ Update widgets using LiquidCTL library."""
if self.lctl.device_name != None:
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(int(self.lctl.device_temp))
self.lbl_value_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_value_prg_fanspeed.setText(str(self.lctl.device_fanSpeed) + " rpm") self.lbl_value_prg_fanspeed.setText(str(self.lctl.device_fanSpeed) + " rpm")
@@ -94,18 +92,23 @@ def main():
icon = QIcon(":/icons/LiquidGUI.ico") icon = QIcon(":/icons/LiquidGUI.ico")
app.setWindowIcon(icon) app.setWindowIcon(icon)
window = MainWindow(LiquidCTL_Helper()) window = MainWindow()
window.setWindowIcon(icon) window.setWindowIcon(icon)
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(): if window.lctl.TestConnectionState():
MessageHandler().ShowNoDevicesFoundError() MessageHandler().ShowNoDevicesFoundError()
sys.exit(1) sys.exit(1)
else: else:
try:
import win32mica
win32mica.ApplyMica(window.winId(), win32mica.MICAMODE.DARK) 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() window.show()
app.setStyle("Breeze")
app.exec() app.exec()
+1 -1
View File
@@ -3,7 +3,7 @@
# Created by: The Resource Compiler for Qt version 6.7.2 # Created by: The Resource Compiler for Qt version 6.7.2
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
from PySide6 import QtCore from PyQt6 import QtCore
qt_resource_data = b"\ qt_resource_data = b"\
\x00\x00\xa2\x14\ \x00\x00\xa2\x14\
+2 -2
View File
@@ -1,5 +1,5 @@
from PySide6.QtWidgets import QLabel from PyQt6.QtWidgets import QLabel
from PySide6.QtGui import QFont from PyQt6.QtGui import QFont
class SubLabel(QLabel): class SubLabel(QLabel):
""" Formatting for sub-labels. """ """ Formatting for sub-labels. """
+3 -3
View File
@@ -1,6 +1,6 @@
from PySide6.QtWidgets import QLabel from PyQt6.QtWidgets import QLabel
from PySide6.QtGui import QFont from PyQt6.QtGui import QFont
from PySide6.QtCore import Qt from PyQt6.QtCore import Qt
class SubLabelValue(QLabel): class SubLabelValue(QLabel):
""" Formatting for values. """ """ Formatting for values. """