summaryrefslogtreecommitdiffstats
path: root/Widgets/HVACPage.py
diff options
context:
space:
mode:
authorsuchinton2001 <suchinton.2001@gmail.com>2023-10-15 23:30:36 +0530
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2023-10-19 16:19:32 +0000
commit20fe2d131df0041e121eccaf4fc58d4ac88dfbbc (patch)
treed555cd863e644014e9eb7a3fb9b759de246b6c2e /Widgets/HVACPage.py
parente875973f63fc9a9582e957eb7264a4a589b78a97 (diff)
agl-demo-control-panel: Refactor Settings, Config and UI scaling
V1: - Add template to specify new configs in config.ini - Add drop-down to load all configurations specified in config.ini - Add new assets and refine UI elements (Scaling issue fixed) - Add size grip to main window - Add options in settings to configure port and AGL's CA.pem file - Removed unused or redundant files V2: - Check for user configs agl-demo-control-panel.ini & config.ini before resorting to default config.ini - Check for CA.pem and jwt tokens in default paths - Add new fields in settings for CA.pem file, jwt token path, TLS Server name - Fix crash in dashboard.py module due to icon.availableSizes() V3: Add Start/Stop states for the client V4: Block subscription event updates to the UI when values are changed on the control panel Bug-AGL: SPEC-4905 Signed-off-by: suchinton2001 <suchinton.2001@gmail.com> Change-Id: Id7883ba3bc88248dabb58d54e6e931f6d365fd54
Diffstat (limited to 'Widgets/HVACPage.py')
-rw-r--r--Widgets/HVACPage.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/Widgets/HVACPage.py b/Widgets/HVACPage.py
index 99ee798..312f82b 100644
--- a/Widgets/HVACPage.py
+++ b/Widgets/HVACPage.py
@@ -42,7 +42,20 @@ class HVAC_Paths():
self.temperatureList = [str(i) + "°C" for i in range(32, 15, -1)]
class HVACWidget(Base, Form):
+ """
+ A widget for controlling HVAC settings.
+
+ Inherits from Base and Form.
+ """
+
def __init__(self, parent=None):
+ """
+ Initializes the HVACWidget.
+
+ Args:
+ - parent: The parent widget. Defaults to None.
+ """
+
super(self.__class__, self).__init__(parent)
self.setupUi(self)
@@ -83,23 +96,43 @@ class HVACWidget(Base, Form):
self.rightFanSpeed_slider.valueChanged.connect(self.rightFanSpeed_sliderChanged)
def leftTempListClicked(self):
+ """
+ Handles the event when an item in the left temperature list is clicked.
+ Sends the selected temperature value to the feed_kuksa object.
+ """
+
item = self.leftTempList.currentItem()
self.leftTempList.scrollToItem(item, 1)
self.feed_kuksa.send_values(self.HVAC.leftTemp, item.text()[:-2])
print(item.text())
def rightTempListClicked(self):
+ """
+ Handles the event when an item in the right temperature list is clicked.
+ Sends the selected temperature value to the feed_kuksa object.
+ """
+
item = self.rightTempList.currentItem()
self.rightTempList.scrollToItem(item, 1)
self.feed_kuksa.send_values(self.HVAC.rightTemp, item.text()[:-2])
print(item.text())
def leftFanSpeed_sliderChanged(self):
+ """
+ Handles the event when the left fan speed slider is changed.
+ Sends the selected fan speed value to the feed_kuksa object.
+ """
+
value = self.leftFanSpeed_slider.value()
self.feed_kuksa.send_values(self.HVAC.leftFanSpeed, str(value))
print(value)
def rightFanSpeed_sliderChanged(self):
+ """
+ Handles the event when the right fan speed slider is changed.
+ Sends the selected fan speed value to the feed_kuksa object.
+ """
+
value = self.rightFanSpeed_slider.value()
self.feed_kuksa.send_values(self.HVAC.rightFanSpeed, str(value))
print(value)