appimage categories

This commit is contained in:
Vinicius Moreira
2019-10-10 15:54:26 -03:00
parent fd03f663e1
commit 51bbab0658
7 changed files with 33 additions and 15 deletions

View File

@@ -1,24 +1,23 @@
from typing import List
from bauh.api.abstract.model import SoftwarePackage from bauh.api.abstract.model import SoftwarePackage
from bauh.commons import resource from bauh.commons import resource
from bauh.gems.appimage import ROOT_DIR, INSTALLATION_PATH from bauh.gems.appimage import ROOT_DIR, INSTALLATION_PATH
CACHED_ATTRS = {'name', 'description', 'version', 'url_download', 'author', 'license', 'source', 'icon_path', 'github'} CACHED_ATTRS = {'name', 'description', 'version', 'url_download', 'author', 'license', 'source',
'icon_path', 'github', 'categories'}
class AppImage(SoftwarePackage): class AppImage(SoftwarePackage):
def __init__(self, name: str = None, description: str = None, github: str = None, source: str = None, version: str = None, def __init__(self, name: str = None, description: str = None, github: str = None, source: str = None, version: str = None,
url_download: str = None, url_icon: str = None, url_screenshot: str = None, license: str = None, author: str = None, url_download: str = None, url_icon: str = None, url_screenshot: str = None, license: str = None, author: str = None,
pictures: List[str] = None, icon_path: str = None, installed: bool = False, categories=None, icon_path: str = None, installed: bool = False,
url_download_latest_version: str = None): url_download_latest_version: str = None):
super(AppImage, self).__init__(id=name, name=name, version=version, latest_version=version, super(AppImage, self).__init__(id=name, name=name, version=version, latest_version=version,
icon_url=url_icon, license=license, description=description, icon_url=url_icon, license=license, description=description,
installed=installed) installed=installed)
self.source = source self.source = source
self.github = github self.github = github
self.pictures = pictures self.categories = categories.split(',') if isinstance(categories, str) else categories
self.url_download = url_download self.url_download = url_download
self.icon_path = icon_path self.icon_path = icon_path
self.url_screenshot = url_screenshot self.url_screenshot = url_screenshot

View File

@@ -1,4 +1,4 @@
APP_ATTRS = ('name', 'description', 'github', 'source', 'version', 'url_download', 'url_icon', 'url_screenshot', 'license', 'author') APP_ATTRS = ('name', 'description', 'github', 'source', 'version', 'url_download', 'url_icon', 'url_screenshot', 'license', 'author', 'categories')
RELEASE_ATTRS = ('version', 'url_download', 'published_at') RELEASE_ATTRS = ('version', 'url_download', 'published_at')

View File

@@ -501,7 +501,7 @@ class GetScreenshots(AsyncAction):
for url in screenshots: for url in screenshots:
res = self.http_client.get(url) res = self.http_client.get(url)
if res and res.status_code == 200: if res and res.status_code == 200 and res.content:
pixmap = QPixmap() pixmap = QPixmap()
pixmap.loadFromData(res.content) pixmap.loadFromData(res.content)
imgs.append(pixmap) imgs.append(pixmap)

View File

@@ -128,22 +128,22 @@ 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.setStyleSheet('QLineEdit { height: 2px}') self.combo_filter_type.setStyleSheet('QLineEdit { height: 2px; }')
self.combo_filter_type.setEditable(True) self.combo_filter_type.setEditable(True)
self.combo_filter_type.lineEdit().setReadOnly(True) self.combo_filter_type.lineEdit().setReadOnly(True)
self.combo_filter_type.lineEdit().setAlignment(Qt.AlignCenter) self.combo_filter_type.lineEdit().setAlignment(Qt.AlignCenter)
self.combo_filter_type.activated.connect(self._handle_type_filter) 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[self.any_type_filter].capitalize(), self.any_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.ref_combo_filter_type = self.toolbar.addWidget(self.combo_filter_type) self.ref_combo_filter_type = self.toolbar.addWidget(self.combo_filter_type)
self.any_category_filter = 'any' self.any_category_filter = 'any'
self.combo_categories = QComboBox() self.combo_categories = QComboBox()
self.combo_categories.setStyleSheet('QLineEdit { height: 2px}') self.combo_categories.setStyleSheet('QLineEdit { height: 2px; width: 50px; }')
self.combo_categories.setEditable(True) self.combo_categories.setEditable(True)
self.combo_categories.lineEdit().setReadOnly(True) self.combo_categories.lineEdit().setReadOnly(True)
self.combo_categories.lineEdit().setAlignment(Qt.AlignCenter) self.combo_categories.lineEdit().setAlignment(Qt.AlignCenter)
self.combo_categories.activated.connect(self._handle_category_filter) self.combo_categories.activated.connect(self._handle_category_filter)
self.combo_categories.addItem('--{}--'.format(self.i18n['category'].capitalize()), self.any_category_filter) self.combo_categories.addItem('--- {} ---'.format(self.i18n['category'].capitalize()), self.any_category_filter)
self.ref_combo_categories = self.toolbar.addWidget(self.combo_categories) self.ref_combo_categories = self.toolbar.addWidget(self.combo_categories)
self.input_name_filter = InputFilter(self.apply_filters_async) self.input_name_filter = InputFilter(self.apply_filters_async)
@@ -684,7 +684,7 @@ class ManageWindow(QWidget):
else: else:
self.category_filter = self.any_category_filter self.category_filter = self.any_category_filter
if categories and len(categories) > 1: if categories:
if self.combo_categories.count() > 1: if self.combo_categories.count() > 1:
for _ in range(self.combo_categories.count() - 1): for _ in range(self.combo_categories.count() - 1):
self.combo_categories.removeItem(1) self.combo_categories.removeItem(1)

View File

@@ -126,3 +126,4 @@ category=category
categories=categories categories=categories
summary=summary summary=summary
popup.screenshots.no_screenshot.body=it was not possible to retrieve {} screenshots popup.screenshots.no_screenshot.body=it was not possible to retrieve {} screenshots
terminalemulator=terminal

View File

@@ -129,7 +129,16 @@ manage_window.status.screenshots=Obteniendo imágenes de {}
action.screenshots.tooltip=Haga clic aquí para ver algunas fotos de esta aplicación action.screenshots.tooltip=Haga clic aquí para ver algunas fotos de esta aplicación
popup.screenshots.no_screenshot.body=No fue posible recuperar las fotos de {} popup.screenshots.no_screenshot.body=No fue posible recuperar las fotos de {}
games=juegos games=juegos
game=juego
videoeditor=edito de video videoeditor=edito de video
browser=navegador browser=navegador
music=música music=música
development=desarrollo development=desarrollo
network=red
networks=redes
graphics=gráficos
system=sistema
utility=utilidad
terminalemulator=terminal
database=base de datos
databases=bases de datos

View File

@@ -129,7 +129,16 @@ manage_window.status.screenshots=Obtendo imagens de {}
action.screenshots.tooltip=Clique aqui para ver algumas fotos desse aplicativo action.screenshots.tooltip=Clique aqui para ver algumas fotos desse aplicativo
popup.screenshots.no_screenshot.body=Não foi possível obter as fotos de {} popup.screenshots.no_screenshot.body=Não foi possível obter as fotos de {}
games=jogos games=jogos
game=jogo
videoeditor=edito de vídeo videoeditor=edito de vídeo
browser=navegador browser=navegador
music=música music=música
development=desenvolvimento development=desenvolvimento
network=rede
networks=redes
graphics=gráficos
system=sistema
utility=utilidade
terminalemulator=terminal
database=banco de dados
databases=bancos de dados