mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[view] fix: displaying initial warnings related to supported technologies even when they are not enabled or have the required dependencies
This commit is contained in:
@@ -318,7 +318,7 @@ class SoftwareManager(ABC):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def list_warnings(self, internet_available: bool) -> List[str]:
|
||||
def list_warnings(self, internet_available: bool) -> Optional[List[str]]:
|
||||
"""
|
||||
:param internet_available
|
||||
:return: a list of warnings to be shown to the user
|
||||
|
||||
@@ -2733,20 +2733,9 @@ class ArchManager(SoftwareManager):
|
||||
|
||||
return [PackageUpdate(p.name, p.latest_version, aur_type if p.repository == 'aur' else repo_type, p.name) for p in installed if p.update and not p.is_update_ignored()]
|
||||
|
||||
def list_warnings(self, internet_available: bool) -> List[str]:
|
||||
warnings = []
|
||||
|
||||
if self.arch_distro:
|
||||
if not pacman.is_available():
|
||||
warnings.append(self.i18n['arch.warning.disabled'].format(bold('pacman')))
|
||||
|
||||
if not self._is_wget_available():
|
||||
warnings.append(self.i18n['arch.warning.disabled'].format(bold('wget')))
|
||||
|
||||
if not git.is_installed():
|
||||
warnings.append(self.i18n['arch.warning.git'].format(bold('git')))
|
||||
|
||||
return warnings
|
||||
def list_warnings(self, internet_available: bool) -> Optional[List[str]]:
|
||||
if not git.is_installed():
|
||||
return [self.i18n['arch.warning.git'].format(bold('git'))]
|
||||
|
||||
def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
|
||||
self.logger.info("Downloading suggestions file {}".format(SUGGESTIONS_FILE))
|
||||
|
||||
@@ -517,8 +517,8 @@ class FlatpakManager(SoftwareManager):
|
||||
|
||||
return updates
|
||||
|
||||
def list_warnings(self, internet_available: bool) -> List[str]:
|
||||
return []
|
||||
def list_warnings(self, internet_available: bool) -> Optional[List[str]]:
|
||||
pass
|
||||
|
||||
def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
|
||||
cli_version = flatpak.get_version()
|
||||
|
||||
@@ -317,20 +317,19 @@ class SnapManager(SoftwareManager):
|
||||
def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
|
||||
pass
|
||||
|
||||
def list_warnings(self, internet_available: bool) -> List[str]:
|
||||
if snap.is_installed():
|
||||
if not snapd.is_running():
|
||||
snap_bold = bold('Snap')
|
||||
return [self.i18n['snap.notification.snapd_unavailable'].format(bold('snapd'), snap_bold),
|
||||
self.i18n['snap.notification.snap.disable'].format(snap_bold, bold('{} > {}'.format(self.i18n['settings'].capitalize(),
|
||||
self.i18n['core.config.tab.types'])))]
|
||||
def list_warnings(self, internet_available: bool) -> Optional[List[str]]:
|
||||
if not snapd.is_running():
|
||||
snap_bold = bold('Snap')
|
||||
return [self.i18n['snap.notification.snapd_unavailable'].format(bold('snapd'), snap_bold),
|
||||
self.i18n['snap.notification.snap.disable'].format(snap_bold, bold(
|
||||
'{} > {}'.format(self.i18n['settings'].capitalize(),
|
||||
self.i18n['core.config.tab.types'])))]
|
||||
elif internet_available:
|
||||
available, output = snap.is_api_available()
|
||||
|
||||
elif internet_available:
|
||||
available, output = snap.is_api_available()
|
||||
|
||||
if not available:
|
||||
self.logger.warning('It seems Snap API is not available. Search output: {}'.format(output))
|
||||
return [self.i18n['snap.notifications.api.unavailable'].format(bold('Snaps'), bold('Snap'))]
|
||||
if not available:
|
||||
self.logger.warning('It seems Snap API is not available. Search output: {}'.format(output))
|
||||
return [self.i18n['snap.notifications.api.unavailable'].format(bold('Snaps'), bold('Snap'))]
|
||||
|
||||
def _fill_suggestion(self, name: str, priority: SuggestionPriority, snapd_client: SnapdClient, out: List[PackageSuggestion]):
|
||||
res = snapd_client.find_by_name(name)
|
||||
|
||||
@@ -848,7 +848,7 @@ class WebApplicationManager(SoftwareManager):
|
||||
def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
|
||||
pass
|
||||
|
||||
def list_warnings(self, internet_available: bool) -> List[str]:
|
||||
def list_warnings(self, internet_available: bool) -> Optional[List[str]]:
|
||||
pass
|
||||
|
||||
def _fill_suggestion(self, app: WebApplication):
|
||||
|
||||
@@ -461,7 +461,7 @@ class GenericSoftwareManager(SoftwareManager):
|
||||
|
||||
if self.managers:
|
||||
for man in self.managers:
|
||||
if man.is_enabled():
|
||||
if self._can_work(man):
|
||||
man_warnings = man.list_warnings(internet_available=int_available)
|
||||
|
||||
if man_warnings:
|
||||
|
||||
Reference in New Issue
Block a user