mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 20:04:15 +02:00
[ui][settings] supported types working
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from bauh.api.constants import CONFIG_PATH
|
||||
|
||||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
LOCAL_PATH = '{}/.local/share/bauh/appimage'.format(Path.home())
|
||||
INSTALLATION_PATH = LOCAL_PATH + '/installed/'
|
||||
SUGGESTIONS_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/suggestions.txt'
|
||||
SUGGESTIONS_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/suggestions.txt'
|
||||
CONFIG_FILE = '{}/appimage.yml'.format(CONFIG_PATH)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from bauh.api.constants import CONFIG_PATH
|
||||
from bauh.commons.config import read_config as read
|
||||
from bauh.gems.appimage import CONFIG_FILE
|
||||
|
||||
|
||||
def read_config(update_file: bool = False) -> dict:
|
||||
@@ -9,4 +9,4 @@ def read_config(update_file: bool = False) -> dict:
|
||||
'enabled': True
|
||||
}
|
||||
}
|
||||
return read('{}/appimage.yml'.format(CONFIG_PATH), default, update_file=update_file)
|
||||
return read(CONFIG_FILE, default, update_file=update_file)
|
||||
|
||||
@@ -9,7 +9,7 @@ import traceback
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from threading import Lock, Thread
|
||||
from typing import Set, Type, List
|
||||
from typing import Set, Type, List, Tuple
|
||||
|
||||
from colorama import Fore
|
||||
|
||||
@@ -21,9 +21,10 @@ from bauh.api.abstract.model import SoftwarePackage, PackageHistory, PackageUpda
|
||||
SuggestionPriority
|
||||
from bauh.api.abstract.view import MessageType, ViewComponent, FormComponent, InputOption, SingleSelectComponent, \
|
||||
SelectViewType, TextInputComponent, PanelComponent
|
||||
from bauh.commons.config import save_config
|
||||
from bauh.commons.html import bold
|
||||
from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, run_cmd, SimpleProcess
|
||||
from bauh.gems.appimage import query, INSTALLATION_PATH, LOCAL_PATH, SUGGESTIONS_FILE
|
||||
from bauh.gems.appimage import query, INSTALLATION_PATH, LOCAL_PATH, SUGGESTIONS_FILE, CONFIG_FILE
|
||||
from bauh.gems.appimage.config import read_config
|
||||
from bauh.gems.appimage.model import AppImage
|
||||
from bauh.gems.appimage.worker import DatabaseUpdater
|
||||
@@ -506,12 +507,30 @@ class AppImageManager(SoftwareManager):
|
||||
InputOption(label=self.i18n['no'].capitalize(), value=False)]
|
||||
|
||||
updater_opts = [
|
||||
SingleSelectComponent(label='Enabled',
|
||||
SingleSelectComponent(label=self.i18n['appimage.config.db_updates.activated'],
|
||||
options=enabled_opts,
|
||||
default_option=[o for o in enabled_opts if o.value == config['db_updater']['enabled']][0],
|
||||
max_per_line=len(enabled_opts),
|
||||
type_=SelectViewType.RADIO),
|
||||
TextInputComponent(label='Interval', value=str(config['db_updater']['interval']), tooltip="Update interval in SECONDS", only_int=True)
|
||||
type_=SelectViewType.RADIO,
|
||||
id_='up_enabled'),
|
||||
TextInputComponent(label=self.i18n['interval'],
|
||||
value=str(config['db_updater']['interval']),
|
||||
tooltip=self.i18n['appimage.config.db_updates.interval.tip'],
|
||||
only_int=True,
|
||||
id_='up_int')
|
||||
]
|
||||
|
||||
return PanelComponent([FormComponent(updater_opts, 'Database updates')])
|
||||
return PanelComponent([FormComponent(updater_opts, self.i18n['appimage.config.db_updates'])])
|
||||
|
||||
def save_settings(self, component: PanelComponent) -> Tuple[bool, List[str]]:
|
||||
config = read_config()
|
||||
|
||||
panel = component.components[0]
|
||||
config['db_updater']['enabled'] = panel.get_component('up_enabled').get_selected()
|
||||
config['db_updater']['interval'] = panel.get_component('up_int').get_int_value()
|
||||
|
||||
try:
|
||||
save_config(config, CONFIG_FILE)
|
||||
return True, None
|
||||
except:
|
||||
return False, [traceback.format_exc()]
|
||||
|
||||
@@ -17,3 +17,6 @@ appimage.downgrade.uninstall_current_version=No s’ha pogut desinstal·lar la v
|
||||
appimage.downgrade.install_version=No s’ha pogut instal·lar la versió {} ({})
|
||||
appimage.install.download.error=No s’ha pogut baixar el fitxer {}. El servidor del fitxer pot estar inactiu.
|
||||
appimage.install.appimagelauncher.error = {appimgl} no permet la instal·lació de {app}. Desinstal·leu {appimgl}, reinicieu el sistema i torneu a provar d’instal·lar {app}.
|
||||
appimage.config.db_updates=Actualització de la base de dades
|
||||
appimage.config.db_updates.activated=activada
|
||||
appimage.config.db_updates.interval.tip=Interval d'actualització a SECONDS
|
||||
@@ -16,4 +16,7 @@ appimage.downgrade.first_version={} ist in der ersten veröffentlichten Version
|
||||
appimage.error.uninstall_current_version=Deinstallation der aktuellen Version von {} war nicht möglich
|
||||
appimage.downgrade.install_version=Die Installation der Version {} ({}) war nicht möglich
|
||||
appimage.install.download.error=Das Herunterladen der Datei {} ist fehlgeschlagen. Eventuell ist der Server nicht verfügbar
|
||||
appimage.install.appimagelauncher.error={appimgl} verhindert die installation von {app}. Deinstalliere {appimgl}, starte deinen Computer neu und versuche die installation von {app} erneut.
|
||||
appimage.install.appimagelauncher.error={appimgl} verhindert die installation von {app}. Deinstalliere {appimgl}, starte deinen Computer neu und versuche die installation von {app} erneut.
|
||||
appimage.config.db_updates=Datenbankaktualisierung
|
||||
appimage.config.db_updates.activated=aktiviert
|
||||
appimage.config.db_updates.interval.tip=Aktualisierungsintervall in SEKUNDEN
|
||||
@@ -16,4 +16,7 @@ appimage.downgrade.first_version={} is in its first published version
|
||||
appimage.error.uninstall_current_version=It was not possible to uninstall the current version of {}
|
||||
appimage.downgrade.install_version=It was not possible to install the version {} ({})
|
||||
appimage.install.download.error=It was not possible to download the file {}. The file server can be down.
|
||||
appimage.install.appimagelauncher.error={appimgl} is not allowing {app} to be installed. Uninstall {appimgl}, reboot your system and try to install {app} again.
|
||||
appimage.install.appimagelauncher.error={appimgl} is not allowing {app} to be installed. Uninstall {appimgl}, reboot your system and try to install {app} again.
|
||||
appimage.config.db_updates=Database update
|
||||
appimage.config.db_updates.activated=activated
|
||||
appimage.config.db_updates.interval.tip=Update interval in SECONDS
|
||||
@@ -16,4 +16,7 @@ appimage.downgrade.first_version={} está en su primera versión publicada
|
||||
appimage.downgrade.uninstall_current_version=No fue posible desinstalar la versión actual de {}
|
||||
appimage.downgrade.install_version=No fue posible instalar la versión {} ({})
|
||||
appimage.install.download.error=No fue posible descargar el archivo {}. El servidor del archivo puede estar inactivo.
|
||||
appimage.install.appimagelauncher.error = {appimgl} no permite la instalación de {app}. Desinstale {appimgl}, reinicie su sistema e intente instalar {app} nuevamente.
|
||||
appimage.install.appimagelauncher.error={appimgl} no permite la instalación de {app}. Desinstale {appimgl}, reinicie su sistema e intente instalar {app} nuevamente.
|
||||
appimage.config.db_updates=Actualización de la base de datos
|
||||
appimage.config.db_updates.activated=activada
|
||||
appimage.config.db_updates.interval.tip=Intervalo de actualización en SEGUNDOS
|
||||
@@ -17,3 +17,7 @@ appimage.error.uninstall_current_version = Non è stato possibile disinstallare
|
||||
appimage.downgrade.install_version=Non è stato possibile installare la versione {} ({})
|
||||
appimage.install.download.error=Non è stato possibile scaricare il file {}. Il file server può essere inattivo.
|
||||
appimage.install.appimagelauncher.error={appimgl} non consente l'installazione di {app}. Disinstallare {appimgl}, riavviare il sistema e provare a installare nuovamente {app}.
|
||||
appimage.config.db_updates=Aggiornamento della banca dati
|
||||
appimage.config.db_updates.activated=attivata
|
||||
appimage.config.db_updates.interval.tip=Intervallo di aggiornamento in SECONDI
|
||||
|
||||
|
||||
@@ -16,4 +16,7 @@ appimage.downgrade.first_version={} se encontra em sua primeira versão publicad
|
||||
appimage.downgrade.uninstall_current_version=Não foi possível desinstalar a versão atual de {}
|
||||
appimage.downgrade.install_version=Não foi possivel instalar a versão {} ({})
|
||||
appimage.install.download.error=Não foi possível baixar o arquivo {}. O servidor do arquivo pode estar fora do ar.
|
||||
appimage.install.appimagelauncher.error={appimgl} não está permitindo que o {app} seja instalado. Desinstale o {appimgl}, reinicie o sistema e tente instalar o {app} novamente.
|
||||
appimage.install.appimagelauncher.error={appimgl} não está permitindo que o {app} seja instalado. Desinstale o {appimgl}, reinicie o sistema e tente instalar o {app} novamente.
|
||||
appimage.config.db_updates=Atualização da base de dados
|
||||
appimage.config.db_updates.activated=ativada
|
||||
appimage.config.db_updates.interval.tip=Intervalo de atualização em SEGUNDOS
|
||||
Reference in New Issue
Block a user