LiquidGUI [1.1.0.0] DEV

- Moved device init into dedicated function to prevent unwanted
device re-init.
- Library renaming.
This commit is contained in:
2023-08-19 19:39:03 +01:00
parent ba1d19cc0b
commit a3ee61bff1
2 changed files with 23 additions and 20 deletions
+10 -7
View File
@@ -1,22 +1,25 @@
from liquidctl import find_liquidctl_devices, cli
class LiquidCTL_Init():
class LiquidCTL_Helper():
device_name = None
device_temp = 0
device_fanSpeed = 0
device_pumpSpeed = 0
device_fwVers = 0
device_fwVers = None
devices = find_liquidctl_devices()
for dev in devices:
with dev.connect():
#print(f'{dev.description}')
device_name = dev.description
init_status = dev.initialize()
if init_status:
for key, value, unit in init_status:
#print(f'- {key}: {value} {unit}')
device_fwVers = value
device_fwVers = ''.join(map(str, dev.firmware_version))
def ForceInit(self):
init_status = self.dev.initialize()
if init_status:
for key, value, unit in init_status:
#print(f'- {key}: {value} {unit}')
device_fwVers = value
def TestConnectionState(self):
if self.device_name != None:
+13 -13
View File
@@ -5,13 +5,13 @@ import resources
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QProgressBar, QPushButton
from PySide6.QtCore import Qt, QTimer, QThreadPool
from PySide6.QtGui import QFont, QIcon
from liquidctl_worker import LiquidCTL_Init
from messagehandler import MessageHandler
from LiquidCTL_Helper import LiquidCTL_Helper
from MessageHandler import MessageHandler
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.setWindowTitle("LiquidGUI (v.1.0.1.2)")
self.setWindowTitle("LiquidGUI (v.1.1.0.0)")
self.setFixedSize(450, 350)
self.setWindowFlags(Qt.WindowType.Dialog)
widget = QWidget(self)
@@ -56,20 +56,20 @@ class MainWindow(QMainWindow):
self.timer = QTimer()
self.timer.setInterval(1000)
self.timer.timeout.connect(lambda: self.thread_manager.start(lctl_worker.Update))
self.timer.timeout.connect(lambda: self.thread_manager.start(lctl_helper.Update))
self.timer.timeout.connect(self.update_widgets)
self.timer.start()
def update_widgets(self):
self.lbl_device_name.setText(lctl_worker.device_name)
self.prg_temp.setValue(lctl_worker.device_temp)
self.prg_fanSpeed.setValue(lctl_worker.device_fanSpeed)
self.prg_pumpSpeed.setValue(lctl_worker.device_pumpSpeed)
if lctl_worker.device_fwVers != 0 or None:
self.lbl_fwVers.setText(f"Firmware: v{lctl_worker.device_fwVers}")
self.lbl_device_name.setText(lctl_helper.device_name)
self.prg_temp.setValue(lctl_helper.device_temp)
self.prg_fanSpeed.setValue(lctl_helper.device_fanSpeed)
self.prg_pumpSpeed.setValue(lctl_helper.device_pumpSpeed)
if lctl_helper.device_fwVers != None:
self.lbl_fwVers.setText(f"Firmware: v{lctl_helper.device_fwVers}")
def max_fan_speed(self):
lctl_worker.SetFanSpeed(100)
lctl_helper.SetFanSpeed(100)
app = QApplication(sys.argv)
icon = QIcon(":/icons/LiquidGUI.ico")
@@ -77,9 +77,9 @@ app.setWindowIcon(icon)
messagehandler = MessageHandler()
lctl_worker = LiquidCTL_Init()
lctl_helper = LiquidCTL_Helper()
# Show error and quit app if no devices are found
if lctl_worker.TestConnectionState() == True:
if lctl_helper.TestConnectionState() == True:
messagehandler.ShowNoDevicesFoundError()
sys.exit(1)