Merge branch 'staging' into modules

# Conflicts:
#	fpakman/resources/locale/en
#	fpakman/resources/locale/es
#	fpakman/resources/locale/pt
#	fpakman/view/qt/apps_table.py
This commit is contained in:
Vinicius Moreira
2019-08-01 14:42:44 -03:00
6 changed files with 47 additions and 25 deletions

View File

@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- search results sorting takes an average of 35% less time, reaching 60% in some scenarios - search results sorting takes an average of 35% less time, reaching 60% in some scenarios
- app boot takes an average of 80% less time - app boot takes an average of 80% less time
- showing a warning popup after initialization when no Flatpak remotes are set - showing a warning popup after initialization when no Flatpak remotes are set
- installed / uninstalled icons replaced by install / uninstall button
### Fixes: ### Fixes:
- apps table not showing empty descriptions - apps table not showing empty descriptions
- replacing default app icons by null icons - replacing default app icons by null icons

View File

@@ -6,6 +6,8 @@ manage_window.apps_table.row.actions.history=History
manage_window.apps_table.row.actions.uninstall=Uninstall manage_window.apps_table.row.actions.uninstall=Uninstall
manage_window.apps_table.row.actions.uninstall.popup.title=Uninstall manage_window.apps_table.row.actions.uninstall.popup.title=Uninstall
manage_window.apps_table.row.actions.uninstall.popup.body=Remove {} ? manage_window.apps_table.row.actions.uninstall.popup.body=Remove {} ?
manage_window.apps_table.row.actions.install.popup.title=Installation
manage_window.apps_table.row.actions.install.popup.body=Do you wish to install {} ?
manage_window.apps_table.row.actions.downgrade=Downgrade manage_window.apps_table.row.actions.downgrade=Downgrade
manage_window.apps_table.row.actions.downgrade.popup.body=Do you really want to downgrade {} ? manage_window.apps_table.row.actions.downgrade.popup.body=Do you really want to downgrade {} ?
manage_window.apps_table.row.actions.install=Install manage_window.apps_table.row.actions.install=Install
@@ -75,3 +77,5 @@ version.installed_outdated=the installed version is outdated
version.unknown=not informed version.unknown=not informed
app.name=application name app.name=application name
warning=warning warning=warning
install=install
uninstall=uninstall

View File

@@ -7,6 +7,8 @@ manage_window.apps_table.row.actions.history=Historia
manage_window.apps_table.row.actions.uninstall=Desinstalar manage_window.apps_table.row.actions.uninstall=Desinstalar
manage_window.apps_table.row.actions.uninstall.popup.title=Desinstalación manage_window.apps_table.row.actions.uninstall.popup.title=Desinstalación
manage_window.apps_table.row.actions.uninstall.popup.body=¿Eliminar {}? manage_window.apps_table.row.actions.uninstall.popup.body=¿Eliminar {}?
manage_window.apps_table.row.actions.install.popup.title=Instalación
manage_window.apps_table.row.actions.install.popup.body=Desea instalar {} ?
manage_window.apps_table.row.actions.downgrade=Revertir versión manage_window.apps_table.row.actions.downgrade=Revertir versión
manage_window.apps_table.row.actions.downgrade.popup.body=¿Realmente quieres revertir la versión actual de {}? manage_window.apps_table.row.actions.downgrade.popup.body=¿Realmente quieres revertir la versión actual de {}?
manage_window.apps_table.row.actions.install=Instalar manage_window.apps_table.row.actions.install=Instalar
@@ -76,3 +78,5 @@ version.installed_outdated=la versión instalada está desactualizada
version.unknown=versión no informada version.unknown=versión no informada
app.name=nombre del aplicativo app.name=nombre del aplicativo
warning=aviso warning=aviso
install=instalar
uninstall=desinstalar

View File

@@ -7,6 +7,8 @@ manage_window.apps_table.row.actions.history=Histórico
manage_window.apps_table.row.actions.uninstall=Desinstalar manage_window.apps_table.row.actions.uninstall=Desinstalar
manage_window.apps_table.row.actions.uninstall.popup.title=Desinstalação manage_window.apps_table.row.actions.uninstall.popup.title=Desinstalação
manage_window.apps_table.row.actions.uninstall.popup.body=Remover {} ? manage_window.apps_table.row.actions.uninstall.popup.body=Remover {} ?
manage_window.apps_table.row.actions.install.popup.title=Instalação
manage_window.apps_table.row.actions.install.popup.body=Deseja instalar {} ?
manage_window.apps_table.row.actions.downgrade=Reverter versão manage_window.apps_table.row.actions.downgrade=Reverter versão
manage_window.apps_table.row.actions.downgrade.popup.body=Você realmente quer reverter a versão atual de {} ? manage_window.apps_table.row.actions.downgrade.popup.body=Você realmente quer reverter a versão atual de {} ?
manage_window.apps_table.row.actions.install=Instalar manage_window.apps_table.row.actions.install=Instalar
@@ -76,3 +78,5 @@ version.installed_outdated=a versão instalada está desatualizada
version.unknown=versão não informada version.unknown=versão não informada
app.name=nome do aplicativo app.name=nome do aplicativo
warning=aviso warning=aviso
install=instalar
uninstall=desinstalar

View File

@@ -6,7 +6,7 @@ from PyQt5.QtCore import Qt, QUrl
from PyQt5.QtGui import QPixmap, QIcon, QCursor from PyQt5.QtGui import QPixmap, QIcon, QCursor
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
from PyQt5.QtWidgets import QTableWidget, QTableView, QMenu, QAction, QTableWidgetItem, QToolButton, QWidget, \ from PyQt5.QtWidgets import QTableWidget, QTableView, QMenu, QAction, QTableWidgetItem, QToolButton, QWidget, \
QHeaderView, QLabel, QHBoxLayout QHeaderView, QLabel, QHBoxLayout, QPushButton
from fpakman_api.abstract.model import ApplicationStatus from fpakman_api.abstract.model import ApplicationStatus
from fpakman.core import resource from fpakman.core import resource
@@ -16,6 +16,8 @@ from fpakman.util import util
from fpakman.view.qt import dialog from fpakman.view.qt import dialog
from fpakman.view.qt.view_model import ApplicationView, ApplicationViewStatus from fpakman.view.qt.view_model import ApplicationView, ApplicationViewStatus
INSTALL_BT_STYLE = 'background: {back}; color: white; margin-top: 6px; padding: 1px; font-size: 9px; font-weight: bold'
class UpdateToggleButton(QToolButton): class UpdateToggleButton(QToolButton):
@@ -77,12 +79,6 @@ class AppsTable(QTableWidget):
menu_row = QMenu() menu_row = QMenu()
if not app.model.installed and app.model.can_be_installed():
action_install = QAction(self.window.locale_keys["manage_window.apps_table.row.actions.install"])
action_install.setIcon(QIcon(resource.get_path('img/install.svg')))
action_install.triggered.connect(self._install_app)
menu_row.addAction(action_install)
if app.model.has_info(): if app.model.has_info():
action_info = QAction(self.window.locale_keys["manage_window.apps_table.row.actions.info"]) action_info = QAction(self.window.locale_keys["manage_window.apps_table.row.actions.info"])
action_info.setIcon(QIcon(resource.get_path('img/info.svg'))) action_info.setIcon(QIcon(resource.get_path('img/info.svg')))
@@ -103,12 +99,6 @@ class AppsTable(QTableWidget):
action_history.triggered.connect(self._get_app_history) action_history.triggered.connect(self._get_app_history)
menu_row.addAction(action_history) menu_row.addAction(action_history)
if app.model.can_be_uninstalled():
action_uninstall = QAction(self.window.locale_keys["manage_window.apps_table.row.actions.uninstall"])
action_uninstall.setIcon(QIcon(resource.get_path('img/uninstall.svg')))
action_uninstall.triggered.connect(self._uninstall_app)
menu_row.addAction(action_uninstall)
if app.model.can_be_downgraded(): if app.model.can_be_downgraded():
action_downgrade = QAction(self.window.locale_keys["manage_window.apps_table.row.actions.downgrade"]) action_downgrade = QAction(self.window.locale_keys["manage_window.apps_table.row.actions.downgrade"])
action_downgrade.triggered.connect(self._downgrade_app) action_downgrade.triggered.connect(self._downgrade_app)
@@ -150,7 +140,7 @@ class AppsTable(QTableWidget):
selected_app = self.get_selected_app() selected_app = self.get_selected_app()
if dialog.ask_confirmation(title=self.window.locale_keys['manage_window.apps_table.row.actions.uninstall.popup.title'], if dialog.ask_confirmation(title=self.window.locale_keys['manage_window.apps_table.row.actions.uninstall.popup.title'],
body=self.window.locale_keys['manage_window.apps_table.row.actions.uninstall.popup.body'].format(selected_app.model.base_data.name), body=self.window.locale_keys['manage_window.apps_table.row.actions.uninstall.popup.body'].format(selected_app),
locale_keys=self.window.locale_keys): locale_keys=self.window.locale_keys):
self.window.uninstall_app(selected_app) self.window.uninstall_app(selected_app)
@@ -172,7 +162,14 @@ class AppsTable(QTableWidget):
self.window.get_app_history(self.get_selected_app()) self.window.get_app_history(self.get_selected_app())
def _install_app(self): def _install_app(self):
self.window.install_app(self.get_selected_app()) selected_app = self.get_selected_app()
if dialog.ask_confirmation(
title=self.window.locale_keys['manage_window.apps_table.row.actions.install.popup.title'],
body=self.window.locale_keys['manage_window.apps_table.row.actions.install.popup.body'].format(selected_app),
locale_keys=self.window.locale_keys):
self.window.install_app(self.get_selected_app())
def _load_icon_and_cache(self, http_response): def _load_icon_and_cache(self, http_response):
icon_url = http_response.url().toString() icon_url = http_response.url().toString()
@@ -222,20 +219,29 @@ class AppsTable(QTableWidget):
self.setCellWidget(idx, 5, col_update) self.setCellWidget(idx, 5, col_update)
def _set_col_installed(self, idx: int, app_v: ApplicationView): def _set_col_installed(self, idx: int, app_v: ApplicationView):
col_installed = QLabel()
if app_v.model.installed: if app_v.model.installed:
img_name = 'checked' if app_v.model.can_be_uninstalled():
tooltip = self.window.locale_keys['installed'] col = QPushButton()
col.setText(self.window.locale_keys['uninstall'].capitalize())
col.setStyleSheet('QPushButton { ' + INSTALL_BT_STYLE.format(back='#cc0000') + '}')
col.setMaximumHeight(20)
col.clicked.connect(self._uninstall_app)
else:
col = QLabel()
col.setPixmap((QPixmap(resource.get_path('img/checked.svg'))))
col.setAlignment(Qt.AlignCenter)
col.setToolTip(self.window.locale_keys['installed'])
elif app_v.model.can_be_installed():
col = QPushButton()
col.setText(self.window.locale_keys['install'].capitalize())
col.setStyleSheet('QPushButton { ' + INSTALL_BT_STYLE.format(back='green') + '}')
col.setMaximumHeight(20)
col.clicked.connect(self._install_app)
else: else:
img_name = 'red_cross' col = None
tooltip = self.window.locale_keys['not_installed']
col_installed.setPixmap((QPixmap(resource.get_path('img/{}.svg'.format(img_name))))) self.setCellWidget(idx, 4, col)
col_installed.setAlignment(Qt.AlignCenter)
col_installed.setToolTip(tooltip)
self.setCellWidget(idx, 4, col_installed)
def _set_col_type(self, idx: int, app_v: ApplicationView): def _set_col_type(self, idx: int, app_v: ApplicationView):
col_type = QLabel() col_type = QLabel()

View File

@@ -17,3 +17,6 @@ class ApplicationView:
self.update_checked = model.update self.update_checked = model.update
self.visible = visible self.visible = visible
self.status = ApplicationViewStatus.LOADING self.status = ApplicationViewStatus.LOADING
def __repr__(self):
return '{} ( {} )'.format(self.model.base_data.name, self.model.get_type())