mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 10:54:15 +02:00
[fix] preventing to load null application null icon
This commit is contained in:
@@ -203,20 +203,22 @@ class AppsTable(QTableWidget):
|
|||||||
|
|
||||||
icon_was_cached = False
|
icon_was_cached = False
|
||||||
pixmap = QPixmap()
|
pixmap = QPixmap()
|
||||||
|
|
||||||
pixmap.loadFromData(icon_bytes)
|
pixmap.loadFromData(icon_bytes)
|
||||||
icon = QIcon(pixmap)
|
|
||||||
icon_data = {'icon': icon, 'bytes': icon_bytes}
|
|
||||||
self.icon_cache.add(icon_url, icon_data)
|
|
||||||
|
|
||||||
for idx, app in enumerate(self.window.pkgs):
|
if not pixmap.isNull():
|
||||||
if app.model.icon_url == icon_url:
|
icon = QIcon(pixmap)
|
||||||
col_name = self.item(idx, 0)
|
icon_data = {'icon': icon, 'bytes': icon_bytes}
|
||||||
col_name.setIcon(icon_data['icon'])
|
self.icon_cache.add(icon_url, icon_data)
|
||||||
|
|
||||||
if self.disk_cache and app.model.supports_disk_cache() and app.model.get_disk_icon_path():
|
if icon_data:
|
||||||
if not icon_was_cached or not os.path.exists(app.model.get_disk_icon_path()):
|
for idx, app in enumerate(self.window.pkgs):
|
||||||
self.window.manager.cache_to_disk(pkg=app.model, icon_bytes=icon_data['bytes'], only_icon=True)
|
if app.model.icon_url == icon_url:
|
||||||
|
col_name = self.item(idx, 0)
|
||||||
|
col_name.setIcon(icon_data['icon'])
|
||||||
|
|
||||||
|
if self.disk_cache and app.model.supports_disk_cache() and app.model.get_disk_icon_path():
|
||||||
|
if not icon_was_cached or not os.path.exists(app.model.get_disk_icon_path()):
|
||||||
|
self.window.manager.cache_to_disk(pkg=app.model, icon_bytes=icon_data['bytes'], only_icon=True)
|
||||||
|
|
||||||
def update_pkgs(self, pkg_views: List[PackageView], update_check_enabled: bool = True):
|
def update_pkgs(self, pkg_views: List[PackageView], update_check_enabled: bool = True):
|
||||||
self.setRowCount(len(pkg_views) if pkg_views else 0)
|
self.setRowCount(len(pkg_views) if pkg_views else 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user