mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[appimage] improvement -> allowing the property 'suggestions.expiration' to be managed through the UI
This commit is contained in:
@@ -197,9 +197,9 @@ bauh is officially distributed through [PyPi](https://pypi.org/project/bauh) and
|
||||
- The configuration file is located at **~/.config/bauh/appimage.yml** and it allows the following customizations:
|
||||
```
|
||||
database:
|
||||
expiration: 60 # defines the period (in minutes) in which the database will be considered up to date during the initialization process. Use 0 if you always want to update it.
|
||||
expiration: 60 # defines the period (in minutes) in which the database will be considered up to date during the initialization process. Use 0 if you always want to update it. Default: 60.
|
||||
suggestions:
|
||||
expiration: 24 # defines the period (in hours) in which the cached suggestions will be considered up to date. Use 0 if you always want to update them.
|
||||
expiration: 24 # defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them. Default: 24.
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -226,6 +226,15 @@ class FormComponent(ViewComponent):
|
||||
raise Exception("'{}' is not a {}".format(id_, FormComponent.__class__.__name__))
|
||||
return comp
|
||||
|
||||
def get_text_input(self, id_) -> Optional[TextInputComponent]:
|
||||
comp = self.get_component(id_)
|
||||
|
||||
if comp:
|
||||
if not isinstance(comp, TextInputComponent):
|
||||
raise Exception("'{}' is not a {}".format(id_, TextInputComponent.__class__.__name__))
|
||||
return comp
|
||||
|
||||
|
||||
|
||||
class FileChooserComponent(ViewComponent):
|
||||
|
||||
@@ -309,3 +318,11 @@ class PanelComponent(ViewComponent):
|
||||
if not isinstance(comp, FormComponent):
|
||||
raise Exception("'{}' is not a {}".format(id_, FormComponent.__class__.__name__))
|
||||
return comp
|
||||
|
||||
def get_text_input(self, id_) -> Optional[TextInputComponent]:
|
||||
comp = self.get_component(id_)
|
||||
|
||||
if comp:
|
||||
if not isinstance(comp, TextInputComponent):
|
||||
raise Exception("'{}' is not a {}".format(id_, TextInputComponent.__class__.__name__))
|
||||
return comp
|
||||
|
||||
@@ -738,22 +738,31 @@ class AppImageManager(SoftwareManager):
|
||||
appimage_config = self.configman.get_config()
|
||||
max_width = floor(screen_width * 0.15)
|
||||
|
||||
opts = [
|
||||
comps = [
|
||||
TextInputComponent(label=self.i18n['appimage.config.database.expiration'],
|
||||
value=int(appimage_config['database']['expiration']) if isinstance(appimage_config['database']['expiration'], int) else '',
|
||||
value=int(appimage_config['database']['expiration']) if isinstance(
|
||||
appimage_config['database']['expiration'], int) else '',
|
||||
tooltip=self.i18n['appimage.config.database.expiration.tip'],
|
||||
only_int=True,
|
||||
max_width=max_width,
|
||||
id_='appim_db_exp')
|
||||
id_='appim_db_exp'),
|
||||
TextInputComponent(label=self.i18n['appimage.config.suggestions.expiration'],
|
||||
value=int(appimage_config['suggestions']['expiration']) if isinstance(
|
||||
appimage_config['suggestions']['expiration'], int) else '',
|
||||
tooltip=self.i18n['appimage.config.suggestions.expiration.tip'],
|
||||
only_int=True,
|
||||
max_width=max_width,
|
||||
id_='appim_sugs_exp')
|
||||
]
|
||||
|
||||
return PanelComponent([FormComponent(opts, self.i18n['appimage.config.database'])])
|
||||
return PanelComponent([FormComponent(components=comps, id_='form')])
|
||||
|
||||
def save_settings(self, component: PanelComponent) -> Tuple[bool, Optional[List[str]]]:
|
||||
appimage_config = self.configman.get_config()
|
||||
|
||||
panel = component.components[0]
|
||||
appimage_config['database']['expiration'] = panel.get_component('appim_db_exp').get_int_value()
|
||||
form = component.get_form_component('form')
|
||||
appimage_config['database']['expiration'] = form.get_text_input('appim_db_exp').get_int_value()
|
||||
appimage_config['suggestions']['expiration'] = form.get_text_input('appim_sugs_exp').get_int_value()
|
||||
|
||||
try:
|
||||
self.configman.save_config(appimage_config)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
appimage.config.database=Database
|
||||
appimage.config.database.expiration=Expiration
|
||||
appimage.config.database.expiration=Database expiration
|
||||
appimage.config.database.expiration.tip=It defines the period (in minutes) in which the database will be considered up to date during the initialization process. Use 0 if you always want to update it.
|
||||
appimage.config.suggestions.expiration=Suggestions expiration
|
||||
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.
|
||||
appimage.custom_action.install_file=Install AppImage file
|
||||
appimage.custom_action.install_file.details=Installation details
|
||||
appimage.custom_action.install_file.invalid_file=You must define a valid AppImage file
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
appimage.config.database=Database
|
||||
appimage.config.database.expiration=Expiration
|
||||
appimage.config.database.expiration=Database expiration
|
||||
appimage.config.database.expiration.tip=It defines the period (in minutes) in which the database will be considered up to date during the initialization process. Use 0 if you always want to update it.
|
||||
appimage.config.suggestions.expiration=Suggestions expiration
|
||||
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.
|
||||
appimage.custom_action.install_file=Install AppImage file
|
||||
appimage.custom_action.install_file.details=Installation details
|
||||
appimage.custom_action.install_file.invalid_file=You must define a valid AppImage file
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
appimage.config.database=Database
|
||||
appimage.config.database.expiration=Expiration
|
||||
appimage.config.database.expiration.tip=It defines the period (in minutes) in which the database will be considered up to date. Use 0 if you always want to update it.
|
||||
appimage.config.database.expiration=Database expiration
|
||||
appimage.config.database.expiration.tip=It defines the period (in minutes) in which the database will be considered up to date during the initialization process. Use 0 if you always want to update it.
|
||||
appimage.config.suggestions.expiration=Suggestions expiration
|
||||
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.
|
||||
appimage.custom_action.install_file=Install AppImage file
|
||||
appimage.custom_action.install_file.details=Installation details
|
||||
appimage.custom_action.install_file.invalid_file=You must define a valid AppImage file
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
appimage.config.database=Base de datos
|
||||
appimage.config.database.expiration=Expiración
|
||||
appimage.config.database.expiration=Expiración de la base de datos
|
||||
appimage.config.database.expiration.tip=Define el período (en minutos) en el que la base de datos será considerada actualizada durante el proceso de inicialización. Use 0 si siempre desea actualizarla.
|
||||
appimage.config.suggestions.expiration=Expiración de sugerencias
|
||||
appimage.config.suggestions.expiration.tip=Define el período (en horas) en el que la sugerencias almacenadas en disco seran consideradas actualizadas. Use 0 si desea siempre actualizarlas.
|
||||
appimage.custom_action.install_file=Instalar archivo AppImage
|
||||
appimage.custom_action.install_file.details=Detalles de instalación
|
||||
appimage.custom_action.install_file.invalid_file=Debe definir un archivo AppImage válido
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
appimage.config.database=Database
|
||||
appimage.config.database.expiration=Expiration
|
||||
appimage.config.database.expiration.tip=It defines the period (in minutes) in which the database will be considered up to date. Use 0 if you always want to update it.
|
||||
appimage.custom_action.install_file=Installer fichier AppImage
|
||||
appimage.config.database.expiration=Database expiration
|
||||
appimage.config.database.expiration.tip=It defines the period (in minutes) in which the database will be considered up to date during the initialization process. Use 0 if you always want to update it.
|
||||
appimage.config.suggestions.expiration=Suggestions expiration
|
||||
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.appimage.custom_action.install_file=Installer fichier AppImage
|
||||
appimage.custom_action.install_file.details=Détails d'installation
|
||||
appimage.custom_action.install_file.invalid_file=Vous devez définir un fichier AppImage valide
|
||||
appimage.custom_action.install_file.invalid_name=Vous devez choisir un nom à l'application
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
appimage.config.database=Database
|
||||
appimage.config.database.expiration=Expiration
|
||||
appimage.config.database.expiration=Database expiration
|
||||
appimage.config.database.expiration.tip=It defines the period (in minutes) in which the database will be considered up to date during the initialization process. Use 0 if you always want to update it.
|
||||
appimage.config.suggestions.expiration=Suggestions expiration
|
||||
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.
|
||||
appimage.custom_action.install_file=Install AppImage file
|
||||
appimage.custom_action.install_file.details=Installation details
|
||||
appimage.custom_action.install_file.invalid_file=You must define a valid AppImage file
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
appimage.config.database=Banco de dados
|
||||
appimage.config.database.expiration=Expiração
|
||||
appimage.config.database.expiration.tip=Define o período (em minutos) no qual o banco de dados será considerado atualizado durante o processo de inicialização. Use 0 se você quiser que ele sempre seja atualizado.
|
||||
appimage.config.database.expiration=Expiração do banco de dados
|
||||
appimage.config.database.expiration.tip=Define o período (em minutos) no qual o banco de dados será considerado atualizado durante o processo de inicialização. Use 0 se quiser que ele sempre seja atualizado.
|
||||
appimage.config.suggestions.expiration=Expiração das sugestões
|
||||
appimage.config.suggestions.expiration.tip=Define o período (em horas) no qual as sugestões armazenadas em disco serão consideradas atualizadas. Use 0 se quiser que elas sempre seja atualizadas.
|
||||
appimage.custom_action.install_file=Instalar arquivo AppImage
|
||||
appimage.custom_action.install_file.details=Detalhes de instalação
|
||||
appimage.custom_action.install_file.invalid_file=Você precisa definir um arquivo AppImage válido
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
appimage.config.database=Database
|
||||
appimage.config.database.expiration=Expiration
|
||||
appimage.config.database.expiration=Database expiration
|
||||
appimage.config.database.expiration.tip=It defines the period (in minutes) in which the database will be considered up to date during the initialization process. Use 0 if you always want to update it.
|
||||
appimage.config.suggestions.expiration=Suggestions expiration
|
||||
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.
|
||||
appimage.custom_action.install_file=Установить файл AppImage
|
||||
appimage.custom_action.install_file.details=Детали установки
|
||||
appimage.custom_action.install_file.invalid_file=Вы должны определить допустимый файл AppImage
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
appimage.config.database=Database
|
||||
appimage.config.database.expiration=Expiration
|
||||
appimage.config.database.expiration=Database expiration
|
||||
appimage.config.database.expiration.tip=It defines the period (in minutes) in which the database will be considered up to date during the initialization process. Use 0 if you always want to update it.
|
||||
appimage.config.suggestions.expiration=Suggestions expiration
|
||||
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.
|
||||
appimage.custom_action.install_file=AppImage dosyasını yükle
|
||||
appimage.custom_action.install_file.details=Kurulum detayları
|
||||
appimage.custom_action.install_file.invalid_file=Geçerli bir AppImage dosyası tanımlamanız gerekir
|
||||
|
||||
Reference in New Issue
Block a user