From 9347561f57437453fd934ef2cdc0753775388a44 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 7 Oct 2019 18:46:21 -0300 Subject: [PATCH] AppImage info --- bauh/gems/appimage/controller.py | 4 ++-- bauh/gems/appimage/model.py | 5 ++--- bauh/gems/appimage/resources/locale/en | 4 +++- bauh/gems/appimage/resources/locale/es | 4 +++- bauh/gems/appimage/resources/locale/pt | 4 +++- bauh/view/qt/info.py | 12 ++++++------ bauh/view/qt/window.py | 2 +- bauh/view/resources/locale/en | 4 +++- bauh/view/resources/locale/es | 4 +++- bauh/view/resources/locale/pt | 4 +++- 10 files changed, 29 insertions(+), 18 deletions(-) diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index 01ce4805..c7f35c07 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -74,6 +74,7 @@ class AppImageManager(SoftwareManager): if path: with open(path) as f: app = AppImage(installed=True, **json.loads(f.read())) + app.icon_url = app.icon_path res.installed.append(app) @@ -108,8 +109,7 @@ class AppImageManager(SoftwareManager): pass def get_info(self, pkg: AppImage) -> dict: - # TODO - pass + return pkg.get_data_to_cache() def get_history(self, pkg: AppImage) -> PackageHistory: # TODO diff --git a/bauh/gems/appimage/model.py b/bauh/gems/appimage/model.py index b97528d8..e70389b7 100644 --- a/bauh/gems/appimage/model.py +++ b/bauh/gems/appimage/model.py @@ -4,7 +4,7 @@ from bauh.api.abstract.model import SoftwarePackage from bauh.commons import resource from bauh.gems.appimage import ROOT_DIR, INSTALLATION_PATH -CACHED_ATTRS = {'name', 'description', 'version', 'icon_path', 'author'} +CACHED_ATTRS = {'name', 'description', 'version', 'url_download', 'author', 'license', 'source', 'icon_path'} class AppImage(SoftwarePackage): @@ -30,8 +30,7 @@ class AppImage(SoftwarePackage): return False def has_info(self): - # TODO - return False + return True def can_be_downgraded(self): # TODO diff --git a/bauh/gems/appimage/resources/locale/en b/bauh/gems/appimage/resources/locale/en index e928a8e1..adfa558e 100644 --- a/bauh/gems/appimage/resources/locale/en +++ b/bauh/gems/appimage/resources/locale/en @@ -2,4 +2,6 @@ gem.appimage.label=AppImage appimage.install.permission=Giving execution permission to {} appimage.install.extract=Extracting the content from {} appimage.install.desktop_entry=Generating a menu shortcut -appimage.uninstall.error.remove_folder=Could not remove the application installation directory {} \ No newline at end of file +appimage.uninstall.error.remove_folder=Could not remove the application installation directory {} +appimage.info.url_download=File URL +appimage.info.icon_path=icon \ No newline at end of file diff --git a/bauh/gems/appimage/resources/locale/es b/bauh/gems/appimage/resources/locale/es index 7286c598..81134f43 100644 --- a/bauh/gems/appimage/resources/locale/es +++ b/bauh/gems/appimage/resources/locale/es @@ -2,4 +2,6 @@ gem.appimage.label=AppImage appimage.install.permission=Concediendo permiso de ejecución a {} appimage.install.extract=Extrayendo el contenido de {} appimage.install.desktop_entry=Creando un atajo en el menú -appimage.uninstall.error.remove_folder=No se pudo eliminar el directorio de instalación de la aplicación {} \ No newline at end of file +appimage.uninstall.error.remove_folder=No se pudo eliminar el directorio de instalación de la aplicación {} +appimage.info.url_download=URL del archivo +appimage.info.icon_path=icono \ No newline at end of file diff --git a/bauh/gems/appimage/resources/locale/pt b/bauh/gems/appimage/resources/locale/pt index 910dc563..087603e4 100644 --- a/bauh/gems/appimage/resources/locale/pt +++ b/bauh/gems/appimage/resources/locale/pt @@ -2,4 +2,6 @@ gem.appimage.label=AppImage appimage.install.permission=Concedendo permissão de execução para {} appimage.install.extract=Extraindo o conteúdo de {} appimage.install.desktop_entry=Criando um atalho no menu -appimage.uninstall.error.remove_folder=Não foi possível remover o diretóri ode instalação do aplicativo {} \ No newline at end of file +appimage.uninstall.error.remove_folder=Não foi possível remover o diretóri ode instalação do aplicativo {} +appimage.info.url_download=URL do arquivo +appimage.info.icon_path=ícone \ No newline at end of file diff --git a/bauh/view/qt/info.py b/bauh/view/qt/info.py index 54f1d923..dea12475 100644 --- a/bauh/view/qt/info.py +++ b/bauh/view/qt/info.py @@ -9,17 +9,17 @@ IGNORED_ATTRS = {'name', '__app__'} class InfoDialog(QDialog): - def __init__(self, app: dict, icon_cache: MemoryCache, locale_keys: dict, screen_size: QSize()): + def __init__(self, app: dict, icon_cache: MemoryCache, i18n: dict, screen_size: QSize()): super(InfoDialog, self).__init__() self.setWindowTitle(str(app['__app__'])) self.screen_size = screen_size - self.i18n = locale_keys + self.i18n = i18n layout = QVBoxLayout() self.setLayout(layout) self.full_vals = [] self.toolbar_field = QToolBar() - self.bt_back = QPushButton(locale_keys['back'].capitalize()) + self.bt_back = QPushButton(i18n['back'].capitalize()) self.bt_back.clicked.connect(self.back_to_info) self.toolbar_field.addWidget(self.bt_back) self.layout().addWidget(self.toolbar_field) @@ -46,14 +46,14 @@ class InfoDialog(QDialog): for idx, attr in enumerate(sorted(app.keys())): if attr not in IGNORED_ATTRS and app[attr]: - i18n_key = app['__app__'].model.get_type() + '.info.' + attr.lower() + i18n_key = app['__app__'].model.get_type().lower() + '.info.' + attr.lower() if isinstance(app[attr], list): val = '\n'.join(['* ' + str(e.strip()) for e in app[attr] if e]) else: val = str(app[attr]).strip() - i18n_val = locale_keys.get('{}.{}'.format(i18n_key, val.lower())) + i18n_val = i18n.get('{}.{}'.format(i18n_key, val.lower())) if i18n_val: val = i18n_val @@ -65,7 +65,7 @@ class InfoDialog(QDialog): text.setStyleSheet("width: 400px") text.setReadOnly(True) - label = QLabel("{}: ".format(locale_keys.get(i18n_key, attr)).capitalize()) + label = QLabel("{}: ".format(i18n.get(i18n_key, i18n.get(attr.lower(), attr))).capitalize()) label.setStyleSheet("font-weight: bold") self.gbox_info_layout.addWidget(label, idx, 0) diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 39a0dee3..0613dc35 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -820,7 +820,7 @@ class ManageWindow(QWidget): def _finish_get_info(self, app_info: dict): self.finish_action() - dialog_info = InfoDialog(app=app_info, icon_cache=self.icon_cache, locale_keys=self.i18n, screen_size=self.screen_size) + dialog_info = InfoDialog(app=app_info, icon_cache=self.icon_cache, i18n=self.i18n, screen_size=self.screen_size) dialog_info.exec_() def _finish_get_history(self, res: dict): diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en index c1cd934f..fe2cdf8e 100644 --- a/bauh/view/resources/locale/en +++ b/bauh/view/resources/locale/en @@ -116,4 +116,6 @@ style.change.title=Style change style.change.question=To change the current style is necessary to restart {}. Proceed ? manage_window.bt_settings.tooltip=Click here to open extra actions downloading=Downloading -console.install_logs.path=Installation logs can be found at {} \ No newline at end of file +console.install_logs.path=Installation logs can be found at {} +author=author +source=source \ No newline at end of file diff --git a/bauh/view/resources/locale/es b/bauh/view/resources/locale/es index 56c34e6d..16382602 100644 --- a/bauh/view/resources/locale/es +++ b/bauh/view/resources/locale/es @@ -118,4 +118,6 @@ style.change.title=Cambio de estilo style.change.question=Para cambiar el estilo actual es necesario reiniciar {}. ¿Proceder? manage_window.bt_settings.tooltip=Haga clic aquí para abrir acciones adicionales downloading=Descargando -console.install_logs.path=Los registros de instalación se pueden encontrar en {} \ No newline at end of file +console.install_logs.path=Los registros de instalación se pueden encontrar en {} +author=autor +source=origen \ No newline at end of file diff --git a/bauh/view/resources/locale/pt b/bauh/view/resources/locale/pt index a05cbf85..c2b33f29 100644 --- a/bauh/view/resources/locale/pt +++ b/bauh/view/resources/locale/pt @@ -118,4 +118,6 @@ style.change.title=Mudança de estilo style.change.question=Para alterar o estilo atual é necessário reiniciar o {}. Continuar ? manage_window.bt_settings.tooltip=Clique aqui para abrir ações adicionais downloading=Baixando -console.install_logs.path=Os registros de instalação podem ser encontrados em {} \ No newline at end of file +console.install_logs.path=Os registros de instalação podem ser encontrados em {} +author=autor +source=fonte \ No newline at end of file