aboutsummaryrefslogtreecommitdiffstats
path: root/Widgets
diff options
context:
space:
mode:
authorsuchinton2001 <suchinton.2001@gmail.com>2023-10-12 11:04:55 +0530
committersuchinton2001 <suchinton.2001@gmail.com>2023-10-12 11:04:55 +0530
commit61f6fb386e162ed2bdbd2f9351e7c220c898483f (patch)
tree4738bc805878d246cc6a9a3d600ab78e4da6b4c1 /Widgets
parentdb862e32df7f31e6453d7f05a6f011091b96ffab (diff)
agl-demo-control-panel: Add installation steps for debian/RPiOS
V1: - Fix window dragging event crash - Update dependencies in requirements.txt - Add installation instructions for Debian-based systems - Update Dashboard scaling of icons SPEC-4929 Signed-off-by: suchinton2001 <suchinton.2001@gmail.com> Change-Id: I200f18606a6008780d2f4553052f24a9df5d10b7
Diffstat (limited to 'Widgets')
-rw-r--r--Widgets/Dashboard.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/Widgets/Dashboard.py b/Widgets/Dashboard.py
index 591f296..1d77e53 100644
--- a/Widgets/Dashboard.py
+++ b/Widgets/Dashboard.py
@@ -19,6 +19,7 @@ import sys
from PyQt5 import uic
from PyQt5 import QtWidgets
from PyQt5.QtCore import pyqtSignal
+from PyQt5 import QtCore, QtGui
current_dir = os.path.dirname(os.path.abspath(__file__))
@@ -32,6 +33,9 @@ Form, Base = uic.loadUiType(os.path.join(current_dir, "../ui/Dashboard.ui"))
# ========================================
+from PyQt5 import QtCore, QtGui, QtWidgets
+from PyQt5.QtCore import pyqtSignal
+
class Dashboard(Base, Form):
"""
A class representing the dashboard widget.
@@ -41,6 +45,7 @@ class Dashboard(Base, Form):
Methods:
- __init__(self, parent=None): Initializes the Dashboard widget.
+ - set_icon(self, tile, size): Sets the icon for the given tile.
- tile_clicked(self, tile): Handles the tile click event.
"""
@@ -62,13 +67,27 @@ class Dashboard(Base, Form):
self.DB_HVAC_Tile,
self.DB_Steering_Tile,
self.DB_Settings_Tile)
-
+
DashboardTiles = QtWidgets.QButtonGroup(self)
+
+ DashboardTiles.buttonClicked.connect(self.tile_clicked)
for i, tile in enumerate(Dashboard_tiles):
+ self.set_icon(tile, 55)
DashboardTiles.addButton(tile)
-
- DashboardTiles.buttonClicked.connect(self.tile_clicked)
+
+ def set_icon(self, tile, size):
+ """
+ Sets the icon for the given tile.
+
+ Parameters:
+ - 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))
def tile_clicked(self, tile):
"""