LiquidGUI [1.2.0.0]
- Linux Support
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
class LiquidCTL_Helper():
|
||||
device_name = None
|
||||
device_temp = 0
|
||||
device_fanSpeed = 0
|
||||
device_pumpSpeed = 0
|
||||
device_fwVers = None
|
||||
|
||||
devices = None
|
||||
|
||||
def ForceInit(self):
|
||||
NotImplemented
|
||||
|
||||
def TestConnectionState(self):
|
||||
output = subprocess.run(["liquidctl", "status"], stdout=subprocess.PIPE, universal_newlines=True)
|
||||
if len(output.stdout) > 0:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def Update(self):
|
||||
output = subprocess.run(["liquidctl", "status"], stdout=subprocess.PIPE, universal_newlines=True)
|
||||
self.device_name = str(re.search(r'^[^\n]*', output.stdout).group(0))
|
||||
self.device_temp = float(re.search(r'Liquid temperature\s+(\d+\.?\d*)', output.stdout).group(1))
|
||||
self.device_fanSpeed = int(re.search(r'Fan speed\s+(\d+)', output.stdout).group(1))
|
||||
self.device_pumpSpeed = int(re.search(r'Pump speed\s+(\d+)', output.stdout).group(1))
|
||||
|
||||
|
||||
def SetFanSpeed(self, speed):
|
||||
NotImplemented
|
||||
@@ -0,0 +1,8 @@
|
||||
import platform
|
||||
|
||||
os = None
|
||||
_platform = platform.platform()
|
||||
if _platform.startswith("Linux"):
|
||||
os = "Linux"
|
||||
elif _platform.startswith("Windows"):
|
||||
os = "Windows"
|
||||
@@ -1,24 +1,27 @@
|
||||
# External Dependencies
|
||||
import sys
|
||||
import win32mica
|
||||
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QLabel, QProgressBar, QPushButton
|
||||
from PySide6.QtCore import Qt, QTimer, QThreadPool
|
||||
from PySide6.QtGui import QFont, QIcon
|
||||
import darkdetect
|
||||
# Internal Imports
|
||||
from LiquidCTL_Helper import LiquidCTL_Helper
|
||||
import common
|
||||
import globals
|
||||
from MessageHandler import MessageHandler
|
||||
from styles import Labels
|
||||
import common
|
||||
import resources, pkg_resources.extern
|
||||
|
||||
import resources
|
||||
if globals.os == "Windows":
|
||||
from LiquidCTL_Helper_Windows import LiquidCTL_Helper
|
||||
import win32mica
|
||||
elif globals.os == "Linux":
|
||||
from LiquidCTL_Helper_Linux import LiquidCTL_Helper
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
""" Main application window. """
|
||||
|
||||
def __init__(self, lctl):
|
||||
super(MainWindow, self).__init__()
|
||||
self.setWindowTitle("LiquidGUI (v.1.1.3.0)")
|
||||
self.setWindowTitle("LiquidGUI (v.1.2.0.0) DEV")
|
||||
self.setFixedSize(450, 500)
|
||||
|
||||
self.lctl = lctl
|
||||
@@ -117,17 +120,19 @@ def main():
|
||||
|
||||
window = MainWindow(LiquidCTL_Helper())
|
||||
window.setWindowIcon(icon)
|
||||
window.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
||||
if globals.platform == "Windows":
|
||||
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:
|
||||
if darkdetect.isDark():
|
||||
win32mica.ApplyMica(window.winId(), win32mica.MICAMODE.DARK)
|
||||
elif darkdetect.isLight():
|
||||
win32mica.ApplyMica(window.winId(), win32mica.MICAMODE.LIGHT)
|
||||
if globals.platform == "Windows":
|
||||
if darkdetect.isDark():
|
||||
win32mica.ApplyMica(window.winId(), win32mica.MICAMODE.DARK)
|
||||
elif darkdetect.isLight():
|
||||
win32mica.ApplyMica(window.winId(), win32mica.MICAMODE.LIGHT)
|
||||
|
||||
window.show()
|
||||
app.exec()
|
||||
|
||||
Reference in New Issue
Block a user