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