mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-10 21:24:16 +02:00
[improvement] all icons as SVGs
This commit is contained in:
@@ -55,7 +55,7 @@ class AboutDialog(QDialog):
|
||||
gems_widget.layout().addWidget(QLabel())
|
||||
for gem_path in available_gems:
|
||||
icon = QLabel()
|
||||
pxmap = QPixmap(gem_path + '/resources/img/{}.png'.format(gem_path.split('/')[-1]))
|
||||
pxmap = QPixmap(gem_path + '/resources/img/{}.svg'.format(gem_path.split('/')[-1]))
|
||||
icon.setPixmap(pxmap.scaled(24, 24, Qt.KeepAspectRatio, Qt.SmoothTransformation))
|
||||
gems_widget.layout().addWidget(icon)
|
||||
gems_widget.layout().addWidget(QLabel())
|
||||
|
||||
@@ -14,6 +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.util import resource
|
||||
from bauh.view.util.translation import I18n
|
||||
|
||||
@@ -426,26 +427,26 @@ 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(load_icon(resource.get_path('img/app_play.svg'), 12), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip']))
|
||||
|
||||
if pkg.model.has_info():
|
||||
|
||||
def get_info():
|
||||
self.window.get_app_info(pkg)
|
||||
|
||||
item.addWidget(IconButton(icon_path=resource.get_path('img/app_info.svg'), action=get_info, background='#2E68D3', tooltip=self.i18n['action.info.tooltip']))
|
||||
item.addWidget(IconButton(QIcon(resource.get_path('img/app_info.svg')), action=get_info, background='#2E68D3', tooltip=self.i18n['action.info.tooltip']))
|
||||
|
||||
if pkg.model.has_screenshots():
|
||||
def get_screenshots():
|
||||
self.window.get_screenshots(pkg)
|
||||
|
||||
item.addWidget(IconButton(icon_path=resource.get_path('img/camera.svg'), action=get_screenshots, background='purple', tooltip=self.i18n['action.screenshots.tooltip']))
|
||||
item.addWidget(IconButton(QIcon(resource.get_path('img/camera.svg')), action=get_screenshots, background='purple', tooltip=self.i18n['action.screenshots.tooltip']))
|
||||
|
||||
def handle_click():
|
||||
self.show_pkg_settings(pkg)
|
||||
|
||||
if self.has_any_settings(pkg):
|
||||
bt = IconButton(icon_path=resource.get_path('img/app_settings.svg'), action=handle_click, background='#12ABAB', tooltip=self.i18n['action.settings.tooltip'])
|
||||
bt = IconButton(QIcon(resource.get_path('img/app_settings.svg')), action=handle_click, background='#12ABAB', tooltip=self.i18n['action.settings.tooltip'])
|
||||
item.addWidget(bt)
|
||||
|
||||
self.setCellWidget(pkg.table_index, col, item)
|
||||
|
||||
@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGrid
|
||||
|
||||
from bauh.api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType, \
|
||||
TextInputComponent, FormComponent, FileChooserComponent
|
||||
from bauh.view.qt import css
|
||||
from bauh.view.qt import css, view_utils
|
||||
from bauh.view.util import resource
|
||||
from bauh.view.util.translation import I18n
|
||||
|
||||
@@ -182,8 +182,9 @@ class MultipleSelectQt(QGroupBox):
|
||||
|
||||
for op in model.options: # loads the help icon if at least one option has a tooltip
|
||||
if op.tooltip:
|
||||
with open(resource.get_path('img/help.png'), 'rb') as f:
|
||||
with open(resource.get_path('img/about.svg'), 'rb') as f:
|
||||
pixmap_help.loadFromData(f.read())
|
||||
pixmap_help = pixmap_help.scaled(16, 16, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
||||
break
|
||||
|
||||
for op in model.options:
|
||||
@@ -240,10 +241,10 @@ class InputFilter(QLineEdit):
|
||||
|
||||
class IconButton(QWidget):
|
||||
|
||||
def __init__(self, icon_path: str, action, background: str = None, align: int = Qt.AlignCenter, tooltip: str = None):
|
||||
def __init__(self, icon: QIcon, action, background: str = None, align: int = Qt.AlignCenter, tooltip: str = None):
|
||||
super(IconButton, self).__init__()
|
||||
self.bt = QToolButton()
|
||||
self.bt.setIcon(QIcon(icon_path))
|
||||
self.bt.setIcon(icon)
|
||||
self.bt.clicked.connect(action)
|
||||
|
||||
if background:
|
||||
|
||||
@@ -49,7 +49,7 @@ class GemSelectorPanel(QWidget):
|
||||
op = InputOption(label=i18n.get('gem.{}.label'.format(modname), modname.capitalize()),
|
||||
tooltip=i18n.get('gem.{}.info'.format(modname)),
|
||||
value=modname,
|
||||
icon_path='{r}/gems/{n}/resources/img/{n}.png'.format(r=ROOT_DIR, n=modname))
|
||||
icon_path='{r}/gems/{n}/resources/img/{n}.svg'.format(r=ROOT_DIR, n=modname))
|
||||
|
||||
gem_options.append(op)
|
||||
self.gem_map[modname] = m
|
||||
|
||||
@@ -19,7 +19,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.png')))
|
||||
diag.setWindowIcon(QIcon(resource.get_path('img/lock.svg')))
|
||||
diag.setWindowTitle(i18n['popup.root.title'])
|
||||
diag.setLabelText('')
|
||||
diag.setOkButtonText(i18n['popup.root.continue'].capitalize())
|
||||
|
||||
@@ -47,7 +47,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.png'))
|
||||
self.icon_default = QIcon(resource.get_path('img/logo.svg'))
|
||||
|
||||
if config['ui']['tray']['updates_icon']:
|
||||
self.icon_updates = QIcon(config['ui']['tray']['updates_icon'])
|
||||
@@ -55,7 +55,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.png'))
|
||||
self.icon_updates = QIcon(resource.get_path('img/logo_update.svg'))
|
||||
|
||||
self.setIcon(self.icon_default)
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ class ManageWindow(QWidget):
|
||||
|
||||
self.bt_installed = QPushButton()
|
||||
self.bt_installed.setToolTip(self.i18n['manage_window.bt.installed.tooltip'])
|
||||
self.bt_installed.setIcon(QIcon(resource.get_path('img/disk.png')))
|
||||
self.bt_installed.setIcon(QIcon(resource.get_path('img/disk.svg')))
|
||||
self.bt_installed.setText(self.i18n['manage_window.bt.installed.text'].capitalize())
|
||||
self.bt_installed.clicked.connect(self._show_installed)
|
||||
self.bt_installed.setStyleSheet(toolbar_button_style('#A94E0A'))
|
||||
@@ -318,7 +318,7 @@ class ManageWindow(QWidget):
|
||||
self.combo_styles.setStyleSheet('QComboBox {font-size: 12px;}')
|
||||
self.ref_combo_styles = self.toolbar_bottom.addWidget(self.combo_styles)
|
||||
|
||||
bt_settings = IconButton(icon_path=resource.get_path('img/app_settings.svg'),
|
||||
bt_settings = IconButton(QIcon(resource.get_path('img/app_settings.svg')),
|
||||
action=self._show_settings_menu,
|
||||
background='#12ABAB',
|
||||
tooltip=self.i18n['manage_window.bt_settings.tooltip'])
|
||||
|
||||
Reference in New Issue
Block a user