mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 01:44:15 +02:00
[improvement][ui] rendering package icons with no full paths declared
This commit is contained in:
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
|
|
||||||
- UI
|
- UI
|
||||||
- not limiting the name filter size
|
- not limiting the name filter size
|
||||||
|
- rendering package icons with no full paths declared
|
||||||
- minor improvements
|
- minor improvements
|
||||||
- download clients parameters
|
- download clients parameters
|
||||||
|
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ class AppsTable(QTableWidget):
|
|||||||
col_name = self.item(idx, 0)
|
col_name = self.item(idx, 0)
|
||||||
col_name.setIcon(icon_data['icon'])
|
col_name.setIcon(icon_data['icon'])
|
||||||
|
|
||||||
if app.model.supports_disk_cache() and app.model.get_disk_icon_path():
|
if app.model.supports_disk_cache() and app.model.get_disk_icon_path() and icon_data['bytes']:
|
||||||
if not icon_was_cached or not os.path.exists(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)
|
self.window.manager.cache_to_disk(pkg=app.model, icon_bytes=icon_data['bytes'], only_icon=True)
|
||||||
|
|
||||||
@@ -406,13 +406,21 @@ class AppsTable(QTableWidget):
|
|||||||
item.setText(name)
|
item.setText(name)
|
||||||
|
|
||||||
icon_path = pkg.model.get_disk_icon_path()
|
icon_path = pkg.model.get_disk_icon_path()
|
||||||
if pkg.model.supports_disk_cache() and icon_path and os.path.isfile(icon_path):
|
if pkg.model.supports_disk_cache() and icon_path:
|
||||||
with open(icon_path, 'rb') as f:
|
if icon_path.startswith('/') and os.path.isfile(icon_path):
|
||||||
icon_bytes = f.read()
|
with open(icon_path, 'rb') as f:
|
||||||
pixmap = QPixmap()
|
icon_bytes = f.read()
|
||||||
pixmap.loadFromData(icon_bytes)
|
pixmap = QPixmap()
|
||||||
icon = QIcon(pixmap)
|
pixmap.loadFromData(icon_bytes)
|
||||||
self.icon_cache.add_non_existing(pkg.model.icon_url, {'icon': icon, 'bytes': icon_bytes})
|
icon = QIcon(pixmap)
|
||||||
|
self.icon_cache.add_non_existing(pkg.model.icon_url, {'icon': icon, 'bytes': icon_bytes})
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
icon = QIcon.fromTheme(icon_path)
|
||||||
|
self.icon_cache.add_non_existing(pkg.model.icon_url, {'icon': icon, 'bytes': None})
|
||||||
|
|
||||||
|
except:
|
||||||
|
icon = QIcon(pkg.model.get_default_icon_path())
|
||||||
|
|
||||||
elif not pkg.model.icon_url:
|
elif not pkg.model.icon_url:
|
||||||
icon = QIcon(pkg.model.get_default_icon_path())
|
icon = QIcon(pkg.model.get_default_icon_path())
|
||||||
|
|||||||
Reference in New Issue
Block a user