mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 23:24: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):
|
||||
|
||||
Reference in New Issue
Block a user