From 894e2d9988b6a0ab87f559602f80fbeb6dedbb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Moreira?= Date: Thu, 19 Dec 2019 13:34:13 -0300 Subject: [PATCH] [web] icon displayed / deducted option --- bauh/gems/web/controller.py | 14 +++++++++++++- bauh/gems/web/model.py | 2 +- bauh/gems/web/resources/locale/en | 5 +++++ bauh/gems/web/resources/locale/es | 5 +++++ bauh/gems/web/resources/locale/pt | 5 +++++ bauh/view/qt/components.py | 2 ++ 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/bauh/gems/web/controller.py b/bauh/gems/web/controller.py index 872acc6c..047eb899 100644 --- a/bauh/gems/web/controller.py +++ b/bauh/gems/web/controller.py @@ -388,9 +388,19 @@ class WebApplicationManager(SoftwareManager): default_option=def_tray_opt, label=self.i18n['web.install.option.tray.label']) + icon_op_ded = InputOption(id_='icon_ded', label=self.i18n['web.install.option.wicon.deducted.label'], value=0, + tooltip=self.i18n['web.install.option.wicon.deducted.tip'].format('Nativefier')) + icon_op_disp = InputOption(id_='icon_disp', label=self.i18n['web.install.option.wicon.displayed.label'], + value=1, tooltip=self.i18n['web.install.option.wicon.displayed.tip']) + + inp_icon = SingleSelectComponent(type_=SelectViewType.COMBO, + options=[icon_op_disp, icon_op_ded], + default_option=icon_op_disp if app.icon_url and app.save_icon else icon_op_ded, + label=self.i18n['web.install.option.wicon.label']) + icon_chooser = FileChooserComponent(allowed_extensions={'png'}, label=self.i18n['web.install.option.icon.label']) - form_1 = FormComponent(components=[inp_url, inp_name, inp_desc, inp_cat, icon_chooser, inp_tray], label=self.i18n['web.install.options.basic'].capitalize()) + form_1 = FormComponent(components=[inp_url, inp_name, inp_desc, inp_cat, inp_icon, icon_chooser, inp_tray], label=self.i18n['web.install.options.basic'].capitalize()) op_single = InputOption(id_='single', label=self.i18n['web.install.option.single.label'], value="--single-instance", tooltip=self.i18n['web.install.option.single.tip']) op_max = InputOption(id_='max', label=self.i18n['web.install.option.max.label'], value="--maximize", tooltip=self.i18n['web.install.option.max.tip']) @@ -446,6 +456,8 @@ class WebApplicationManager(SoftwareManager): app.set_custom_icon(icon_chooser.file_path) selected.append('--icon={}'.format(icon_chooser.file_path)) + app.save_icon = inp_icon.value == icon_op_disp + return res, selected return False, [] diff --git a/bauh/gems/web/model.py b/bauh/gems/web/model.py index a61039c4..4fcc5387 100644 --- a/bauh/gems/web/model.py +++ b/bauh/gems/web/model.py @@ -12,7 +12,7 @@ class WebApplication(SoftwarePackage): def __init__(self, id: str = None, url: str = None, name: str = None, description: str = None, icon_url: str = None, installation_dir: str = None, desktop_entry: str = None, installed: bool = False, version: str = None, - categories: List[str] = None, custom_icon: str = None, preset_options: List[str] = None, save_icon: bool = False): + categories: List[str] = None, custom_icon: str = None, preset_options: List[str] = None, save_icon: bool = True): super(WebApplication, self).__init__(id=id if id else url, name=name, description=description, icon_url=icon_url, installed=installed, version=version, categories=categories) diff --git a/bauh/gems/web/resources/locale/en b/bauh/gems/web/resources/locale/en index d34ef120..a5c71ee8 100644 --- a/bauh/gems/web/resources/locale/en +++ b/bauh/gems/web/resources/locale/en @@ -41,6 +41,11 @@ web.install.option.tray.min.label=Start minimized web.install.option.tray.min.tip=The app will be started minimized as an icon in the system tray web.install.option.category.none=none web.install.option.icon.label=Custom icon +web.install.option.wicon.label=Icon +web.install.option.wicon.deducted.label=Deducted +web.install.option.wicon.deducted.tip=The icon will be deducted by {} during the installation +web.install.option.wicon.displayed.label=Displayed +web.install.option.wicon.displayed.tip=The icon displayed on the table will be used for the installation web.install.global_nativefier.unavailable={n} seems not to be installed on your system. It will not be possible to install {app} web.uninstall.error.install_dir.not_found=The installation directory {} was not found web.uninstall.error.remove_dir=It was not possible to remove {} diff --git a/bauh/gems/web/resources/locale/es b/bauh/gems/web/resources/locale/es index 7e2aca60..7030c2f1 100644 --- a/bauh/gems/web/resources/locale/es +++ b/bauh/gems/web/resources/locale/es @@ -41,6 +41,11 @@ web.install.option.tray.min.label=Iniciar minimizado web.install.option.tray.min.tip=La aplicación se iniciará minimizada como un ícono en la bandeja del sistema web.install.option.category.none=ninguna web.install.option.icon.label=Icono personalizado +web.install.option.wicon.label=Icono +web.install.option.wicon.deducted.label=Deducido +web.install.option.wicon.deducted.tip=El {} deducirá el icono durante la instalación +web.install.option.wicon.displayed.label=Mostrado +web.install.option.wicon.displayed.tip=El icono mostrado en la tabla será utilizado para la instalación web.install.global_nativefier.unavailable={n} parece no estar instalado en su sistema. No será posible instalar {app} web.uninstall.error.install_dir.not_found=No se encontró el directorio de instalación {} web.uninstall.error.remove_dir=No fue posible eliminar {} diff --git a/bauh/gems/web/resources/locale/pt b/bauh/gems/web/resources/locale/pt index f7030368..fc9ce569 100644 --- a/bauh/gems/web/resources/locale/pt +++ b/bauh/gems/web/resources/locale/pt @@ -41,6 +41,11 @@ web.install.option.tray.min.label=Iniciar minimizado web.install.option.tray.min.tip=O aplicativo será iniciado minimizado como um ícone da bandeja do sistema web.install.option.category.none=nenhuma web.install.option.icon.label=Ícone alternativo +web.install.option.wicon.label=Ícone +web.install.option.wicon.deducted.label=Deduzido +web.install.option.wicon.deducted.tip=O ícone será deduzido pelo {} durante a instalação +web.install.option.wicon.displayed.label=Exibido +web.install.option.wicon.displayed.tip=O ícone exibido na tabela será utilizado para a instalação web.install.global_nativefier.unavailable={n} não parece estar instalado no seu sistema. Não será possível instalar {app} web.uninstall.error.install_dir.not_found=O diretório de instalação {} não foi encontrado web.uninstall.error.remove=Não foi possível remover {} diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index 8ef92881..5f6e4e30 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -74,11 +74,13 @@ class ComboBoxQt(QComboBox): if model.value and model.value == op: # default self.setCurrentIndex(idx) + self.setToolTip(model.value.tooltip) self.currentIndexChanged.connect(self._set_selected) def _set_selected(self, idx: int): self.model.value = self.model.options[idx] + self.setToolTip(self.model.value.tooltip) class RadioSelectQt(QGroupBox):