From ce673dda5d1af9de01f4d6417f9d3b56a30df7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Moreira?= Date: Mon, 27 Jan 2020 13:30:32 -0300 Subject: [PATCH] [ui][settings] more improvements and settings --- bauh/view/core/controller.py | 35 ++++++++++++++++++++++++++++++++++- bauh/view/qt/components.py | 3 ++- bauh/view/resources/locale/ca | 6 ++++++ bauh/view/resources/locale/de | 6 ++++++ bauh/view/resources/locale/en | 8 ++++++++ bauh/view/resources/locale/es | 8 ++++++++ bauh/view/resources/locale/it | 6 ++++++ bauh/view/resources/locale/pt | 8 ++++++++ 8 files changed, 78 insertions(+), 2 deletions(-) diff --git a/bauh/view/core/controller.py b/bauh/view/core/controller.py index ca862d61..d78cdafc 100755 --- a/bauh/view/core/controller.py +++ b/bauh/view/core/controller.py @@ -454,7 +454,31 @@ class GenericSoftwareManager(SoftwareManager): form_download = FormComponent(label=self.i18n['download'].capitalize(), components=[select_dicons, select_dmthread], id_='form_download') - sub_comps = [form_general, form_download] + select_sugs = self._gen_bool_component(label=self.i18n['core.config.suggestions.activated'].capitalize(), + tooltip=self.i18n['core.config.suggestions.activated.tip'].format(app=self.context.app_name), + id_="sugs_enabled", + value=bool(core_config['suggestions']['enabled'])) + + form_sugs = FormComponent(label=self.i18n['core.config.suggestions'].capitalize(), + components=[select_sugs], id_='form_sugs') + + input_data_exp = TextInputComponent(label=self.i18n['core.config.mem_cache.data_exp'], + tooltip=self.i18n['core.config.mem_cache.data_exp.tip'], + value=str(core_config['memory_cache']['data_expiration']), + only_int=True, + id_="data_exp") + + input_icon_exp = TextInputComponent(label=self.i18n['core.config.mem_cache.icon_exp'], + tooltip=self.i18n['core.config.mem_cache.icon_exp.tip'], + value=str(core_config['memory_cache']['icon_expiration']), + only_int=True, + id_="icon_exp") + + form_cache = FormComponent(label=self.i18n['core.config.mem_cache'].capitalize(), + components=[input_data_exp, input_icon_exp], + id_='form_memcache') + + sub_comps = [form_general, form_download, form_sugs, form_cache] return TabComponent(self.i18n['core.config.tab_label'].capitalize(), PanelComponent([FormComponent(sub_comps)]), None, 'core') def _save_settings(self, panel: PanelComponent) -> Tuple[bool, List[str]]: @@ -475,6 +499,15 @@ class GenericSoftwareManager(SoftwareManager): download_mthreaded = main_form.get_component('form_download').get_component('down_mthread').get_selected() core_config['download']['multithreaded'] = download_mthreaded + data_exp = main_form.get_component('form_memcache').get_component('data_exp').get_int_value() + core_config['memory_cache']['data_expiration'] = data_exp + + icon_exp = main_form.get_component('form_memcache').get_component('icon_exp').get_int_value() + core_config['memory_cache']['icon_expiration'] = icon_exp + + sugs_enabled = main_form.get_component('form_sugs').get_component('sugs_enabled').get_value() + core_config['suggestions']['enabled'] = sugs_enabled + try: config.save(core_config) return True, None diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index e185110c..968107b6 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -4,7 +4,8 @@ from typing import Tuple from PyQt5.QtCore import Qt, QSize from PyQt5.QtGui import QIcon, QPixmap, QIntValidator from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \ - QLabel, QSizePolicy, QLineEdit, QToolButton, QHBoxLayout, QFormLayout, QFileDialog, QTabWidget, QVBoxLayout, QSlider + QLabel, QSizePolicy, QLineEdit, QToolButton, QHBoxLayout, QFormLayout, QFileDialog, QTabWidget, QVBoxLayout, \ + QSlider, QScrollArea, QFrame from bauh.api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType, \ TextInputComponent, FormComponent, FileChooserComponent, ViewComponent, TabGroupComponent, PanelComponent, \ diff --git a/bauh/view/resources/locale/ca b/bauh/view/resources/locale/ca index 94735c90..bb6bf3fc 100644 --- a/bauh/view/resources/locale/ca +++ b/bauh/view/resources/locale/ca @@ -232,6 +232,12 @@ core.config.download.icons=Icons core.config.download.icons.tip=If the application icons should be downloaded and displayed on the table core.config.download.multithreaded=Parallelism core.config.download.multithreaded.tip=Whether applications, packages and files should be downloaded with a tool that works with parallelism / multi-thread (faster). At the moment only the aria2 application is supported +core.config.mem_cache=Memory storage +core.config.mem_cache.data_exp=Data expiration +core.config.mem_cache.data_exp.tip=Defines the in-memory data lifetime ( in SECONDS ) +core.config.suggestions=Suggestions +core.config.suggestions.activated=Activated +core.config.suggestions.activated.tip=If {app} can suggest applications to install locale.en=anglès locale.es=castellà locale.pt=portuguès diff --git a/bauh/view/resources/locale/de b/bauh/view/resources/locale/de index a5928276..b4a8384a 100644 --- a/bauh/view/resources/locale/de +++ b/bauh/view/resources/locale/de @@ -187,6 +187,12 @@ core.config.download.icons=Icons core.config.download.icons.tip=If the application icons should be downloaded and displayed on the table core.config.download.multithreaded=Parallelism core.config.download.multithreaded.tip=Whether applications, packages and files should be downloaded with a tool that works with parallelism / multi-thread (faster). At the moment only the aria2 application is supported +core.config.mem_cache=Memory storage +core.config.mem_cache.data_exp=Data expiration +core.config.mem_cache.data_exp.tip=Defines the in-memory data lifetime ( in SECONDS ) +core.config.suggestions=Suggestions +core.config.suggestions.activated=Activated +core.config.suggestions.activated.tip=If {app} can suggest applications to install locale.en=englisch locale.es=spanisch locale.pt=portugiesisch diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en index e41acd6f..325a6e7b 100644 --- a/bauh/view/resources/locale/en +++ b/bauh/view/resources/locale/en @@ -190,6 +190,14 @@ core.config.download.icons=Icons core.config.download.icons.tip=If the application icons should be downloaded and displayed on the table core.config.download.multithreaded=Parallelism core.config.download.multithreaded.tip=Whether applications, packages and files should be downloaded with a tool that works with parallelism / multi-thread ( faster ). At the moment only the aria2 application is supported +core.config.mem_cache=Memory storage +core.config.mem_cache.data_exp=Data expiration +core.config.mem_cache.data_exp.tip=Defines the in-memory data lifetime ( in SECONDS ) +core.config.mem_cache.icon_exp=Icons expiration +core.config.mem_cache.icon_exp.tip=Defines the in-memory icons lifetime ( in SECONDS ) +core.config.suggestions=Suggestions +core.config.suggestions.activated=Activated +core.config.suggestions.activated.tip=If {app} can suggest applications to install locale.en=english locale.es=spanish locale.pt=portuguese diff --git a/bauh/view/resources/locale/es b/bauh/view/resources/locale/es index f4731299..2f2e0158 100644 --- a/bauh/view/resources/locale/es +++ b/bauh/view/resources/locale/es @@ -231,6 +231,14 @@ core.config.download.icons=Iconos core.config.download.icons.tip=Si los íconos de las aplicaciones se deben descargar y mostrar en la tabla core.config.download.multithreaded=Paralelismo core.config.download.multithreaded.tip=Si las aplicaciones, paquetes y archivos deben descargarse con una herramienta que funcione con paralelismo / multi-thread ( más rápido ). Por el momento solo se admite la aplicación aria2 +core.config.mem_cache=Almacenamiento de memoria +core.config.mem_cache.data_exp=Expiración de datos +core.config.mem_cache.data_exp.tip=Define la vida útil de los datos en memoria ( en SEGUNDOS ) +core.config.mem_cache.icon_exp=Expiración de íconos +core.config.mem_cache.icon_exp.tip=Define la vida útil de los íconos en memoria ( en SEGUNDOS ) +core.config.suggestions=Sugerencias +core.config.suggestions.activated=Activadas +core.config.suggestions.activated.tip=Si {app} puede sugerir aplicaciones para instalar locale.es=inglés locale.es=español locale.pt=portugués diff --git a/bauh/view/resources/locale/it b/bauh/view/resources/locale/it index 4a08ae23..cf295694 100644 --- a/bauh/view/resources/locale/it +++ b/bauh/view/resources/locale/it @@ -188,6 +188,12 @@ core.config.download.icons=Icons core.config.download.icons.tip=If the application icons should be downloaded and displayed on the table core.config.download.multithreaded=Parallelism core.config.download.multithreaded.tip=Whether applications, packages and files should be downloaded with a tool that works with parallelism / multi-thread (faster). At the moment only the aria2 application is supported +core.config.mem_cache=Memory storage +core.config.mem_cache.data_exp=Data expiration +core.config.mem_cache.data_exp.tip=Defines the in-memory data lifetime ( in SECONDS ) +core.config.suggestions=Suggestions +core.config.suggestions.activated=Activated +core.config.suggestions.activated.tip=If {app} can suggest applications to install locale.en=inglese locale.es=spagnolo locale.pt=portoghese diff --git a/bauh/view/resources/locale/pt b/bauh/view/resources/locale/pt index 77ed6a46..ba144f5a 100644 --- a/bauh/view/resources/locale/pt +++ b/bauh/view/resources/locale/pt @@ -234,6 +234,14 @@ core.config.download.icons=Ícones core.config.download.icons.tip=Se os ícones dos aplicativos devem ser baixados e exibidos na tabela core.config.download.multithreaded=Paralelismo core.config.download.multithreaded.tip=Se os aplicativos, pacotes e arquivos devem ser baixados através de uma ferramenta que trabalha com paralelismo / multi-thread ( mais rápido ). No momento somente o aplicativo aria2 é suportado. +core.config.mem_cache=Armazenamento em memória +core.config.mem_cache.data_exp=Expiração dos dados +core.config.mem_cache.data_exp.tip=Define o tempo de vida dos dados em memória ( em SEGUNDOS ) +core.config.mem_cache.icon_exp=Expiração de ícones +core.config.mem_cache.icon_exp.tip=Define o tempo de vida dos ícones em memória ( em SEGUNDOS ) +core.config.suggestions=Sugestões +core.config.suggestions.activated=Ativadas +core.config.suggestions.activated.tip=Se o {app} pode sugerir aplicativos para a instalação locale.en=inglês locale.es=espanhol locale.pt=português