[snap] The application crashes due to Snap API checking when snap is not installed | improved snapd not enabled warning

This commit is contained in:
Vinicius Moreira
2019-10-29 11:19:25 -03:00
parent dda3082a03
commit 1a8d37dfe6
5 changed files with 17 additions and 12 deletions

View File

@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [0.7.2]
### Fixes:
- The application crashes due to Snap API checking when snap is not installed
## [0.7.1] 2019-10-25
### Features
- Snap:

View File

@@ -197,17 +197,18 @@ class SnapManager(SoftwareManager):
pass
def list_warnings(self, internet_available: bool) -> List[str]:
if snap.is_installed() and not snap.is_snapd_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(self.i18n['manage_window.settings.gems']))]
if snap.is_installed():
if not snap.is_snapd_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(self.i18n['manage_window.settings.gems']))]
if 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, pkg_name: str, priority: SuggestionPriority, out: List[PackageSuggestion]):
res = self.http_client.get_json(SNAP_API_URL + '/search?q=package_name:{}'.format(pkg_name))

View File

@@ -1,5 +1,5 @@
gem.snap.info=Applications published at https://snapcraft.io/store
snap.notification.snapd_unavailable={} seems not to be installed or enabled. {} packages will not be available.
snap.notification.snapd_unavailable={} seems not to be started or enabled. {} packages will not be available.
snap.notification.snap.disable=If you do not want to use Snap applications, uncheck {} in {}
snap.notifications.api.unavailable=It seems the {} API is unavailable at the moment. It will not be possible to search for new {} applications.
snap.action.refresh.status=Refreshing

View File

@@ -10,7 +10,7 @@ snap.info.installed=instalado
snap.info.publisher=publicador
snap.info.version=versión
snap.info.size=tamaño
snap.notification.snapd_unavailable={} no parece estar instalado o habilitado. Los paquetes {} estarán indisponibles.
snap.notification.snapd_unavailable={} parece no estar inicializado o habilitado. Los paquetes {} estarán indisponibles.
snap.notification.snap.disable=Si no desea usar aplicativos Snap, desmarque {} en {}
snap.notifications.api.unavailable=Parece que la API de {} no está disponible en este momento. No será posible buscar nuevos aplicativos {}.
snap.action.refresh.status=Actualizando

View File

@@ -10,7 +10,7 @@ snap.info.installed=instalado
snap.info.publisher=publicador
snap.info.version=versão
snap.info.size=tamanho
snap.notification.snapd_unavailable={} não parece estar instalado ou habilitado. Os pacotes {} estarão indisponíveis.
snap.notification.snapd_unavailable={} parece não estar inicializado ou habilitado. Os pacotes {} estarão indisponíveis.
snap.notification.snap.disable=Se não deseja usar aplicativos Snap, desmarque {} em {}
snap.notifications.api.unavailable=Parece que a API de {} está indisponível no momento. Não será possível buscar novos aplicativos {}.
snap.action.refresh.status=Atualizando