[flatpak] feature: 'full update' custom action

This commit is contained in:
Vinicius Moreira
2022-03-25 11:46:46 -03:00
parent 54dc8ac711
commit 6c8adfe1ed
13 changed files with 67 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ from bauh.api.abstract.controller import SearchResult, SoftwareManager, Applicat
from bauh.api.abstract.disk import DiskCacheLoader
from bauh.api.abstract.handler import ProcessWatcher, TaskManager
from bauh.api.abstract.model import PackageHistory, PackageUpdate, SoftwarePackage, PackageSuggestion, \
SuggestionPriority, PackageStatus
SuggestionPriority, PackageStatus, CustomSoftwareAction
from bauh.api.abstract.view import MessageType, FormComponent, SingleSelectComponent, InputOption, SelectViewType, \
ViewComponent, PanelComponent
from bauh.commons.boot import CreateConfigFile
@@ -46,6 +46,7 @@ class FlatpakManager(SoftwareManager):
self.suggestions_cache = context.cache_factory.new(None)
self.logger = context.logger
self.configman = FlatpakConfigManager()
self._action_full_update: Optional[CustomSoftwareAction] = None
def get_managed_types(self) -> Set["type"]:
return {FlatpakApplication}
@@ -734,3 +735,25 @@ class FlatpakManager(SoftwareManager):
self._write_ignored_updates(ignored_keys)
pkg.updates_ignored = False
def gen_custom_actions(self) -> Generator[CustomSoftwareAction, None, None]:
yield self.action_full_update
def full_update(self, root_password: Optional[str], watcher: ProcessWatcher) -> bool:
handler = ProcessHandler(watcher)
return handler.handle_simple(flatpak.full_update(flatpak.get_version()))[0]
@property
def action_full_update(self) -> CustomSoftwareAction:
if self._action_full_update is None:
self._action_full_update = CustomSoftwareAction(i18n_label_key='flatpak.action.full_update',
i18n_description_key='flatpak.action.full_update.description',
i18n_status_key='flatpak.action.full_update.status',
backup=True,
manager=self,
requires_internet=True,
icon_path=get_icon_path(),
manager_method='full_update',
requires_root=False)
return self._action_full_update

View File

@@ -172,6 +172,11 @@ def update(app_ref: str, installation: str, version: Version, related: bool = Fa
lang=DEFAULT_LANG if version < VERSION_1_12 else None)
def full_update(version: VERSION_1_12) -> SimpleProcess:
return SimpleProcess(cmd=('flatpak', 'update', '-y'), extra_paths={EXPORTS_PATH}, shell=True,
lang=DEFAULT_LANG if version < VERSION_1_12 else None)
def uninstall(app_ref: str, installation: str, version: Version) -> SimpleProcess:
return SimpleProcess(cmd=('flatpak', 'uninstall', app_ref, '-y', f'--{installation}'),
extra_paths={EXPORTS_PATH},

View File

@@ -1,3 +1,6 @@
flatpak.action.full_update=Full update
flatpak.action.full_update.description=It completely updates the Flatpak apps and components. Useful if you are having issues with runtime updates.
flatpak.action.full_update.status=Updating Flatpak apps and components
flatpak.config.install_level=level
flatpak.config.install_level.ask.tip={app} will ask the level that should be applied during the app installation
flatpak.config.install_level.system=system

View File

@@ -1,3 +1,6 @@
flatpak.action.full_update=Full update
flatpak.action.full_update.description=It completely updates the Flatpak apps and components. Useful if you are having issues with runtime updates.
flatpak.action.full_update.status=Updating Flatpak apps and components
flatpak.config.install_level=level
flatpak.config.install_level.ask.tip={app} will ask the level that should be applied during the app installation
flatpak.config.install_level.system=system

View File

@@ -1,3 +1,6 @@
flatpak.action.full_update=Full update
flatpak.action.full_update.description=It completely updates the Flatpak apps and components. Useful if you are having issues with runtime updates.
flatpak.action.full_update.status=Updating Flatpak apps and components
flatpak.config.install_level=level
flatpak.config.install_level.ask.tip={app} will ask the level that should be applied during the app installation
flatpak.config.install_level.system=system

View File

@@ -1,3 +1,6 @@
flatpak.action.full_update=Actualización completa
flatpak.action.full_update.description=Actualiza completamente las aplicaciones y componentes Flatpak. Útil si hay problemas con las actualizaciones de runtimes.
flatpak.action.full_update.status=Actualizando las aplicaciones y componentes Flatpak
flatpak.config.install_level=nivel
flatpak.config.install_level.ask.tip={app} preguntará el nivel que debe aplicarse durante la instalación de la aplicación
flatpak.config.install_level.system=sistema

View File

@@ -1,3 +1,6 @@
flatpak.action.full_update=Full update
flatpak.action.full_update.description=It completely updates the Flatpak apps and components. Useful if you are having issues with runtime updates.
flatpak.action.full_update.status=Updating Flatpak apps and components
flatpak.config.install_level=niveau
flatpak.config.install_level.ask.tip={app} va demander le niveau à appliquer durant l'installation
flatpak.config.install_level.system=système

View File

@@ -1,3 +1,6 @@
flatpak.action.full_update=Full update
flatpak.action.full_update.description=It completely updates the Flatpak apps and components. Useful if you are having issues with runtime updates.
flatpak.action.full_update.status=Updating Flatpak apps and components
flatpak.config.install_level=level
flatpak.config.install_level.ask.tip={app} will ask the level that should be applied during the app installation
flatpak.config.install_level.system=system

View File

@@ -1,3 +1,6 @@
flatpak.action.full_update=Atualização completa
flatpak.action.full_update.description=Atualiza completamente aplicações e componentes Flatpak instalados. Útil se você estiver com problemas de atualização dos runtimes.
flatpak.action.full_update.status=Atualizando aplicações e componentes Flatpak
flatpak.config.install_level=nível
flatpak.config.install_level.ask.tip=O {app} perguntará qual o nível deverá ser aplicado durante a instalação do aplicativo
flatpak.config.install_level.system=sistema

View File

@@ -1,3 +1,6 @@
flatpak.action.full_update=Full update
flatpak.action.full_update.description=It completely updates the Flatpak apps and components. Useful if you are having issues with runtime updates.
flatpak.action.full_update.status=Updating Flatpak apps and components
flatpak.config.install_level=Уровень
flatpak.config.install_level.ask.tip={app} запросит уровень, который должен быть применен во время установки приложения
flatpak.config.install_level.system=Система

View File

@@ -1,3 +1,6 @@
flatpak.action.full_update=Full update
flatpak.action.full_update.description=It completely updates the Flatpak apps and components. Useful if you are having issues with runtime updates.
flatpak.action.full_update.status=Updating Flatpak apps and components
flatpak.config.install_level=seviye
flatpak.config.install_level.ask.tip={app} uygulama kurulumu sırasında uygulanması gereken seviyeyi soracak
flatpak.config.install_level.system=sistem