diff --git a/CHANGELOG.md b/CHANGELOG.md index 725eda11..fb53556d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - not calling initial required tasks after enabling a new package type on settings - not updating the type filters if only type is available after refreshing the table - displaying the type filters on the search results when there is only one type available and some actions are done + - not displaying the default type icon besides the package when its icon path does not exist (Snap runtimes are not displaying icons) - minor fixes - Tray - update notifications not working on Ubuntu 18.04 diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index 9838205e..dfae405e 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -409,13 +409,16 @@ class AppsTable(QTableWidget): icon_path = pkg.model.get_disk_icon_path() if pkg.model.installed and pkg.model.supports_disk_cache() and icon_path: - if icon_path.startswith('/') and os.path.isfile(icon_path): - with open(icon_path, 'rb') as f: - icon_bytes = f.read() - pixmap = QPixmap() - pixmap.loadFromData(icon_bytes) - icon = QIcon(pixmap) - self.icon_cache.add_non_existing(pkg.model.icon_url, {'icon': icon, 'bytes': icon_bytes}) + if icon_path.startswith('/'): + if os.path.isfile(icon_path): + with open(icon_path, 'rb') as f: + icon_bytes = f.read() + pixmap = QPixmap() + pixmap.loadFromData(icon_bytes) + icon = QIcon(pixmap) + self.icon_cache.add_non_existing(pkg.model.icon_url, {'icon': icon, 'bytes': icon_bytes}) + else: + icon = QIcon(pkg.model.get_default_icon_path()) else: try: icon = QIcon.fromTheme(icon_path)