mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 08:44:15 +02:00
[ui] icons, buttons and colors changes
This commit is contained in:
@@ -14,13 +14,12 @@ from bauh.api.abstract.cache import MemoryCache
|
||||
from bauh.api.abstract.model import PackageStatus
|
||||
from bauh.commons.html import strip_html
|
||||
from bauh.view.qt import dialog
|
||||
from bauh.view.qt.colors import DARK_GREEN, GREEN
|
||||
from bauh.view.qt.components import IconButton
|
||||
from bauh.view.qt.view_model import PackageView
|
||||
from bauh.view.util import resource
|
||||
from bauh.view.util.translation import I18n
|
||||
|
||||
INSTALL_BT_STYLE = 'background: {back}; color: white; font-size: 10px; font-weight: bold'
|
||||
|
||||
NAME_MAX_SIZE = 30
|
||||
DESC_MAX_SIZE = 40
|
||||
PUBLISHER_MAX_SIZE = 25
|
||||
@@ -46,7 +45,7 @@ class UpdateToggleButton(QWidget):
|
||||
if clickable:
|
||||
self.bt.clicked.connect(self.change_state)
|
||||
|
||||
self.bt.setStyleSheet('QToolButton { background: #20A435 } ' +
|
||||
self.bt.setStyleSheet('QToolButton { background: ' + GREEN + ' }' +
|
||||
'QToolButton:checked { background: gray } ' +
|
||||
('QToolButton:disabled { background: #d69003 }' if not clickable and not checked else ''))
|
||||
|
||||
@@ -302,7 +301,8 @@ class AppsTable(QTableWidget):
|
||||
def uninstall():
|
||||
self._uninstall_app(pkg)
|
||||
|
||||
item = self._gen_row_button(self.i18n['uninstall'].capitalize(), INSTALL_BT_STYLE.format(back='#ff1a1a'), uninstall)
|
||||
style = 'color: {c}; font-size: 10px; font-weight: bold;'.format(c='#996633')
|
||||
item = self._gen_row_button(self.i18n['uninstall'].capitalize(), style, uninstall)
|
||||
else:
|
||||
item = QLabel()
|
||||
item.setPixmap((QPixmap(resource.get_path('img/checked.svg'))))
|
||||
@@ -312,7 +312,8 @@ class AppsTable(QTableWidget):
|
||||
def install():
|
||||
self._install_app(pkg)
|
||||
|
||||
item = self._gen_row_button(self.i18n['install'].capitalize(), INSTALL_BT_STYLE.format(back='#088A08'), install)
|
||||
style = 'background: {b}; color: white; font-size: 10px; font-weight: bold'.format(b=GREEN)
|
||||
item = self._gen_row_button(self.i18n['install'].capitalize(), style, install)
|
||||
else:
|
||||
item = None
|
||||
|
||||
@@ -349,7 +350,7 @@ class AppsTable(QTableWidget):
|
||||
tooltip = self.i18n['version.unknown']
|
||||
|
||||
if pkg.model.update:
|
||||
label_version.setStyleSheet("color: #20A435; font-weight: bold")
|
||||
label_version.setStyleSheet("color: {}; font-weight: bold".format(DARK_GREEN))
|
||||
tooltip = self.i18n['version.installed_outdated']
|
||||
|
||||
if pkg.model.installed and pkg.model.update and pkg.model.version and pkg.model.latest_version and pkg.model.version != pkg.model.latest_version:
|
||||
@@ -458,34 +459,36 @@ class AppsTable(QTableWidget):
|
||||
def run():
|
||||
self.window.run_app(pkg)
|
||||
|
||||
bt = IconButton(QIcon(resource.get_path('img/app_play.svg')), i18n=self.i18n, action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip'])
|
||||
bt = IconButton(QIcon(resource.get_path('img/app_play.svg')), i18n=self.i18n, action=run, tooltip=self.i18n['action.run.tooltip'])
|
||||
bt.setEnabled(pkg.model.can_be_run())
|
||||
item.addWidget(bt)
|
||||
|
||||
def get_info():
|
||||
self.window.get_app_info(pkg)
|
||||
|
||||
bt = IconButton(QIcon(resource.get_path('img/app_info.svg')), i18n=self.i18n, action=get_info, background='#2E68D3', tooltip=self.i18n['action.info.tooltip'])
|
||||
bt.setEnabled(bool(pkg.model.has_info()))
|
||||
item.addWidget(bt)
|
||||
|
||||
if not pkg.model.installed:
|
||||
def get_screenshots():
|
||||
self.window.get_screenshots(pkg)
|
||||
|
||||
bt = IconButton(QIcon(resource.get_path('img/camera.svg')), i18n=self.i18n, action=get_screenshots, background='#ac00e6', tooltip=self.i18n['action.screenshots.tooltip'])
|
||||
bt.setEnabled(bool(pkg.model.has_screenshots()))
|
||||
item.addWidget(bt)
|
||||
|
||||
def handle_click():
|
||||
self.show_pkg_settings(pkg)
|
||||
|
||||
settings = self.has_any_settings(pkg)
|
||||
if pkg.model.installed:
|
||||
bt = IconButton(QIcon(resource.get_path('img/app_settings.svg')), i18n=self.i18n, action=handle_click, background='#12ABAB', tooltip=self.i18n['action.settings.tooltip'])
|
||||
icon = QIcon(QIcon(resource.get_path('img/custom_actions.svg')).pixmap(12, 12))
|
||||
bt = IconButton(icon, i18n=self.i18n, action=handle_click, tooltip=self.i18n['action.settings.tooltip'])
|
||||
bt.setEnabled(bool(settings))
|
||||
item.addWidget(bt)
|
||||
|
||||
def get_info():
|
||||
self.window.get_app_info(pkg)
|
||||
|
||||
icon = QIcon(QIcon(resource.get_path('img/app_info.svg')).pixmap(14, 14))
|
||||
bt = IconButton(icon, i18n=self.i18n, action=get_info, tooltip=self.i18n['action.info.tooltip'])
|
||||
bt.setEnabled(bool(pkg.model.has_info()))
|
||||
item.addWidget(bt)
|
||||
|
||||
if not pkg.model.installed:
|
||||
def get_screenshots():
|
||||
self.window.get_screenshots(pkg)
|
||||
|
||||
bt = IconButton(QIcon(resource.get_path('img/camera.svg')), i18n=self.i18n, action=get_screenshots, tooltip=self.i18n['action.screenshots.tooltip'])
|
||||
bt.setEnabled(bool(pkg.model.has_screenshots()))
|
||||
item.addWidget(bt)
|
||||
|
||||
self.setCellWidget(pkg.table_index, col, item)
|
||||
|
||||
def change_headers_policy(self, policy: QHeaderView = QHeaderView.ResizeToContents):
|
||||
|
||||
2
bauh/view/qt/colors.py
Normal file
2
bauh/view/qt/colors.py
Normal file
@@ -0,0 +1,2 @@
|
||||
GREEN = '#68A92E'
|
||||
DARK_GREEN = '#5EAA1A'
|
||||
@@ -401,7 +401,7 @@ class IconButton(QWidget):
|
||||
|
||||
if background:
|
||||
style = 'QToolButton { color: white; background: ' + background + '} '
|
||||
style += 'QToolButton:disabled { color: white; background: grey }'
|
||||
style += 'QToolButton:disabled { color: white; background: blue }'
|
||||
self.bt.setStyleSheet(style)
|
||||
|
||||
if tooltip:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from bauh.view.qt.colors import GREEN
|
||||
|
||||
OK_BUTTON = """QPushButton { background: green; color: white; font-weight: bold}
|
||||
QPushButton:disabled { background-color: gray; }
|
||||
"""
|
||||
OK_BUTTON = """QPushButton { background: %s; color: white; font-weight: bold}
|
||||
QPushButton:disabled { background-color: gray; }""" % GREEN
|
||||
|
||||
GROUP_BOX = """
|
||||
QGroupBox {
|
||||
|
||||
@@ -13,7 +13,7 @@ from bauh import __app_name__
|
||||
from bauh.api.abstract.context import ApplicationContext
|
||||
from bauh.api.abstract.controller import SoftwareManager
|
||||
from bauh.api.abstract.handler import TaskManager
|
||||
from bauh.view.qt import root
|
||||
from bauh.view.qt import root, styles
|
||||
from bauh.view.qt.components import new_spacer
|
||||
from bauh.view.qt.qt_utils import centralize
|
||||
from bauh.view.qt.thread import AnimateProgress
|
||||
@@ -121,7 +121,7 @@ class PreparePanel(QWidget, TaskManager):
|
||||
self.i18n = i18n
|
||||
self.context = context
|
||||
self.manage_window = manage_window
|
||||
self.setWindowTitle('{} ({})'.format(self.i18n['prepare_panel.title.start'].capitalize(), __app_name__))
|
||||
self.setWindowTitle('{} ({})'.format(__app_name__, self.i18n['prepare_panel.title.start'].lower()))
|
||||
self.setMinimumWidth(screen_size.width() * 0.5)
|
||||
self.setMinimumHeight(screen_size.height() * 0.35)
|
||||
self.setMaximumHeight(screen_size.height() * 0.95)
|
||||
@@ -177,6 +177,7 @@ class PreparePanel(QWidget, TaskManager):
|
||||
|
||||
toolbar.addWidget(new_spacer())
|
||||
self.progress_bar = QProgressBar()
|
||||
self.progress_bar.setStyleSheet(styles.PROGRESS_BAR)
|
||||
self.progress_bar.setMaximumHeight(10 if QApplication.instance().style().objectName().lower() == 'windows' else 4)
|
||||
self.progress_bar.setTextVisible(False)
|
||||
self.progress_bar.setVisible(False)
|
||||
@@ -245,7 +246,7 @@ class PreparePanel(QWidget, TaskManager):
|
||||
lb_status = QLabel(label)
|
||||
lb_status.setMinimumWidth(50)
|
||||
lb_status.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
|
||||
lb_status.setStyleSheet("QLabel { color: blue; font-weight: bold; }")
|
||||
lb_status.setStyleSheet("QLabel { font-weight: bold; }")
|
||||
self.table.setCellWidget(task_row, 1, lb_status)
|
||||
|
||||
lb_sub = QLabel()
|
||||
@@ -256,7 +257,7 @@ class PreparePanel(QWidget, TaskManager):
|
||||
|
||||
lb_progress = QLabel('{0:.2f}'.format(0) + '%')
|
||||
lb_progress.setContentsMargins(10, 0, 10, 0)
|
||||
lb_progress.setStyleSheet("QLabel { color: blue; font-weight: bold; }")
|
||||
lb_progress.setStyleSheet("QLabel { font-weight: bold; }")
|
||||
lb_progress.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
|
||||
|
||||
self.table.setCellWidget(task_row, 3, lb_progress)
|
||||
@@ -288,7 +289,7 @@ class PreparePanel(QWidget, TaskManager):
|
||||
task['lb_sub'].setText('')
|
||||
|
||||
for key in ('lb_prog', 'lb_status'):
|
||||
task[key].setStyleSheet('QLabel { color: green; text-decoration: line-through; }')
|
||||
task[key].setStyleSheet('QLabel { color: #68A92E; text-decoration: line-through; }')
|
||||
|
||||
task['finished'] = True
|
||||
self._resize_columns()
|
||||
|
||||
3
bauh/view/qt/styles.py
Normal file
3
bauh/view/qt/styles.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from bauh.view.qt.colors import GREEN
|
||||
|
||||
PROGRESS_BAR = """QProgressBar::chunk { background-color: %s; }""" % GREEN
|
||||
@@ -20,9 +20,10 @@ from bauh.api.http import HttpClient
|
||||
from bauh.commons import user
|
||||
from bauh.commons.html import bold
|
||||
from bauh.view.core.tray_client import notify_tray
|
||||
from bauh.view.qt import dialog, commons, qt_utils, root
|
||||
from bauh.view.qt import dialog, commons, qt_utils, root, styles
|
||||
from bauh.view.qt.about import AboutDialog
|
||||
from bauh.view.qt.apps_table import AppsTable, UpdateToggleButton
|
||||
from bauh.view.qt.colors import GREEN
|
||||
from bauh.view.qt.components import new_spacer, InputFilter, IconButton
|
||||
from bauh.view.qt.confirmation import ConfirmationDialog
|
||||
from bauh.view.qt.history import HistoryDialog
|
||||
@@ -231,7 +232,7 @@ class ManageWindow(QWidget):
|
||||
self.bt_upgrade.setToolTip(i18n['manage_window.bt.upgrade.tooltip'])
|
||||
self.bt_upgrade.setIcon(QIcon(resource.get_path('img/app_update.svg')))
|
||||
self.bt_upgrade.setText(i18n['manage_window.bt.upgrade.text'])
|
||||
self.bt_upgrade.setStyleSheet(toolbar_button_style('#20A435', 'white'))
|
||||
self.bt_upgrade.setStyleSheet(toolbar_button_style(GREEN, 'white'))
|
||||
self.bt_upgrade.clicked.connect(self.update_selected)
|
||||
toolbar_bts.append(self.bt_upgrade)
|
||||
self.ref_bt_upgrade = self.toolbar.addWidget(self.bt_upgrade)
|
||||
@@ -319,6 +320,7 @@ class ManageWindow(QWidget):
|
||||
self.toolbar_bottom.addWidget(new_spacer())
|
||||
|
||||
self.progress_bar = QProgressBar()
|
||||
self.progress_bar.setStyleSheet(styles.PROGRESS_BAR)
|
||||
self.progress_bar.setMaximumHeight(10 if QApplication.instance().style().objectName().lower() == 'windows' else 4)
|
||||
|
||||
self.progress_bar.setTextVisible(False)
|
||||
@@ -334,16 +336,14 @@ class ManageWindow(QWidget):
|
||||
bt_custom_actions.setVisible(bool(self.custom_actions))
|
||||
self.ref_bt_custom_actions = self.toolbar_bottom.addWidget(bt_custom_actions)
|
||||
|
||||
bt_settings = IconButton(QIcon(resource.get_path('img/app_settings.svg')),
|
||||
bt_settings = IconButton(QIcon(resource.get_path('img/settings.svg')),
|
||||
action=self.show_settings,
|
||||
background='#12ABAB',
|
||||
i18n=self.i18n,
|
||||
tooltip=self.i18n['manage_window.bt_settings.tooltip'])
|
||||
self.ref_bt_settings = self.toolbar_bottom.addWidget(bt_settings)
|
||||
|
||||
bt_about = IconButton(QIcon(resource.get_path('img/question.svg')),
|
||||
bt_about = IconButton(QIcon(resource.get_path('img/app_info.svg')),
|
||||
action=self._show_about,
|
||||
background='#2E68D3',
|
||||
i18n=self.i18n,
|
||||
tooltip=self.i18n['manage_window.settings.about'])
|
||||
self.ref_bt_about = self.toolbar_bottom.addWidget(bt_about)
|
||||
|
||||
Reference in New Issue
Block a user