def __init__(self, managers: List[SoftwareManager], context: ApplicationContext, config: dict, settings_manager: GenericSettingsManager = None): super(GenericSoftwareManager, self).__init__(context=context) self.managers = managers self.map = {t: m for m in self.managers for t in m.get_managed_types()} self._available_cache = {} if config['system']['single_dependency_checking'] else None self.thread_prepare = None self.i18n = context.i18n self.disk_loader_factory = context.disk_loader_factory self.logger = context.logger self._already_prepared = [] self.working_managers = [] self.config = config self.settings_manager = settings_manager self.http_client = context.http_client self.configman = CoreConfigManager() self.extra_actions = [CustomSoftwareAction(i18n_label_key='action.reset', i18n_status_key='action.reset.status', manager_method='reset', manager=self, icon_path=resource.get_path('img/logo.svg'), requires_root=False, refresh=False)] self.dynamic_extra_actions = {CustomSoftwareAction(i18n_label_key='action.backups', i18n_status_key='action.backups.status', manager_method='launch_timeshift', manager=self, icon_path='timeshift', requires_root=False, refresh=False): self.is_backups_action_available}
def __init__(self, context: ApplicationContext): super(AppImageManager, self).__init__(context=context) self.i18n = context.i18n self.api_cache = context.cache_factory.new() context.disk_loader_factory.map(AppImageManager, self.api_cache) self.enabled = True self.http_client = context.http_client self.logger = context.logger self.file_downloader = context.file_downloader self.db_locks = {DB_APPS_PATH: Lock(), DB_RELEASES_PATH: Lock()} self.custom_actions = [ CustomSoftwareAction( i18_label_key='appimage.custom_action.install_file', i18n_status_key='appimage.custom_action.install_file.status', manager=self, manager_method='install_file', icon_path=resource.get_path('img/appimage.svg', ROOT_DIR), requires_root=False) ] self.custom_app_actions = [ CustomSoftwareAction( i18_label_key='appimage.custom_action.manual_update', i18n_status_key='appimage.custom_action.manual_update.status', manager_method='update_file', requires_root=False, icon_path=resource.get_path('img/upgrade.svg', ROOT_DIR)) ]
def __init__(self, context: ApplicationContext): super(SnapManager, self).__init__(context=context) self.i18n = context.i18n self.api_cache = context.cache_factory.new() context.disk_loader_factory.map(SnapApplication, self.api_cache) self.enabled = True self.http_client = context.http_client self.logger = context.logger self.ubuntu_distro = context.distro == 'ubuntu' self.categories = {} self.suggestions_cache = context.cache_factory.new() self.info_path = None self.custom_actions = [ CustomSoftwareAction( i18n_status_key='snap.action.refresh.status', i18n_label_key='snap.action.refresh.label', icon_path=resource.get_path('img/refresh.svg', context.get_view_path()), manager_method='refresh', requires_root=True, i18n_confirm_key='snap.action.refresh.confirm'), CustomSoftwareAction( i18n_status_key='snap.action.channel.status', i18n_label_key='snap.action.channel.label', i18n_confirm_key='snap.action.channel.confirm', icon_path=resource.get_path('img/refresh.svg', context.get_view_path()), manager_method='change_channel', requires_root=True) ]
def action_launch_sources(self) -> CustomSoftwareAction: if self._action_launch_sources is None: self._action_launch_sources = CustomSoftwareAction(i18n_label_key='debian.action.sources', i18n_status_key='debian.task.sources.status', i18n_description_key='debian.action.sources.desc', icon_path=DEBIAN_ICON_PATH, manager_method='launch_sources_app', requires_confirmation=False, requires_root=False) return self._action_launch_sources
def actions_local_installation(cls) -> Tuple[CustomSoftwareAction, ...]: if cls.__actions_local_installation is None: cls.__actions_local_installation = (CustomSoftwareAction(i18n_label_key='appimage.custom_action.manual_update', i18n_status_key='appimage.custom_action.manual_update.status', i18n_description_key='appimage.custom_action.manual_update.desc', manager_method='update_file', requires_root=False, icon_path=resource.get_path('img/refresh.svg', ROOT_DIR), requires_confirmation=False),) return cls.__actions_local_installation
def actions(cls) -> Tuple[CustomSoftwareAction, CustomSoftwareAction]: if cls.__actions is None: cls.__actions = ( CustomSoftwareAction(i18n_status_key='snap.action.refresh.status', i18n_label_key='snap.action.refresh.label', i18n_description_key='snap.action.refresh.desc', icon_path=resource.get_path('img/refresh.svg', ROOT_DIR), manager_method='refresh', requires_root=True, i18n_confirm_key='snap.action.refresh.confirm'), CustomSoftwareAction(i18n_status_key='snap.action.channel.status', i18n_label_key='snap.action.channel.label', i18n_confirm_key='snap.action.channel.confirm', i18n_description_key='snap.action.channel.desc', icon_path=resource.get_path('img/refresh.svg', ROOT_DIR), manager_method='change_channel', requires_root=True, requires_confirmation=False) ) return cls.__actions
def actions_purge(cls) -> Tuple[CustomSoftwareAction, ...]: if cls.__actions_purge is None: cls.__actions_purge = (CustomSoftwareAction( i18n_label_key='debian.action.purge', i18n_status_key='debian.action.purge.status', i18n_description_key='debian.action.purge.desc', icon_path=resource.get_path('img/clean.svg', ROOT_DIR), manager_method='purge', requires_root=True, requires_confirmation=False), ) return cls.__actions_purge
def action_enable_pkgbuild_edition(cls) -> CustomSoftwareAction: if not cls.__action_enable_pkgbuild_edition: cls.__action_enable_pkgbuild_edition = CustomSoftwareAction( i18n_label_key='arch.action.enable_pkgbuild_edition', i18n_status_key='arch.action.enable_pkgbuild_edition.status', i18n_confirm_key='arch.action.enable_pkgbuild_edition.confirm', i18n_description_key='arch.action.enable_pkgbuild_edition.desc', requires_root=False, manager_method='enable_pkgbuild_edition', icon_path=resource.get_path('img/mark_pkgbuild.svg', ROOT_DIR)) return cls.__action_enable_pkgbuild_edition
def action_reinstall(cls) -> CustomSoftwareAction: if not cls.__action_reinstall: cls.__action_reinstall = CustomSoftwareAction( i18n_label_key='arch.action.reinstall', i18n_status_key='arch.action.reinstall.status', i18n_confirm_key='arch.action.reinstall.confirm', i18n_description_key='arch.action.reinstall.desc', requires_root=True, manager_method='reinstall', icon_path=resource.get_path('img/build.svg', ROOT_DIR)) return cls.__action_reinstall
def gen_custom_actions(self) -> Generator[CustomSoftwareAction, None, None]: if self._default_actions is None: self._default_actions = (CustomSoftwareAction(i18n_label_key='debian.action.sync_pkgs', i18n_status_key='debian.task.sync_pkgs.status', i18n_description_key='debian.action.sync_pkgs.desc', icon_path=DEBIAN_ICON_PATH, manager_method='synchronize_packages', requires_root=True), CustomSoftwareAction(i18n_label_key='debian.action.index_apps', i18n_status_key='debian.task.app_index.status', i18n_description_key='debian.action.index_apps.desc', icon_path=DEBIAN_ICON_PATH, manager_method='index_apps', requires_root=False) ) yield from self._default_actions for _ in self.get_installed_source_apps(): yield self.action_launch_sources break
def action_allow_rebuild_check(cls) -> CustomSoftwareAction: if not cls.__action_allow_rebuild_check: cls.__action_allow_rebuild_check = CustomSoftwareAction( i18n_label_key='arch.action.rebuild_check.allow', i18n_status_key='arch.action.rebuild_check.allow.status', i18n_confirm_key='arch.action.rebuild_check.allow.confirm', i18n_description_key='arch.action.rebuild_check.allow.desc', requires_root=False, manager_method='set_rebuild_check', icon_path=resource.get_path('img/check.svg', ROOT_DIR)) return cls.__action_allow_rebuild_check
def action_self_install(self) -> CustomSoftwareAction: if self._action_self_install is None: self._action_self_install = CustomSoftwareAction(i18n_label_key='appimage.custom_action.self_install', i18n_status_key='appimage.custom_action.self_install.status', i18n_description_key='appimage.custom_action.self_install.desc', manager=self, manager_method='self_install', icon_path=resource.get_path('img/appimage.svg', ROOT_DIR), requires_root=False, refresh=True, requires_internet=False) return self._action_self_install
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
def action_reset(self) -> CustomSoftwareAction: if self._action_reset is None: self._action_reset = CustomSoftwareAction( i18n_label_key='action.reset', i18n_status_key='action.reset.status', i18n_description_key='action.reset.desc', manager_method='reset', icon_path=resource.get_path('img/logo.svg'), requires_root=False, manager=self, refresh=False) return self._action_reset
def gen_custom_actions(self) -> Generator[CustomSoftwareAction, None, None]: if self._custom_actions is None: self._custom_actions = (CustomSoftwareAction(i18n_label_key='appimage.custom_action.install_file', i18n_status_key='appimage.custom_action.install_file.status', i18n_description_key='appimage.custom_action.install_file.desc', manager=self, manager_method='install_file', icon_path=resource.get_path('img/appimage.svg', ROOT_DIR), requires_root=False, requires_confirmation=False), CustomSoftwareAction(i18n_label_key='appimage.custom_action.update_db', i18n_status_key='appimage.custom_action.update_db.status', i18n_description_key='appimage.custom_action.update_db.desc', manager=self, manager_method='update_database', icon_path=resource.get_path('img/appimage.svg', ROOT_DIR), requires_root=False, requires_internet=True)) if self._get_self_appimage_running() and not self._is_self_installed(): yield self.action_self_install yield from self._custom_actions
def dynamic_extra_actions( self) -> Dict[CustomSoftwareAction, Callable[[dict], bool]]: if self._dynamic_extra_actions is None: self._dynamic_extra_actions = { CustomSoftwareAction(i18n_label_key='action.backups', i18n_status_key='action.backups.status', i18n_description_key='action.backups.desc', manager_method='launch_timeshift', manager=self, icon_path='timeshift', requires_root=False, refresh=False): self.is_backups_action_available } return self._dynamic_extra_actions
from typing import List from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction from bauh.commons import resource from bauh.gems.appimage import ROOT_DIR, INSTALLATION_PATH from bauh.view.util.translation import I18n CACHED_ATTRS = { 'name', 'description', 'version', 'url_download', 'author', 'license', 'source', 'icon_path', 'github', 'categories', 'imported', 'install_dir' } CUSTOM_ACTIONS = [ CustomSoftwareAction( i18_label_key='appimage.custom_action.manual_update', i18n_status_key='appimage.custom_action.manual_update.status', manager_method='update_file', requires_root=False, icon_path=resource.get_path('img/refresh.svg', ROOT_DIR)) ] class AppImage(SoftwarePackage): def __init__(self, name: str = None, description: str = None, github: str = None, source: str = None, version: str = None, url_download: str = None, url_icon: str = None, url_screenshot: str = None,
from typing import List from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction from bauh.commons import resource from bauh.gems.snap import ROOT_DIR EXTRA_INSTALLED_ACTIONS = [ CustomSoftwareAction(i18n_status_key='snap.action.refresh.status', i18_label_key='snap.action.refresh.label', icon_path=resource.get_path('img/refresh.svg', ROOT_DIR), manager_method='refresh', requires_root=True) ] KNOWN_RUNTIME_NAMES = {'snapd', 'snapcraft', 'multipass'} class SnapApplication(SoftwarePackage): def __init__(self, id: str = None, name: str = None, version: str = None, latest_version: str = None, description: str = None, publisher: str = None, rev: str = None, notes: str = None, confinement: str = None, has_apps_field: bool = None, verified_publisher: bool = False): super(SnapApplication, self).__init__(id=id, name=name, version=version, latest_version=latest_version, description=description) self.publisher = publisher self.rev = rev self.notes = notes self.confinement = confinement self.has_apps_field = has_apps_field self.verified_publisher = verified_publisher
from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction from bauh.commons import resource from bauh.gems.arch import ROOT_DIR, ARCH_CACHE_PATH from bauh.view.util.translation import I18n CACHED_ATTRS = { 'command', 'icon_path', 'repository', 'maintainer', 'desktop_entry', 'categories', 'last_modified', 'commit' } ACTIONS_AUR_ENABLE_PKGBUILD_EDITION = [ CustomSoftwareAction( i18n_label_key='arch.action.enable_pkgbuild_edition', i18n_status_key='arch.action.enable_pkgbuild_edition.status', i18n_confirm_key='arch.action.enable_pkgbuild_edition.confirm', requires_root=False, manager_method='enable_pkgbuild_edition', icon_path=resource.get_path('img/mark_pkgbuild.svg', ROOT_DIR)) ] ACTIONS_AUR_DISABLE_PKGBUILD_EDITION = [ CustomSoftwareAction( i18n_label_key='arch.action.disable_pkgbuild_edition', i18n_status_key='arch.action.disable_pkgbuild_edition', i18n_confirm_key='arch.action.disable_pkgbuild_edition.confirm', requires_root=False, manager_method='disable_pkgbuild_edition', icon_path=resource.get_path('img/unmark_pkgbuild.svg', ROOT_DIR)) ]