LiquidGUI [1.3.0.0]
- Continued refactoring.
This commit is contained in:
@@ -16,17 +16,15 @@ import common
|
||||
from MessageHandler import MessageHandler
|
||||
## Platform Imports #########################################
|
||||
import globals
|
||||
from vitals_helper import Component
|
||||
from styles import Labels
|
||||
if globals.os == "Windows":
|
||||
from liquidctl_helper_windows import LiquidCTL_Helper
|
||||
from vitals_helper import VitalsHelperWindows as svh
|
||||
from vitals_helper import VitalsHelperWindows as VitalsHelper
|
||||
import win32mica # type: ignore
|
||||
import darkdetect # type: ignore
|
||||
elif globals.os == "Linux":
|
||||
from liquidctl_helper_linux import LiquidCTL_Helper
|
||||
from vitals_helper import VitalsHelperLinux as svh
|
||||
|
||||
from vitals_helper import VitalsHelperLinux as VitalsHelper
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
@@ -37,13 +35,13 @@ class MainWindow(QMainWindow):
|
||||
self.setWindowTitle("LiquidGUI (v.1.3.0.0) DEV")
|
||||
self.setFixedSize(450, 700)
|
||||
|
||||
self.lctl = lctl
|
||||
self.svh = svh()
|
||||
self._lctl = lctl
|
||||
self.__vitals_helper = VitalsHelper()
|
||||
|
||||
# Widgets ##########################################
|
||||
self.lbl_device_name = Labels.MainLabel()
|
||||
|
||||
self.lbl_cpu_temp = Labels.SubLabel(value="🔳 CPU Temp:")
|
||||
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,
|
||||
@@ -101,12 +99,12 @@ class MainWindow(QMainWindow):
|
||||
self.setCentralWidget(widget)
|
||||
self.setContentsMargins(20, 20, 20, 20)
|
||||
|
||||
# Threading #######################################
|
||||
# Threading #######################################################################
|
||||
self.thread_manager = QThreadPool()
|
||||
|
||||
self.timer = QTimer()
|
||||
self.timer.setInterval(1000)
|
||||
self.timer.timeout.connect(lambda: self.thread_manager.start(self.lctl.Update))
|
||||
self.timer.timeout.connect(lambda: self.thread_manager.start(self._lctl.Update))
|
||||
self.timer.timeout.connect(self.update_widgets)
|
||||
self.timer.start()
|
||||
|
||||
@@ -122,39 +120,46 @@ class MainWindow(QMainWindow):
|
||||
def update_widgets(self):
|
||||
""" Update widgets using LiquidCTL library."""
|
||||
|
||||
self.lbl_value_prg_cpu_temp.setText(
|
||||
self.min_max_cur_cpu_temp.builder(
|
||||
self.svh.get_temps(Component.lin_cpu_amd), "°C"))
|
||||
|
||||
self.prg_cpu_temp.setValue(
|
||||
self.svh.get_temps(Component.lin_cpu_amd))
|
||||
# Platform Specific Widgets #######################################################
|
||||
if globals.platform == "Windows":
|
||||
self.__vitals_helper()
|
||||
elif globals.platform == "Linux":
|
||||
self.lbl_value_prg_cpu_temp.setText(
|
||||
self.min_max_cur_cpu_temp.builder(
|
||||
self.__vitals_helper.get_temps(
|
||||
self.__vitals_helper.Component.lin_cpu_amd), "°C"))
|
||||
|
||||
self.prg_cpu_temp.setValue(
|
||||
self.__vitals_helper.get_temps(
|
||||
self.__vitals_helper.Component.lin_cpu_amd))
|
||||
|
||||
# Cross Platform Widgets ##########################################################
|
||||
self.lbl_device_name.setText(
|
||||
self.lctl.device_name)
|
||||
self._lctl.device_name)
|
||||
|
||||
self.prg_temp.setValue(
|
||||
self.lctl.device_temp)
|
||||
self._lctl.device_temp)
|
||||
|
||||
self.lbl_value_prg_temp.setText(
|
||||
self.min_max_cur_temp.builder(
|
||||
self.lctl.device_temp, "°C"))
|
||||
self._lctl.device_temp, "°C"))
|
||||
|
||||
self.prg_fanspeed.setValue(
|
||||
self.lctl.device_fanSpeed)
|
||||
self._lctl.device_fanSpeed)
|
||||
|
||||
self.lbl_value_prg_fanspeed.setText(
|
||||
self.min_max_cur_fanspeed.builder(
|
||||
self.lctl.device_fanSpeed, " rpm"))
|
||||
self._lctl.device_fanSpeed, " rpm"))
|
||||
|
||||
self.prg_pumpspeed.setValue(
|
||||
self.lctl.device_pumpSpeed)
|
||||
self._lctl.device_pumpSpeed)
|
||||
|
||||
self.lbl_value_prg_pumpspeed.setText(
|
||||
self.min_max_cur_pumpspeed.builder(
|
||||
self.lctl.device_pumpSpeed, " rpm"))
|
||||
self._lctl.device_pumpSpeed, " rpm"))
|
||||
|
||||
if self.lctl.device_fwVers is not None:
|
||||
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():
|
||||
@@ -178,7 +183,7 @@ def main():
|
||||
app.setWindowIcon(icon)
|
||||
|
||||
# Show error and quit app if no devices are found
|
||||
if window.lctl.TestConnectionState():
|
||||
if window._lctl.TestConnectionState():
|
||||
MessageHandler().ShowNoDevicesFoundError()
|
||||
sys.exit(1)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user