[info|history|screenshots] fix: crashes associated with application icons

This commit is contained in:
Vinicius Moreira
2019-10-16 18:13:39 -03:00
parent 1936221730
commit 5163695d61
4 changed files with 24 additions and 18 deletions

View File

@@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Runtimes update-checking for version 1.5.X
- Snap:
- retrieving installed applications information for Ubuntu based distros
- Application icon replaced by the type icon in the Info, History and Screenshots panels due to unexpected Qt crashes.
- minor UI fixes
### AppImage support

View File

@@ -2,7 +2,7 @@ import operator
from functools import reduce
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QColor
from PyQt5.QtGui import QColor, QIcon
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QTableWidget, QTableWidgetItem, QHeaderView
from bauh.api.abstract.cache import MemoryCache
@@ -55,7 +55,9 @@ class HistoryDialog(QDialog):
new_width = reduce(operator.add, [table_history.columnWidth(i) for i in range(table_history.columnCount())])
self.resize(new_width, table_history.height())
icon_data = icon_cache.get(history.pkg.icon_url)
if icon_data and icon_data.get('icon'):
self.setWindowIcon(icon_data.get('icon'))
# THERE ARE CRASHES WITH SOME RARE ICONS ( like insomnia ). IT CAN BE A QT BUG. IN THE MEANTIME, ONLY THE TYPE ICON WILL BE RENDERED
#
# icon_data = icon_cache.get(history.pkg.icon_url)
# if icon_data and icon_data.get('icon'):
# self.setWindowIcon(icon_data.get('icon'))
self.setWindowIcon(QIcon(history.pkg.get_type_icon_path()))

View File

@@ -37,12 +37,13 @@ class InfoDialog(QDialog):
layout.addWidget(self.gbox_info)
icon_data = icon_cache.get(app['__app__'].model.icon_url)
if icon_data and icon_data.get('icon'):
self.setWindowIcon(icon_data.get('icon'))
else:
self.setWindowIcon(QIcon(app['__app__'].model.get_type_icon_path()))
# THERE ARE CRASHES WITH SOME RARE ICONS ( like insomnia ). IT CAN BE A QT BUG. IN THE MEANTIME, ONLY THE TYPE ICON WILL BE RENDERED
#
# icon_data = icon_cache.get(app['__app__'].model.icon_url)
#
# if icon_data and icon_data.get('icon'):
# self.setWindowIcon(icon_data.get('icon'))
self.setWindowIcon(QIcon(app['__app__'].model.get_type_icon_path()))
for idx, attr in enumerate(sorted(app.keys())):
if attr not in IGNORED_ATTRS and app[attr]:

View File

@@ -29,13 +29,15 @@ class ScreenshotsDialog(QDialog):
self.i18n = i18n
self.http_client = http_client
icon_data = icon_cache.get(pkg.model.icon_url)
if icon_data and icon_data.get('icon'):
self.setWindowIcon(icon_data.get('icon'))
else:
self.setWindowIcon(QIcon(pkg.model.get_type_icon_path()))
# THERE ARE CRASHES WITH SOME RARE ICONS ( like insomnia ). IT CAN BE A QT BUG. IN THE MEANTIME, ONLY THE TYPE ICON WILL BE RENDERED
#
# icon_data = icon_cache.get(pkg.model.icon_url)
#
# if icon_data and icon_data.get('icon'):
# self.setWindowIcon(icon_data.get('icon'))
# else:
# self.setWindowIcon(QIcon(pkg.model.get_type_icon_path()))
self.setWindowIcon(QIcon(pkg.model.get_type_icon_path()))
self.setLayout(QVBoxLayout())
self.img = QLabel()