mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
Caching icon loaded from disk
This commit is contained in:
@@ -81,9 +81,7 @@ class FlatpakAsyncDataLoader(Thread):
|
||||
|
||||
break
|
||||
else:
|
||||
self.log_msg(
|
||||
"Could not retrieve app data for id '{}'. Server response: {}. Body: {}".format(
|
||||
app.base_data.id, res.status_code, res.content.decode()), Fore.RED)
|
||||
self.log_msg("Could not retrieve app data for id '{}'. Server response: {}. Body: {}".format(app.base_data.id, res.status_code, res.content.decode()), Fore.RED)
|
||||
except:
|
||||
self.log_msg("Could not retrieve app data for id '{}'".format(app.base_data.id), Fore.YELLOW)
|
||||
traceback.print_exc()
|
||||
|
||||
@@ -237,7 +237,13 @@ class AppsTable(QTableWidget):
|
||||
col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
|
||||
|
||||
if app_v.model.supports_disk_cache() and os.path.exists(app_v.model.get_disk_icon_path()):
|
||||
icon = QIcon(app_v.model.get_disk_icon_path())
|
||||
|
||||
with open (app_v.model.get_disk_icon_path(), 'rb') as f:
|
||||
icon_bytes = f.read()
|
||||
pixmap = QPixmap()
|
||||
pixmap.loadFromData(icon_bytes)
|
||||
icon = QIcon(pixmap)
|
||||
self.icon_cache.add_non_existing(app_v.model.base_data.icon_url, {'icon': icon, 'bytes': icon_bytes})
|
||||
elif not app_v.model.base_data.icon_url:
|
||||
icon = QIcon(app_v.model.get_default_icon_path())
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user