LiquidGUI [1.0.1.3] Bugfix Release
- Moved device init into dedicated function to prevent unwanted device re-init. - Library renaming.
This commit is contained in:
@@ -1,22 +1,25 @@
|
||||
from liquidctl import find_liquidctl_devices
|
||||
|
||||
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:
|
||||
@@ -5,8 +5,8 @@ import resources
|
||||
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QProgressBar, QGroupBox
|
||||
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):
|
||||
@@ -53,17 +53,17 @@ 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}")
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
icon = QIcon(":/icons/LiquidGUI.ico")
|
||||
@@ -71,9 +71,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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user