LiquidGUI [1.3.0.0]
- Lots of refactoring.
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,48 @@
|
||||
from abc import ABC, abstractmethod, abstractproperty
|
||||
|
||||
class LiquidCTL_Helper_Interface(ABC):
|
||||
@property
|
||||
@abstractmethod
|
||||
def device_name(self) -> str:
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def device_temp(self) -> float:
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def device_fanSpeed(self) -> float:
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def device_pumpSpeed(self) -> float:
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def device_fwVers(self) -> str:
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def devices(self) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def ForceInit(self) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def TestConnectionState(self) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def Update(self) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def SetFanSpeed(self, speed) -> None:
|
||||
pass
|
||||
@@ -1,7 +1,8 @@
|
||||
import subprocess
|
||||
import re
|
||||
from liquidctl_helper_interface import LiquidCTL_Helper_Interface
|
||||
|
||||
class LiquidCTL_Helper():
|
||||
class LiquidCTL_Helper(LiquidCTL_Helper_Interface):
|
||||
device_name: str = ""
|
||||
device_temp = 0
|
||||
device_fanSpeed = 0
|
||||
@@ -1,6 +1,7 @@
|
||||
from liquidctl import find_liquidctl_devices, cli # type: ignore
|
||||
from liquidctl_helper_interface import LiquidCTL_Helper_Interface
|
||||
|
||||
class LiquidCTL_Helper():
|
||||
class LiquidCTL_Helper(LiquidCTL_Helper_Interface):
|
||||
device_name = None
|
||||
device_temp = 0
|
||||
device_fanSpeed = 0
|
||||
@@ -16,14 +16,16 @@ import common
|
||||
from MessageHandler import MessageHandler
|
||||
## Platform Imports #########################################
|
||||
import globals
|
||||
from sys_vitals_helper import SysVitals_Helper, Component
|
||||
from vitals_helper import Component
|
||||
from styles import Labels
|
||||
if globals.os == "Windows":
|
||||
from LiquidCTL_Helper_Windows import LiquidCTL_Helper
|
||||
from liquidctl_helper_windows import LiquidCTL_Helper
|
||||
from vitals_helper import VitalsHelperWindows as svh
|
||||
import win32mica # type: ignore
|
||||
import darkdetect # type: ignore
|
||||
elif globals.os == "Linux":
|
||||
from LiquidCTL_Helper_Linux import LiquidCTL_Helper
|
||||
from liquidctl_helper_linux import LiquidCTL_Helper
|
||||
from vitals_helper import VitalsHelperLinux as svh
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +38,7 @@ class MainWindow(QMainWindow):
|
||||
self.setFixedSize(450, 700)
|
||||
|
||||
self.lctl = lctl
|
||||
self.svh = SysVitals_Helper()
|
||||
self.svh = svh()
|
||||
|
||||
# Widgets ##########################################
|
||||
self.lbl_device_name = Labels.MainLabel()
|
||||
@@ -122,10 +124,10 @@ class MainWindow(QMainWindow):
|
||||
|
||||
self.lbl_value_prg_cpu_temp.setText(
|
||||
self.min_max_cur_cpu_temp.builder(
|
||||
self.svh.GetTemps(Component.CPU_AMD), "°C"))
|
||||
self.svh.get_temps(Component.lin_cpu_amd), "°C"))
|
||||
|
||||
self.prg_cpu_temp.setValue(
|
||||
self.svh.GetTemps(Component.CPU_AMD))
|
||||
self.svh.get_temps(Component.lin_cpu_amd))
|
||||
|
||||
self.lbl_device_name.setText(
|
||||
self.lctl.device_name)
|
||||
@@ -154,10 +156,6 @@ class MainWindow(QMainWindow):
|
||||
if self.lctl.device_fwVers is not None:
|
||||
self.lbl_fwvers.setText(f"Firmware: v{self.lctl.device_fwVers}")
|
||||
|
||||
# print(f"CPU: {self.svh.GetTemps(Component.CPU_AMD)}°C")
|
||||
# print(f"GPU: {self.svh.GetTemps(Component.GPU_AMD)}°C")
|
||||
# print(f"MOBO: {self.svh.GetTemps(Component.MOBO_ASUS)}°C")
|
||||
|
||||
|
||||
def main():
|
||||
""" Initialize application and setup window parameters. """
|
||||
@@ -169,9 +167,9 @@ def main():
|
||||
icon = QIcon(":/icons/LiquidGUI.ico")
|
||||
|
||||
if darkdetect.isDark():
|
||||
win32mica.ApplyMica(window.winId(), win32mica.MICAMODE.DARK)
|
||||
win32mica.ApplyMica(window.winId(), win32mica.MicaTheme.DARK)
|
||||
elif darkdetect.isLight():
|
||||
win32mica.ApplyMica(window.winId(), win32mica.MICAMODE.LIGHT)
|
||||
win32mica.ApplyMica(window.winId(), win32mica.MicaTheme.LIGHT)
|
||||
|
||||
elif globals.os == "Linux":
|
||||
app.setDesktopFileName("LiquidGUI")
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
from enum import Enum
|
||||
import psutil
|
||||
|
||||
class Component(Enum):
|
||||
CPU_AMD = ("k10temp", "Tctl")
|
||||
GPU_AMD = ("amdgpu", "edge")
|
||||
MOBO_ASUS = ("asus_wmi_sensors", "Motherboard Temperature")
|
||||
|
||||
class SysVitals_Helper():
|
||||
|
||||
def GetTemps(self, component: Component):
|
||||
temps = psutil.sensors_temperatures()
|
||||
|
||||
if component.value[0] in temps:
|
||||
for entry in temps[component.value[0]]:
|
||||
if entry.label == component.value[1]:
|
||||
return round(entry.current, 2)
|
||||
@@ -0,0 +1,33 @@
|
||||
from enum import Enum
|
||||
from abc import ABC, abstractmethod
|
||||
import psutil
|
||||
import pythonnet
|
||||
import os
|
||||
|
||||
class Component(Enum):
|
||||
lin_cpu_amd = ("k10temp", "Tctl")
|
||||
lin_gpu_amd = ("amdgpu", "edge")
|
||||
lin_mobo_asus = ("asus_wmi_sensors", "Motherboard Temperature")
|
||||
|
||||
|
||||
class VitalsHelperInterface(ABC):
|
||||
@abstractmethod
|
||||
def get_temps(self, component: Component):
|
||||
""" Return Temperatures """
|
||||
pass
|
||||
|
||||
class VitalsHelperLinux(VitalsHelperInterface):
|
||||
def get_temps(self, component: Component):
|
||||
temps = psutil.sensors_temperatures()
|
||||
|
||||
if component.value[0] in temps:
|
||||
for entry in temps[component.value[0]]:
|
||||
if entry.label == component.value[1]:
|
||||
return round(entry.current, 2)
|
||||
|
||||
class VitalsHelperWindows(VitalsHelperInterface):
|
||||
def __init__(self):
|
||||
print(f"{self.__class__.__name__} is not Implemented")
|
||||
|
||||
def get_temps(self, component: Component):
|
||||
return 0
|
||||
Reference in New Issue
Block a user