diff options
Diffstat (limited to 'Widgets/Dashboard.py')
-rw-r--r-- | Widgets/Dashboard.py | 13 |
1 files changed, 9 insertions, 4 deletions
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): """ |