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 --- Widgets/Dashboard.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Widgets/Dashboard.py') diff --git a/Widgets/Dashboard.py b/Widgets/Dashboard.py index 1d77e53..e7e17a6 100644 --- a/Widgets/Dashboard.py +++ b/Widgets/Dashboard.py @@ -84,10 +84,15 @@ class Dashboard(Base, Form): - tile: The tile for which the icon needs to be set. - size: The size of the icon. """ - icon = tile.icon() - scaled_pixmap = icon.pixmap(icon.availableSizes()[0]).scaled(size, size, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) - tile.setIcon(QtGui.QIcon(scaled_pixmap)) - tile.setIconSize(QtCore.QSize(size, size)) + try: + icon = tile.icon() + if icon.availableSizes(): + pixmap = icon.pixmap(icon.availableSizes()[0]) + scaled_pixmap = pixmap.scaled(size, size, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) + tile.setIcon(QtGui.QIcon(scaled_pixmap)) + tile.setIconSize(QtCore.QSize(size, size)) + except Exception as e: + print(f"Failed to set icon: {e}") def tile_clicked(self, tile): """ -- cgit 1.2.3-korg