aboutsummaryrefslogtreecommitdiffstats
path: root/Widgets/Dashboard.py
diff options
context:
space:
mode:
authorsuchinton2001 <suchinton.2001@gmail.com>2023-10-24 16:57:31 +0530
committersuchinton2001 <suchinton.2001@gmail.com>2023-10-24 16:57:31 +0530
commitb100328904e366b72042a1493bbc9c04c1c45da2 (patch)
treef994bd7a9b52a4324e9b3b62e17105cc8dd2d6c8 /Widgets/Dashboard.py
parent9af16ad7272f4e1d068004fc4443db5d14f89b3c (diff)
agl-demo-control-panel: Fix circular import problem
Fix circular import, causing control panel to fail to launch SPEC-4942 Signed-off-by: suchinton2001 <suchinton.2001@gmail.com> Change-Id: Id035ba28b8c19d1002abf0073656d99572c43b0e
Diffstat (limited to 'Widgets/Dashboard.py')
-rw-r--r--Widgets/Dashboard.py41
1 files changed, 19 insertions, 22 deletions
diff --git a/Widgets/Dashboard.py b/Widgets/Dashboard.py
index 8b6a11f..370405c 100644
--- a/Widgets/Dashboard.py
+++ b/Widgets/Dashboard.py
@@ -14,8 +14,7 @@
limitations under the License.
"""
-from PyQt5 import QtCore, QtGui, QtWidgets
-from extras.FeedKuksa import FeedKuksa
+from PyQt5 import QtCore, QtWidgets
import os
import sys
from PyQt5 import uic
@@ -64,8 +63,6 @@ class Dashboard(Base, Form):
super(self.__class__, self).__init__(parent)
self.setupUi(self)
- self.feed_kuksa = FeedKuksa()
-
Dashboard_tiles = (self.DB_IC_Tile,
self.DB_HVAC_Tile,
self.DB_Steering_Tile,
@@ -80,23 +77,23 @@ class Dashboard(Base, Form):
DashboardTiles.addButton(tile)
def set_icon(self, tile, icon_size):
- try:
- if tile == self.DB_IC_Tile:
- file = ":/Carbon_Icons/carbon_icons/meter.svg"
- if tile == self.DB_HVAC_Tile:
- file = ":/Carbon_Icons/carbon_icons/windy--strong.svg"
- if tile == self.DB_Steering_Tile:
- file = ":/Images/Images/steering-wheel.svg"
- if tile == self.DB_Settings_Tile:
- file = ":/Carbon_Icons/carbon_icons/settings.svg"
- getsize = QtSvg.QSvgRenderer(file)
- svg_widget = QtSvg.QSvgWidget(file)
- svg_widget.setFixedSize(getsize.defaultSize()*2)
- svg_widget.setStyleSheet("background-color: transparent;")
- tile.setIcon(QIcon(svg_widget.grab()))
- tile.setIconSize(QtCore.QSize(icon_size, icon_size))
- except Exception as e:
- print(f"Failed to set icon: {e}")
+ icon_mapping = {
+ self.DB_IC_Tile: ":/Carbon_Icons/carbon_icons/meter.svg",
+ self.DB_HVAC_Tile: ":/Carbon_Icons/carbon_icons/windy--strong.svg",
+ self.DB_Steering_Tile: ":/Images/Images/steering-wheel.svg",
+ self.DB_Settings_Tile: ":/Carbon_Icons/carbon_icons/settings.svg"
+ }
+
+ file = icon_mapping.get(tile)
+ if file is None:
+ return
+
+ getsize = QtSvg.QSvgRenderer(file)
+ svg_widget = QtSvg.QSvgWidget(file)
+ svg_widget.setFixedSize(getsize.defaultSize()*2)
+ svg_widget.setStyleSheet("background-color: transparent;")
+ tile.setIcon(QIcon(svg_widget.grab()))
+ tile.setIconSize(QtCore.QSize(icon_size, icon_size))
def tile_clicked(self, tile):
"""
@@ -122,4 +119,4 @@ if __name__ == '__main__':
app = QApplication(sys.argv)
w = Dashboard()
w.show()
- sys.exit(app.exec_()) \ No newline at end of file
+ sys.exit(app.exec_())