mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 20:54: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]
|
## [0.8.1]
|
||||||
### Features:
|
### Features:
|
||||||
- Flatpak:
|
- 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
|
- 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
|
### Improvements
|
||||||
- All icons are now SVG files
|
- 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:
|
- Required dependencies:
|
||||||
- Any distro: **flatpak**
|
- Any distro: **flatpak**
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
SUGGESTIONS_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/flatpak/suggestions.txt'
|
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.api.abstract.view import MessageType
|
||||||
from bauh.commons.html import strip_html, bold
|
from bauh.commons.html import strip_html, bold
|
||||||
from bauh.commons.system import SystemProcess, ProcessHandler, SimpleProcess
|
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.constants import FLATHUB_API_URL
|
||||||
from bauh.gems.flatpak.model import FlatpakApplication
|
from bauh.gems.flatpak.model import FlatpakApplication
|
||||||
from bauh.gems.flatpak.worker import FlatpakAsyncDataLoader, FlatpakUpdateLoader
|
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:
|
def install(self, pkg: FlatpakApplication, root_password: str, watcher: ProcessWatcher) -> bool:
|
||||||
|
|
||||||
user_level = watcher.request_confirmation(title=self.i18n['flatpak.install.install_level.title'],
|
config = read_config()
|
||||||
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'
|
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)
|
handler = ProcessHandler(watcher)
|
||||||
|
|
||||||
if user_level:
|
if pkg.installation == 'user':
|
||||||
if not handler.handle_simple(flatpak.register_flathub('user')):
|
if not handler.handle_simple(flatpak.register_flathub('user')):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -43,4 +43,5 @@ flatpak.info.projectlicense=llicència
|
|||||||
flatpak.info.translateurl=Traducció
|
flatpak.info.translateurl=Traducció
|
||||||
flatpak.info.developername=desenvolupador
|
flatpak.info.developername=desenvolupador
|
||||||
flatpak.install.install_level.title=Tipus d'instal·lació
|
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.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}
|
||||||
@@ -42,4 +42,5 @@ flatpak.info.version=Version
|
|||||||
flatpak.history.date=Datum
|
flatpak.history.date=Datum
|
||||||
flatpak.history.commit=Commit
|
flatpak.history.commit=Commit
|
||||||
flatpak.install.install_level.title=Installationstyp
|
flatpak.install.install_level.title=Installationstyp
|
||||||
flatpak.install.install_level.body=Sollte {} für alle Gerätebenutzer installiert werden ( system ) ?
|
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}
|
||||||
@@ -42,4 +42,5 @@ flatpak.info.version=version
|
|||||||
flatpak.history.date=date
|
flatpak.history.date=date
|
||||||
flatpak.history.commit=commit
|
flatpak.history.commit=commit
|
||||||
flatpak.install.install_level.title=Installation type
|
flatpak.install.install_level.title=Installation type
|
||||||
flatpak.install.install_level.body=Should {} be installed for all the device users ( system ) ?
|
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}
|
||||||
@@ -43,4 +43,5 @@ flatpak.info.projectlicense=licencia
|
|||||||
flatpak.info.translateurl=Traducción
|
flatpak.info.translateurl=Traducción
|
||||||
flatpak.info.developername=desarrollador
|
flatpak.info.developername=desarrollador
|
||||||
flatpak.install.install_level.title=Tipo de instalación
|
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.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}
|
||||||
@@ -22,4 +22,5 @@ flatpak.info.installation=installazione
|
|||||||
flatpak.info.installation.user=utente
|
flatpak.info.installation.user=utente
|
||||||
flatpak.info.installation.system=sistema
|
flatpak.info.installation.system=sistema
|
||||||
flatpak.install.install_level.title=Tipo di installazione
|
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.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}
|
||||||
@@ -43,4 +43,5 @@ flatpak.info.projectlicense=licença
|
|||||||
flatpak.info.translateurl=tradução
|
flatpak.info.translateurl=tradução
|
||||||
flatpak.info.developername=desenvolvedor
|
flatpak.info.developername=desenvolvedor
|
||||||
flatpak.install.install_level.title=Tipo de instalação
|
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.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}
|
||||||
@@ -218,4 +218,5 @@ all_files=tots els fitxers
|
|||||||
file_chooser.title=Selector de fitxers
|
file_chooser.title=Selector de fitxers
|
||||||
message.file.not_exist=Fitxer no existeix
|
message.file.not_exist=Fitxer no existeix
|
||||||
message.file.not_exist.body=El fitxer {} sembla no existir
|
message.file.not_exist.body=El fitxer {} sembla no existir
|
||||||
icon_button.tooltip.disabled=Aquesta acció no està disponible
|
icon_button.tooltip.disabled=Aquesta acció no està disponible
|
||||||
|
user=usuari
|
||||||
@@ -173,4 +173,5 @@ file_chooser.title=Dateiauswahl
|
|||||||
message.file.not_exist=Datei existiert nicht
|
message.file.not_exist=Datei existiert nicht
|
||||||
message.file.not_exist.body=Die Datei {} scheint nicht zu existieren
|
message.file.not_exist.body=Die Datei {} scheint nicht zu existieren
|
||||||
development=Entwicklung
|
development=Entwicklung
|
||||||
icon_button.tooltip.disabled=Diese Aktion ist nicht verfügbar
|
icon_button.tooltip.disabled=Diese Aktion ist nicht verfügbar
|
||||||
|
user=Benutzer
|
||||||
@@ -177,4 +177,5 @@ file_chooser.title=File selector
|
|||||||
message.file.not_exist=File does not exist
|
message.file.not_exist=File does not exist
|
||||||
message.file.not_exist.body=The file {} seems not to exist
|
message.file.not_exist.body=The file {} seems not to exist
|
||||||
development=development
|
development=development
|
||||||
icon_button.tooltip.disabled=This action is unavailable
|
icon_button.tooltip.disabled=This action is unavailable
|
||||||
|
user=user
|
||||||
@@ -217,4 +217,5 @@ all_files=todos los archivos
|
|||||||
file_chooser.title=Selector de archivos
|
file_chooser.title=Selector de archivos
|
||||||
message.file.not_exist=Archivo no existe
|
message.file.not_exist=Archivo no existe
|
||||||
message.file.not_exist.body=El archivo {} parece no existir
|
message.file.not_exist.body=El archivo {} parece no existir
|
||||||
icon_button.tooltip.disabled=This action is unavailable
|
icon_button.tooltip.disabled=This action is unavailable
|
||||||
|
user=usuario
|
||||||
@@ -174,4 +174,5 @@ file_chooser.title=Selettore file
|
|||||||
message.file.not_exist=File non esiste
|
message.file.not_exist=File non esiste
|
||||||
message.file.not_exist.body=Il file {} sembra non esistere
|
message.file.not_exist.body=Il file {} sembra non esistere
|
||||||
development=sviluppo
|
development=sviluppo
|
||||||
icon_button.tooltip.disabled=Questa azione non è disponibile
|
icon_button.tooltip.disabled=Questa azione non è disponibile
|
||||||
|
user=utente
|
||||||
@@ -220,4 +220,5 @@ all_files=todos os arquivos
|
|||||||
file_chooser.title=Seletor arquivos
|
file_chooser.title=Seletor arquivos
|
||||||
message.file.not_exist=Arquivo não existe
|
message.file.not_exist=Arquivo não existe
|
||||||
message.file.not_exist.body=O arquivo {} parece não existir
|
message.file.not_exist.body=O arquivo {} parece não existir
|
||||||
icon_button.tooltip.disabled=Esta ação está indisponível
|
icon_button.tooltip.disabled=Esta ação está indisponível
|
||||||
|
user=usuário
|
||||||
Reference in New Issue
Block a user