mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[feature][flatpak] config file
This commit is contained in:
@@ -7,8 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
## [0.8.1]
|
||||
### Features:
|
||||
- Flatpak:
|
||||
- allow the user to choose the installation level: user or system
|
||||
- allow the user to choose the installation level: **user** or **system**
|
||||
- able to deal with user and system applications / runtimes
|
||||
- new configuration file located at **~/.config/bauh/flatpak.yml** ( it allows to define a default installation level )
|
||||
|
||||
### Improvements
|
||||
- All icons are now SVG files
|
||||
|
||||
@@ -99,6 +99,11 @@ Before uninstalling bauh via your package manager, consider executing `bauh --re
|
||||
|
||||

|
||||
|
||||
- The configuration file is located at **~/.config/bauh/flatpak.yml** and it allows the following customizations:
|
||||
```
|
||||
installation_level: null # defines a default installation level: user or system. ( the popup will not be displayed if a value is defined )
|
||||
```
|
||||
|
||||
- Required dependencies:
|
||||
- Any distro: **flatpak**
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SUGGESTIONS_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/flatpak/suggestions.txt'
|
||||
CONFIG_FILE = '{}/.config/bauh/flatpak.yml'.format(Path.home())
|
||||
|
||||
7
bauh/gems/flatpak/config.py
Normal file
7
bauh/gems/flatpak/config.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from bauh.commons.config import read_config as read
|
||||
from bauh.gems.flatpak import CONFIG_FILE
|
||||
|
||||
|
||||
def read_config(update_file: bool = False) -> dict:
|
||||
template = {'installation_level': None}
|
||||
return read(CONFIG_FILE, template, update_file=update_file)
|
||||
@@ -11,7 +11,8 @@ from bauh.api.abstract.model import PackageHistory, PackageUpdate, SoftwarePacka
|
||||
from bauh.api.abstract.view import MessageType
|
||||
from bauh.commons.html import strip_html, bold
|
||||
from bauh.commons.system import SystemProcess, ProcessHandler, SimpleProcess
|
||||
from bauh.gems.flatpak import flatpak, SUGGESTIONS_FILE
|
||||
from bauh.gems.flatpak import flatpak, SUGGESTIONS_FILE, CONFIG_FILE
|
||||
from bauh.gems.flatpak.config import read_config
|
||||
from bauh.gems.flatpak.constants import FLATHUB_API_URL
|
||||
from bauh.gems.flatpak.model import FlatpakApplication
|
||||
from bauh.gems.flatpak.worker import FlatpakAsyncDataLoader, FlatpakUpdateLoader
|
||||
@@ -220,16 +221,31 @@ class FlatpakManager(SoftwareManager):
|
||||
|
||||
def install(self, pkg: FlatpakApplication, root_password: str, watcher: ProcessWatcher) -> bool:
|
||||
|
||||
config = read_config()
|
||||
|
||||
install_level = config['installation_level']
|
||||
|
||||
if install_level is not None:
|
||||
self.logger.info("Default Flaptak installation level defined: {}".format(install_level))
|
||||
|
||||
if install_level not in ('user', 'system'):
|
||||
watcher.show_message(title=self.i18n['error'].capitalize(),
|
||||
body=self.i18n['flatpak.install.bad_install_level.body'].format(field=bold('installation_level'),
|
||||
file=bold(CONFIG_FILE)),
|
||||
type_=MessageType.ERROR)
|
||||
return False
|
||||
|
||||
pkg.installation = install_level
|
||||
else:
|
||||
user_level = watcher.request_confirmation(title=self.i18n['flatpak.install.install_level.title'],
|
||||
body=self.i18n['flatpak.install.install_level.body'].format(bold(pkg.name)),
|
||||
confirmation_label=self.i18n['no'].capitalize(),
|
||||
deny_label=self.i18n['yes'].capitalize())
|
||||
|
||||
pkg.installation = 'user' if user_level else 'system'
|
||||
|
||||
handler = ProcessHandler(watcher)
|
||||
|
||||
if user_level:
|
||||
if pkg.installation == 'user':
|
||||
if not handler.handle_simple(flatpak.register_flathub('user')):
|
||||
return False
|
||||
|
||||
|
||||
@@ -44,3 +44,4 @@ flatpak.info.translateurl=Traducció
|
||||
flatpak.info.developername=desenvolupador
|
||||
flatpak.install.install_level.title=Tipus d'instal·lació
|
||||
flatpak.install.install_level.body=S'ha d'instal·lar {} per a tots els usuaris del dispositiu ( sistema ) ?
|
||||
flatpak.install.bad_install_level.body=Valor invàlid per a {field} al fitxer de configuració {file}
|
||||
@@ -43,3 +43,4 @@ flatpak.history.date=Datum
|
||||
flatpak.history.commit=Commit
|
||||
flatpak.install.install_level.title=Installationstyp
|
||||
flatpak.install.install_level.body=Sollte {} für alle Gerätebenutzer installiert werden ( system ) ?
|
||||
flatpak.install.bad_install_level.body=Ungültiger Wert für {field} in der Konfigurationsdatei {file}
|
||||
@@ -43,3 +43,4 @@ flatpak.history.date=date
|
||||
flatpak.history.commit=commit
|
||||
flatpak.install.install_level.title=Installation type
|
||||
flatpak.install.install_level.body=Should {} be installed for all the device users ( system ) ?
|
||||
flatpak.install.bad_install_level.body=Invalid value for {field} in the configuration file {file}
|
||||
@@ -44,3 +44,4 @@ flatpak.info.translateurl=Traducción
|
||||
flatpak.info.developername=desarrollador
|
||||
flatpak.install.install_level.title=Tipo de instalación
|
||||
flatpak.install.install_level.body=¿Debería {} estar instalado para todos los usuarios del dispositivo ( sistema )?
|
||||
flatpak.install.bad_install_level.body=Valor inválido para {field} en el archivo de configuración {file}
|
||||
@@ -23,3 +23,4 @@ flatpak.info.installation.user=utente
|
||||
flatpak.info.installation.system=sistema
|
||||
flatpak.install.install_level.title=Tipo di installazione
|
||||
flatpak.install.install_level.body={} deve essere installato per tutti gli utenti del dispositivo ( sistema ) ?
|
||||
flatpak.install.bad_install_level.body=Valore non valido per {field} nel file di configurazione {file}
|
||||
@@ -44,3 +44,4 @@ flatpak.info.translateurl=tradução
|
||||
flatpak.info.developername=desenvolvedor
|
||||
flatpak.install.install_level.title=Tipo de instalação
|
||||
flatpak.install.install_level.body={} deve ser instalado para todos os usuários desse dispositivo ( sistema ) ?
|
||||
flatpak.install.bad_install_level.body=Valor inválido para {field} no arquivo de configuração {file}
|
||||
@@ -219,3 +219,4 @@ file_chooser.title=Selector de fitxers
|
||||
message.file.not_exist=Fitxer no existeix
|
||||
message.file.not_exist.body=El fitxer {} sembla no existir
|
||||
icon_button.tooltip.disabled=Aquesta acció no està disponible
|
||||
user=usuari
|
||||
@@ -174,3 +174,4 @@ message.file.not_exist=Datei existiert nicht
|
||||
message.file.not_exist.body=Die Datei {} scheint nicht zu existieren
|
||||
development=Entwicklung
|
||||
icon_button.tooltip.disabled=Diese Aktion ist nicht verfügbar
|
||||
user=Benutzer
|
||||
@@ -178,3 +178,4 @@ message.file.not_exist=File does not exist
|
||||
message.file.not_exist.body=The file {} seems not to exist
|
||||
development=development
|
||||
icon_button.tooltip.disabled=This action is unavailable
|
||||
user=user
|
||||
@@ -218,3 +218,4 @@ file_chooser.title=Selector de archivos
|
||||
message.file.not_exist=Archivo no existe
|
||||
message.file.not_exist.body=El archivo {} parece no existir
|
||||
icon_button.tooltip.disabled=This action is unavailable
|
||||
user=usuario
|
||||
@@ -175,3 +175,4 @@ message.file.not_exist=File non esiste
|
||||
message.file.not_exist.body=Il file {} sembra non esistere
|
||||
development=sviluppo
|
||||
icon_button.tooltip.disabled=Questa azione non è disponibile
|
||||
user=utente
|
||||
@@ -221,3 +221,4 @@ file_chooser.title=Seletor arquivos
|
||||
message.file.not_exist=Arquivo não existe
|
||||
message.file.not_exist.body=O arquivo {} parece não existir
|
||||
icon_button.tooltip.disabled=Esta ação está indisponível
|
||||
user=usuário
|
||||
Reference in New Issue
Block a user