mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[fix] default tray icons are not displayed in KDE
This commit is contained in:
@@ -14,7 +14,7 @@ from bauh.commons.html import strip_html
|
||||
from bauh.view.qt import dialog
|
||||
from bauh.view.qt.components import IconButton
|
||||
from bauh.view.qt.view_model import PackageView, PackageViewStatus
|
||||
from bauh.view.qt.view_utils import load_icon
|
||||
from bauh.view.qt.view_utils import load_resource_icon
|
||||
from bauh.view.util import resource
|
||||
from bauh.view.util.translation import I18n
|
||||
|
||||
@@ -427,7 +427,7 @@ class AppsTable(QTableWidget):
|
||||
def run():
|
||||
self.window.run_app(pkg)
|
||||
|
||||
item.addWidget(IconButton(load_icon(resource.get_path('img/app_play.svg'), 12), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip']))
|
||||
item.addWidget(IconButton(load_resource_icon('img/app_play.svg', 12), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip']))
|
||||
|
||||
if pkg.model.has_info():
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import os
|
||||
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QInputDialog, QLineEdit
|
||||
|
||||
from bauh.api.abstract.view import MessageType
|
||||
from bauh.commons.system import new_subprocess
|
||||
from bauh.view.qt.dialog import show_message
|
||||
from bauh.view.util import resource
|
||||
from bauh.view.qt.view_utils import load_resource_icon
|
||||
from bauh.view.util.translation import I18n
|
||||
|
||||
|
||||
@@ -19,7 +18,7 @@ def ask_root_password(i18n: I18n):
|
||||
diag.setStyleSheet("""QLineEdit { border-radius: 5px; font-size: 16px; border: 1px solid lightblue }""")
|
||||
diag.setInputMode(QInputDialog.TextInput)
|
||||
diag.setTextEchoMode(QLineEdit.Password)
|
||||
diag.setWindowIcon(QIcon(resource.get_path('img/lock.svg')))
|
||||
diag.setWindowIcon(load_resource_icon('img/lock.svg', 20, 24))
|
||||
diag.setWindowTitle(i18n['popup.root.title'])
|
||||
diag.setLabelText('')
|
||||
diag.setOkButtonText(i18n['popup.root.continue'].capitalize())
|
||||
|
||||
@@ -11,6 +11,7 @@ from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
|
||||
from bauh import __app_name__
|
||||
from bauh.api.abstract.controller import SoftwareManager
|
||||
from bauh.api.abstract.model import PackageUpdate
|
||||
from bauh.view.qt.view_utils import load_resource_icon
|
||||
from bauh.view.util import util, resource
|
||||
from bauh.view.qt.about import AboutDialog
|
||||
from bauh.view.qt.window import ManageWindow
|
||||
@@ -47,7 +48,7 @@ class TrayIcon(QSystemTrayIcon):
|
||||
self.icon_default = QIcon.fromTheme('bauh_tray_default')
|
||||
|
||||
if self.icon_default.isNull():
|
||||
self.icon_default = QIcon(resource.get_path('img/logo.svg'))
|
||||
self.icon_default = load_resource_icon('img/logo.svg', 24)
|
||||
|
||||
if config['ui']['tray']['updates_icon']:
|
||||
self.icon_updates = QIcon(config['ui']['tray']['updates_icon'])
|
||||
@@ -55,7 +56,7 @@ class TrayIcon(QSystemTrayIcon):
|
||||
self.icon_updates = QIcon.fromTheme('bauh_tray_updates')
|
||||
|
||||
if self.icon_updates.isNull():
|
||||
self.icon_updates = QIcon(resource.get_path('img/logo_update.svg'))
|
||||
self.icon_updates = load_resource_icon('img/logo_update.svg', 24)
|
||||
|
||||
self.setIcon(self.icon_default)
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QPixmap
|
||||
|
||||
from bauh.view.util import resource
|
||||
|
||||
|
||||
def load_icon(path: str, width: int, height: int = None) -> QIcon:
|
||||
return QIcon(QPixmap(path).scaled(width, height if height else width, Qt.KeepAspectRatio, Qt.SmoothTransformation))
|
||||
|
||||
|
||||
def load_resource_icon(path: str, width: int, height: int = None) -> QIcon:
|
||||
return load_icon(resource.get_path(path), width, height)
|
||||
|
||||
def load_icon(path: str, size: int) -> QIcon:
|
||||
pixmap = QPixmap(path)
|
||||
return QIcon(pixmap.scaled(size, size, Qt.KeepAspectRatio, Qt.SmoothTransformation))
|
||||
|
||||
@@ -33,7 +33,7 @@ from bauh.view.qt.thread import UpdateSelectedApps, RefreshApps, UninstallApp, D
|
||||
GetAppHistory, SearchPackages, InstallPackage, AnimateProgress, VerifyModels, FindSuggestions, ListWarnings, \
|
||||
AsyncAction, LaunchApp, ApplyFilters, CustomAction, GetScreenshots
|
||||
from bauh.view.qt.view_model import PackageView
|
||||
from bauh.view.qt.view_utils import load_icon
|
||||
from bauh.view.qt.view_utils import load_icon, load_resource_icon
|
||||
from bauh.view.util import util, resource
|
||||
from bauh.view.util.translation import I18n
|
||||
|
||||
@@ -157,7 +157,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_resource_icon('img/logo.svg', 14), 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'
|
||||
|
||||
Reference in New Issue
Block a user