LiquidGUI [1.3.0.0]
- Initial psutil support for system vitals.
This commit is contained in:
@@ -2,7 +2,7 @@ import subprocess
|
||||
import re
|
||||
|
||||
class LiquidCTL_Helper():
|
||||
device_name = None
|
||||
device_name: str = ""
|
||||
device_temp = 0
|
||||
device_fanSpeed = 0
|
||||
device_pumpSpeed = 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from liquidctl import find_liquidctl_devices, cli
|
||||
from liquidctl import find_liquidctl_devices, cli # type: ignore
|
||||
|
||||
class LiquidCTL_Helper():
|
||||
device_name = None
|
||||
|
||||
@@ -16,15 +16,17 @@ import common
|
||||
from MessageHandler import MessageHandler
|
||||
## Platform Imports #########################################
|
||||
import globals
|
||||
from sys_vitals_helper import SysVitals_Helper
|
||||
if globals.os == "Windows":
|
||||
from LiquidCTL_Helper_Windows import LiquidCTL_Helper
|
||||
from styles import Labels_Windows as Labels
|
||||
import win32mica
|
||||
import darkdetect
|
||||
import win32mica # type: ignore
|
||||
import darkdetect # type: ignore
|
||||
elif globals.os == "Linux":
|
||||
from LiquidCTL_Helper_Linux import LiquidCTL_Helper
|
||||
from styles import Labels_Linux as Labels
|
||||
from pathlib import Path
|
||||
from sys_vitals_helper import SysVitals_Helper, Component
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
@@ -32,10 +34,11 @@ class MainWindow(QMainWindow):
|
||||
|
||||
def __init__(self, lctl):
|
||||
super(MainWindow, self).__init__()
|
||||
self.setWindowTitle("LiquidGUI (v.1.2.0.0)")
|
||||
self.setFixedSize(450, 500)
|
||||
self.setWindowTitle("LiquidGUI (v.1.3.0.0) DEV")
|
||||
self.setFixedSize(450, 700)
|
||||
|
||||
self.lctl = lctl
|
||||
self.svh = SysVitals_Helper()
|
||||
|
||||
# Widgets ##########################################
|
||||
self.lbl_device_name = Labels.MainLabel()
|
||||
@@ -60,6 +63,14 @@ class MainWindow(QMainWindow):
|
||||
minimum=1900,
|
||||
maximum=2700)
|
||||
self.lbl_value_prg_pumpspeed = Labels.SubLabelValue()
|
||||
|
||||
self.lbl_cpu_temp = Labels.SubLabel(value="🔳 CPU Temp:")
|
||||
self.min_max_cur_cpu_temp = common.MinMaxCurrent()
|
||||
self.prg_cpu_temp = QProgressBar(textVisible=False,
|
||||
minimum=0,
|
||||
maximum=105)
|
||||
self.lbl_value_prg_cpu_temp = Labels.SubLabelValue()
|
||||
|
||||
self.btn_reset_min_max = QPushButton("Reset Min/Max")
|
||||
self.btn_reset_min_max.clicked.connect(self.on_reset_min_max)
|
||||
|
||||
@@ -78,6 +89,9 @@ class MainWindow(QMainWindow):
|
||||
layout.addWidget(self.lbl_pumpspeed)
|
||||
layout.addWidget(self.prg_pumpspeed)
|
||||
layout.addWidget(self.lbl_value_prg_pumpspeed)
|
||||
layout.addWidget(self.lbl_cpu_temp)
|
||||
layout.addWidget(self.prg_cpu_temp)
|
||||
layout.addWidget(self.lbl_value_prg_cpu_temp)
|
||||
layout.addWidget(self.lbl_fwvers)
|
||||
layout.addWidget(self.btn_reset_min_max)
|
||||
|
||||
@@ -102,6 +116,7 @@ class MainWindow(QMainWindow):
|
||||
self.min_max_cur_temp = common.MinMaxCurrent()
|
||||
self.min_max_cur_fanspeed = common.MinMaxCurrent()
|
||||
self.min_max_cur_pumpspeed = common.MinMaxCurrent()
|
||||
self.min_max_cur_cpu_temp = common.MinMaxCurrent()
|
||||
self.timer.start()
|
||||
|
||||
def update_widgets(self):
|
||||
@@ -121,6 +136,13 @@ class MainWindow(QMainWindow):
|
||||
self.lctl.device_pumpSpeed, " rpm"))
|
||||
if self.lctl.device_fwVers is not None:
|
||||
self.lbl_fwvers.setText(f"Firmware: v{self.lctl.device_fwVers}")
|
||||
self.prg_cpu_temp.setValue(self.svh.GetTemps(Component.CPU_AMD))
|
||||
self.lbl_value_prg_cpu_temp.setText(
|
||||
self.min_max_cur_cpu_temp.builder(
|
||||
self.svh.GetTemps(Component.CPU_AMD), "°C"))
|
||||
# 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():
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
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 entry.current
|
||||
Reference in New Issue
Block a user