diff --git a/bauh/gems/appimage/__init__.py b/bauh/gems/appimage/__init__.py index d086f49b..570f72ad 100644 --- a/bauh/gems/appimage/__init__.py +++ b/bauh/gems/appimage/__init__.py @@ -3,5 +3,5 @@ import os from bauh.api.constants import HOME_PATH ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) -BASE_PATH = '{}/.local/share/bauh/appimage'.format(HOME_PATH) -INSTALLATION_PATH = BASE_PATH + '/installed/' +LOCAL_PATH = '{}/.local/share/bauh/appimage'.format(HOME_PATH) +INSTALLATION_PATH = LOCAL_PATH + '/installed/' diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index 12ead4d9..92b96651 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -329,9 +329,22 @@ class AppImageManager(SoftwareManager): def set_enabled(self, enabled: bool): self.enabled = enabled + def _is_sqlite3_available(self): + try: + new_subprocess(['sqlite3', '--version']) + return True + except FileNotFoundError: + return False + + def _is_wget_available(self): + try: + new_subprocess(['wget', '--version']) + return True + except FileNotFoundError: + return False + def can_work(self) -> bool: - # TODO check wget and sqlite - return True + return self._is_sqlite3_available() and self._is_wget_available() def requires_root(self, action: str, pkg: AppImage): return False @@ -347,7 +360,6 @@ class AppImageManager(SoftwareManager): pass def list_suggestions(self, limit: int) -> List[PackageSuggestion]: - # TODO pass def is_default_enabled(self) -> bool: diff --git a/bauh/gems/appimage/resources/locale/en b/bauh/gems/appimage/resources/locale/en index 437b32e9..4dbcfc2d 100644 --- a/bauh/gems/appimage/resources/locale/en +++ b/bauh/gems/appimage/resources/locale/en @@ -1,4 +1,5 @@ gem.appimage.label=AppImage +gem.appimage.info=Applications published at https://appimage.github.io/ appimage.install.permission=Giving execution permission to {} appimage.install.extract=Extracting the content from {} appimage.install.desktop_entry=Generating a menu shortcut diff --git a/bauh/gems/appimage/resources/locale/es b/bauh/gems/appimage/resources/locale/es index 0c3ccff7..09ee2995 100644 --- a/bauh/gems/appimage/resources/locale/es +++ b/bauh/gems/appimage/resources/locale/es @@ -1,4 +1,5 @@ gem.appimage.label=AppImage +gem.appimage.info=Aplicativos publicados en https://appimage.github.io/ appimage.install.permission=Concediendo permiso de ejecución a {} appimage.install.extract=Extrayendo el contenido de {} appimage.install.desktop_entry=Creando un atajo en el menú diff --git a/bauh/gems/appimage/resources/locale/pt b/bauh/gems/appimage/resources/locale/pt index 4f5a4c5d..e7e43932 100644 --- a/bauh/gems/appimage/resources/locale/pt +++ b/bauh/gems/appimage/resources/locale/pt @@ -1,4 +1,5 @@ gem.appimage.label=AppImage +gem.appimage.info=Aplicativos publicados em https://appimage.github.io/ appimage.install.permission=Concedendo permissão de execução para {} appimage.install.extract=Extraindo o conteúdo de {} appimage.install.desktop_entry=Criando um atalho no menu diff --git a/bauh/gems/appimage/worker.py b/bauh/gems/appimage/worker.py index f613550c..2f3c130e 100644 --- a/bauh/gems/appimage/worker.py +++ b/bauh/gems/appimage/worker.py @@ -1,3 +1,4 @@ +import glob import logging import os import tarfile @@ -8,13 +9,13 @@ from pathlib import Path from threading import Thread from bauh.api.http import HttpClient -from bauh.gems.appimage import BASE_PATH +from bauh.gems.appimage import LOCAL_PATH class DatabaseUpdater(Thread if bool(int(os.getenv('BAUH_DEBUG', 0))) else Process): URL_DB = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/dbs.tar.gz' - COMPRESS_FILE_PATH = BASE_PATH + '/db.tar.gz' + COMPRESS_FILE_PATH = LOCAL_PATH + '/db.tar.gz' def __init__(self, http_client: HttpClient, logger: logging.Logger): super(DatabaseUpdater, self).__init__(daemon=True) @@ -29,26 +30,26 @@ class DatabaseUpdater(Thread if bool(int(os.getenv('BAUH_DEBUG', 0))) else Proce res = self.http_client.get(self.URL_DB, headers={'Authorization': 'token {}'.format(os.getenv('GITHUB_TOKEN'))}) if res: - Path(BASE_PATH).mkdir(parents=True, exist_ok=True) + Path(LOCAL_PATH).mkdir(parents=True, exist_ok=True) with open(self.COMPRESS_FILE_PATH, 'wb+') as f: f.write(res.content) self.logger.info("Database file saved at {}".format(self.COMPRESS_FILE_PATH)) - old_db_files = {file for r, d, f in os.walk(BASE_PATH) for file in f if file.endswith('.db')} + old_db_files = glob.glob(LOCAL_PATH + '/*.db') if old_db_files: self.logger.info('Deleting old database files') for f in old_db_files: - os.remove('{}/{}'.format(BASE_PATH, f)) + os.remove(f) self.logger.info('Old database files deleted') self.logger.info('Uncompressing {}'.format(self.COMPRESS_FILE_PATH)) try: tf = tarfile.open(self.COMPRESS_FILE_PATH) - tf.extractall(BASE_PATH) + tf.extractall(LOCAL_PATH) self.logger.info('Successfully uncompressed file {}'.format(self.COMPRESS_FILE_PATH)) except: self.logger.error('Could not extract file {}'.format(self.COMPRESS_FILE_PATH)) diff --git a/bauh/gems/flatpak/resources/locale/en b/bauh/gems/flatpak/resources/locale/en index b66d4834..b538dd9d 100644 --- a/bauh/gems/flatpak/resources/locale/en +++ b/bauh/gems/flatpak/resources/locale/en @@ -1,3 +1,4 @@ +gem.flatpak.info=Applications available in the repositories configured on your system flatpak.notification.no_remotes=No Flatpak remotes set. It will not be possible to search for Flatpak apps. flatpak.downgrade.impossible.title=Error flatpak.downgrade.impossible.body=Impossible to downgrade: the app is in its first version diff --git a/bauh/gems/flatpak/resources/locale/es b/bauh/gems/flatpak/resources/locale/es index 6cfc3e7a..9840c5a1 100644 --- a/bauh/gems/flatpak/resources/locale/es +++ b/bauh/gems/flatpak/resources/locale/es @@ -1,3 +1,4 @@ +gem.flatpak.info=Aplicativos disponibles en los repositorios configurados en su sistema flatpak.info.arch=arquitectura flatpak.info.branch=rama flatpak.info.collection=colección diff --git a/bauh/gems/flatpak/resources/locale/pt b/bauh/gems/flatpak/resources/locale/pt index 89840c66..c811fe16 100644 --- a/bauh/gems/flatpak/resources/locale/pt +++ b/bauh/gems/flatpak/resources/locale/pt @@ -1,3 +1,4 @@ +gem.flatpak.info=Aplicativos disponíveis nos repositórios configurados do seu sistema flatpak.info.arch=arquitetura flatpak.info.branch=ramo flatpak.info.collection=coleção diff --git a/bauh/gems/snap/resources/locale/en b/bauh/gems/snap/resources/locale/en index 8d514136..3426cdc3 100644 --- a/bauh/gems/snap/resources/locale/en +++ b/bauh/gems/snap/resources/locale/en @@ -1,3 +1,4 @@ +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.snap.disable=If you do not want to use Snap applications, uncheck {} in {} snap.action.refresh.status=Refreshing diff --git a/bauh/gems/snap/resources/locale/es b/bauh/gems/snap/resources/locale/es index 0c7c5f7a..0d2f1a11 100644 --- a/bauh/gems/snap/resources/locale/es +++ b/bauh/gems/snap/resources/locale/es @@ -1,3 +1,4 @@ +gem.snap.info=Aplicativos publicados en https://snapcraft.io/store snap.info.commands=comandos snap.info.contact=contacto snap.info.description=descripción diff --git a/bauh/gems/snap/resources/locale/pt b/bauh/gems/snap/resources/locale/pt index 8d0c9d16..0828ae2d 100644 --- a/bauh/gems/snap/resources/locale/pt +++ b/bauh/gems/snap/resources/locale/pt @@ -1,3 +1,4 @@ +gem.snap.info=Aplicativos publicados em https://snapcraft.io/store snap.info.commands=comandos snap.info.contact=contato snap.info.description=descrição diff --git a/bauh/view/qt/gem_selector.py b/bauh/view/qt/gem_selector.py index 35359c74..54cced57 100644 --- a/bauh/view/qt/gem_selector.py +++ b/bauh/view/qt/gem_selector.py @@ -60,7 +60,7 @@ class GemSelectorPanel(QWidget): self.bt_proceed.setEnabled(bool(default_ops)) - self.gem_select_model = MultipleSelectComponent(label='', options=gem_options, default_options=default_ops, max_per_line=3) + self.gem_select_model = MultipleSelectComponent(label='', options=gem_options, default_options=default_ops, max_per_line=1) self.gem_select = MultipleSelectQt(self.gem_select_model, self.check_state) self.layout().addWidget(self.gem_select, 1, 1)