LiquidGUI [1.1.0.0] Dev
- Initial Linux support.
This commit is contained in:
+20
-17
@@ -1,11 +1,12 @@
|
|||||||
from liquidctl import find_liquidctl_devices, cli
|
from liquidctl import find_liquidctl_devices, cli
|
||||||
|
|
||||||
class LiquidCTL_Helper():
|
class LiquidCTL_Helper():
|
||||||
device_name = None
|
device_name = None
|
||||||
device_temp = 0
|
device_temp = 0
|
||||||
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,16 +33,17 @@ class LiquidCTL_Helper():
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def Update(self):
|
def Update(self):
|
||||||
with self.dev.connect():
|
if self.device_connect_error == False:
|
||||||
status = self.dev.get_status()
|
with self.dev.connect():
|
||||||
for key, value, unit in status:
|
status = self.dev.get_status()
|
||||||
#print(f'- {key}: {value} {unit}')
|
for key, value, unit in status:
|
||||||
if key == "Liquid temperature":
|
#print(f'- {key}: {value} {unit}')
|
||||||
self.device_temp = value
|
if key == "Liquid temperature":
|
||||||
elif key == "Fan speed":
|
self.device_temp = value
|
||||||
self.device_fanSpeed = value
|
elif key == "Fan speed":
|
||||||
elif key == "Pump speed":
|
self.device_fanSpeed = value
|
||||||
self.device_pumpSpeed = value
|
elif key == "Pump speed":
|
||||||
|
self.device_pumpSpeed = value
|
||||||
|
|
||||||
def SetFanSpeed(self, speed):
|
def SetFanSpeed(self, speed):
|
||||||
with self.dev.connect():
|
with self.dev.connect():
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
from PySide6.QtWidgets import QMessageBox
|
from PyQt6.QtWidgets import QMessageBox
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
class MessageHandler():
|
class MessageHandler():
|
||||||
|
|||||||
@@ -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,15 +74,16 @@ 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 + " -")
|
if self.lctl.device_name != None:
|
||||||
self.prg_temp.setValue(self.lctl.device_temp)
|
self.lbl_device_name.setText("- " + self.lctl.device_name + " -")
|
||||||
self.lbl_value_prg_temp.setText(str(self.lctl.device_temp) + "°C")
|
self.prg_temp.setValue(int(self.lctl.device_temp))
|
||||||
self.prg_fanspeed.setValue(self.lctl.device_fanSpeed)
|
self.lbl_value_prg_temp.setText(str(self.lctl.device_temp) + "°C")
|
||||||
self.lbl_value_prg_fanspeed.setText(str(self.lctl.device_fanSpeed) + " rpm")
|
self.prg_fanspeed.setValue(self.lctl.device_fanSpeed)
|
||||||
self.prg_pumpspeed.setValue(self.lctl.device_pumpSpeed)
|
self.lbl_value_prg_fanspeed.setText(str(self.lctl.device_fanSpeed) + " rpm")
|
||||||
self.lbl_value_prg_pumpspeed.setText(str(self.lctl.device_pumpSpeed) + " rpm")
|
self.prg_pumpspeed.setValue(self.lctl.device_pumpSpeed)
|
||||||
if self.lctl.device_fwVers is not None:
|
self.lbl_value_prg_pumpspeed.setText(str(self.lctl.device_pumpSpeed) + " rpm")
|
||||||
self.lbl_fwvers.setText(f"Firmware: v{self.lctl.device_fwVers}")
|
if self.lctl.device_fwVers is not None:
|
||||||
|
self.lbl_fwvers.setText(f"Firmware: v{self.lctl.device_fwVers}")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -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:
|
||||||
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()
|
window.show()
|
||||||
|
app.setStyle("Breeze")
|
||||||
app.exec()
|
app.exec()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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
@@ -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. """
|
||||||
|
|||||||
@@ -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. """
|
||||||
|
|||||||
Reference in New Issue
Block a user