[flatpak] refactoring: proper model callbacks

This commit is contained in:
Vinicius Moreira
2022-04-20 16:59:50 -03:00
parent 41ac7a12e0
commit 91db60b546
2 changed files with 8 additions and 2 deletions

View File

@@ -231,7 +231,7 @@ class FlatpakManager(SoftwareManager, SettingsController):
latest_version=ref_split[-1], latest_version=ref_split[-1],
runtime=True, runtime=True,
installation=installation, installation=installation,
installed=True, installed=False,
update_component=True, update_component=True,
update=True) update=True)

View File

@@ -2,7 +2,7 @@ from packaging.version import Version
from bauh.api.abstract.model import SoftwarePackage, PackageStatus from bauh.api.abstract.model import SoftwarePackage, PackageStatus
from bauh.commons import resource from bauh.commons import resource
from bauh.gems.flatpak import ROOT_DIR, VERSION_1_2, VERSION_1_5 from bauh.gems.flatpak import ROOT_DIR, VERSION_1_2
from bauh.view.util.translation import I18n from bauh.view.util.translation import I18n
@@ -137,6 +137,12 @@ class FlatpakApplication(SoftwarePackage):
else: else:
return f'{self.installation}/{self.ref}' return f'{self.installation}/{self.ref}'
def can_be_installed(self) -> bool:
return not self.update_component and not self.installed
def can_be_updated(self) -> bool:
return self.update_component or super(FlatpakApplication, self).can_be_updated()
def can_be_uninstalled(self) -> bool: def can_be_uninstalled(self) -> bool:
return not self.update_component and super(FlatpakApplication, self).can_be_uninstalled() return not self.update_component and super(FlatpakApplication, self).can_be_uninstalled()