[improvement] type filter view

This commit is contained in:
Vinícius Moreira
2019-12-27 15:22:15 -03:00
parent 76c1762dbe
commit 4471c7ba6d
2 changed files with 8 additions and 7 deletions

View File

@@ -427,26 +427,26 @@ class AppsTable(QTableWidget):
def run(): def run():
self.window.run_app(pkg) self.window.run_app(pkg)
item.addWidget(IconButton(icon_path=resource.get_path('img/app_play.svg'), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip'])) item.addWidget(IconButton(QIcon(resource.get_path('img/app_play.svg')), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip']))
if pkg.model.has_info(): if pkg.model.has_info():
def get_info(): def get_info():
self.window.get_app_info(pkg) 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(): if pkg.model.has_screenshots():
def get_screenshots(): def get_screenshots():
self.window.get_screenshots(pkg) 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(): def handle_click():
self.show_pkg_settings(pkg) self.show_pkg_settings(pkg)
if self.has_any_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) item.addWidget(bt)
self.setCellWidget(pkg.table_index, col, item) self.setCellWidget(pkg.table_index, col, item)

View File

@@ -8,7 +8,7 @@ from typing import List, Type, Set
from PyQt5.QtCore import QEvent, Qt, QSize, pyqtSignal from PyQt5.QtCore import QEvent, Qt, QSize, pyqtSignal
from PyQt5.QtGui import QIcon, QWindowStateChangeEvent, QPixmap, QCursor from PyQt5.QtGui import QIcon, QWindowStateChangeEvent, QPixmap, QCursor
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QCheckBox, QHeaderView, QToolBar, \ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QCheckBox, QHeaderView, QToolBar, \
QLabel, QPlainTextEdit, QLineEdit, QProgressBar, QPushButton, QComboBox, QMenu, QAction, QApplication QLabel, QPlainTextEdit, QLineEdit, QProgressBar, QPushButton, QComboBox, QMenu, QAction, QApplication, QListView
from bauh.api.abstract.cache import MemoryCache from bauh.api.abstract.cache import MemoryCache
from bauh.api.abstract.context import ApplicationContext from bauh.api.abstract.context import ApplicationContext
@@ -152,6 +152,7 @@ class ManageWindow(QWidget):
self.any_type_filter = 'any' self.any_type_filter = 'any'
self.cache_type_filter_icons = {} self.cache_type_filter_icons = {}
self.combo_filter_type = QComboBox() self.combo_filter_type = QComboBox()
self.combo_filter_type.setView(QListView())
self.combo_filter_type.setStyleSheet('QLineEdit { height: 2px; }') self.combo_filter_type.setStyleSheet('QLineEdit { height: 2px; }')
self.combo_filter_type.setSizeAdjustPolicy(QComboBox.AdjustToContents) self.combo_filter_type.setSizeAdjustPolicy(QComboBox.AdjustToContents)
self.combo_filter_type.setEditable(True) self.combo_filter_type.setEditable(True)
@@ -319,7 +320,7 @@ class ManageWindow(QWidget):
self.combo_styles.setStyleSheet('QComboBox {font-size: 12px;}') self.combo_styles.setStyleSheet('QComboBox {font-size: 12px;}')
self.ref_combo_styles = self.toolbar_bottom.addWidget(self.combo_styles) 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, action=self._show_settings_menu,
background='#12ABAB', background='#12ABAB',
tooltip=self.i18n['manage_window.bt_settings.tooltip']) tooltip=self.i18n['manage_window.bt_settings.tooltip'])
@@ -778,7 +779,7 @@ class ManageWindow(QWidget):
icon = self.cache_type_filter_icons.get(app_type) icon = self.cache_type_filter_icons.get(app_type)
if not icon: if not icon:
icon = load_icon(icon_path, 14) icon = load_icon(icon_path, 18)
self.cache_type_filter_icons[app_type] = icon self.cache_type_filter_icons[app_type] = icon
self.combo_filter_type.addItem(icon, app_type.capitalize(), app_type) self.combo_filter_type.addItem(icon, app_type.capitalize(), app_type)