From 20fe2d131df0041e121eccaf4fc58d4ac88dfbbc Mon Sep 17 00:00:00 2001 From: suchinton2001 Date: Sun, 15 Oct 2023 23:30:36 +0530 Subject: 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 Change-Id: Id7883ba3bc88248dabb58d54e6e931f6d365fd54 --- extras/UI_Handeler.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'extras/UI_Handeler.py') diff --git a/extras/UI_Handeler.py b/extras/UI_Handeler.py index 2bfcfc4..261df94 100644 --- a/extras/UI_Handeler.py +++ b/extras/UI_Handeler.py @@ -24,16 +24,30 @@ from PyQt5.QtWidgets import QDesktopWidget import logging import json +from . import FeedKuksa as feed_kuksa from . import Kuksa_Instance as kuksa_instance # Global variables subscribed = False should_execute_callback = True +block_subscription_updates = False class UI_Handeler(MainWindow): """ This class handles the UI of the AGL Demo Control Panel application. """ + def __init__(self): + self.feed_kuksa = feed_kuksa.FeedKuksa() + self.feed_kuksa.sending_values.connect(self.block_updates) + self.feed_kuksa.finished_sending_values.connect(self.unblock_updates) + + def block_updates(self): + global block_subscription_updates + block_subscription_updates = True + + def unblock_updates(self): + global block_subscription_updates + block_subscription_updates = False def Hide_Navbar(self, bool_arg): """ @@ -143,9 +157,10 @@ class UI_Handeler(MainWindow): Args: - data: The data received from the signal. """ - global should_execute_callback - if should_execute_callback is False: + global block_subscription_updates + if block_subscription_updates: return + IC_Page = self.stackedWidget.widget(1) HVAC_Page = self.stackedWidget.widget(2) -- cgit