From aff13125322ffc26533e2ab83f5fd93580644006 Mon Sep 17 00:00:00 2001 From: Denis Surkes Date: Wed, 25 Dec 2019 11:26:25 -0500 Subject: [PATCH] Fix images issues on HDPI resolution --- bauh/app.py | 2 + bauh/view/qt/apps_table.py | 6 +- bauh/view/qt/window.py | 7 +- bauh/view/resources/img/app_play.svg | 156 +++++++++++++++++++++++++++ 4 files changed, 165 insertions(+), 6 deletions(-) create mode 100644 bauh/view/resources/img/app_play.svg diff --git a/bauh/app.py b/bauh/app.py index 28bdce9b..01602d06 100755 --- a/bauh/app.py +++ b/bauh/app.py @@ -3,6 +3,7 @@ import sys from threading import Thread import urllib3 +from PyQt5.QtCore import Qt from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QApplication @@ -71,6 +72,7 @@ def main(): app.setApplicationVersion(__version__) app_icon = util.get_default_icon()[1] app.setWindowIcon(app_icon) + app.setAttribute(Qt.AA_UseHighDpiPixmaps) # This fix images on HDPI resolution, not tested on non HDPI if local_config['ui']['style']: app.setStyle(str(local_config['ui']['style'])) diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index 2a68cda1..66aa40b2 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -2,7 +2,7 @@ import os from threading import Lock from typing import List -from PyQt5.QtCore import Qt, QUrl +from PyQt5.QtCore import Qt, QUrl, QSize from PyQt5.QtGui import QPixmap, QIcon, QCursor from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply from PyQt5.QtWidgets import QTableWidget, QTableView, QMenu, QAction, QTableWidgetItem, QToolButton, QWidget, \ @@ -77,7 +77,7 @@ class AppsTable(QTableWidget): self.setHorizontalHeaderLabels(['' for _ in range(self.columnCount())]) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.icon_logo = QIcon(resource.get_path('img/logo.svg')) - self.pixmap_verified = QPixmap(resource.get_path('img/verified.svg')) + self.pixmap_verified = QIcon(resource.get_path('img/verified.svg')).pixmap(QSize(10, 10)) self.network_man = QNetworkAccessManager() self.network_man.finished.connect(self._load_icon_and_cache) @@ -426,7 +426,7 @@ class AppsTable(QTableWidget): def run(): self.window.run_app(pkg) - item.addWidget(IconButton(icon_path=resource.get_path('img/app_play.png'), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip'])) + item.addWidget(IconButton(icon_path=resource.get_path('img/app_play.svg'), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip'])) if pkg.model.has_info(): diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 3d89f659..59bd4087 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -118,7 +118,8 @@ class ManageWindow(QWidget): self.toolbar_search.addWidget(self.input_search) label_pos_search = QLabel() - label_pos_search.setPixmap(QPixmap(resource.get_path('img/search.svg'))) + # label_pos_search.setPixmap(QPixmap(resource.get_path('img/search.svg'))) + label_pos_search.setPixmap(QIcon(resource.get_path('img/search.svg')).pixmap(QSize(10,10))) label_pos_search.setStyleSheet(""" background: white; padding-right: 10px; border-top-right-radius: 5px; @@ -157,7 +158,7 @@ class ManageWindow(QWidget): self.combo_filter_type.lineEdit().setReadOnly(True) self.combo_filter_type.lineEdit().setAlignment(Qt.AlignCenter) self.combo_filter_type.activated.connect(self._handle_type_filter) - self.combo_filter_type.addItem(load_icon(resource.get_path('img/logo.svg'), 14), self.i18n['type'].capitalize(), self.any_type_filter) + self.combo_filter_type.addItem(load_icon(resource.get_path('img/logo.svg'), 48), self.i18n['type'].capitalize(), self.any_type_filter) self.ref_combo_filter_type = self.toolbar.addWidget(self.combo_filter_type) self.any_category_filter = 'any' @@ -777,7 +778,7 @@ class ManageWindow(QWidget): icon = self.cache_type_filter_icons.get(app_type) if not icon: - icon = load_icon(icon_path, 14) + icon = load_icon(icon_path, 18) self.cache_type_filter_icons[app_type] = icon self.combo_filter_type.addItem(icon, app_type.capitalize(), app_type) diff --git a/bauh/view/resources/img/app_play.svg b/bauh/view/resources/img/app_play.svg new file mode 100644 index 00000000..67a63544 --- /dev/null +++ b/bauh/view/resources/img/app_play.svg @@ -0,0 +1,156 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file