From 2f631ca903914c050d98e318463b8a321dabedeb Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 30 Jul 2019 17:35:46 -0300 Subject: [PATCH] not adding flathub remote when it is not set --- CHANGELOG.md | 4 ++++ fpakman/app.py | 4 ++-- fpakman/core/controller.py | 1 - fpakman/core/flatpak/controller.py | 5 +++-- fpakman/core/flatpak/flatpak.py | 6 +++++- fpakman/resources/locale/en | 3 ++- fpakman/resources/locale/es | 3 ++- fpakman/resources/locale/pt | 3 ++- 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36b6c8ee..e2ee7fc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Improvements - new environment variable / argument to enable / disable the tray icon and update-check daemon: FPAKMAN_TRAY (--tray) - search results sorting takes an average of 35% less time, reaching 60% in some scenarios +- app boot takes an average of 80% less time +- showing a warning popup when no Flatpak remotes are set after initialization. ### Fixes: - apps table not showing empty descriptions - replacing default app icons by null icons - i18n fixes +### Comments: +- not adding Flatpak default remote (flathub) when initializing. It requires root actions, and will be addressed in a different way in future releases. ## [0.4.2] - 2019-07-28 ### Improvements diff --git a/fpakman/app.py b/fpakman/app.py index c48a8f8b..25a8265e 100755 --- a/fpakman/app.py +++ b/fpakman/app.py @@ -108,6 +108,7 @@ caches.append(icon_cache) disk_loader_factory = DiskCacheLoaderFactory(disk_cache=args.disk_cache, cache_map=cache_map) manager = GenericApplicationManager(managers, disk_loader_factory=disk_loader_factory, app_args=args) +manager.prepare() app = QApplication(sys.argv) app.setApplicationName(__app_name__) @@ -136,12 +137,11 @@ else: manage_window.refresh_apps() manage_window.show() -CacheCleaner(caches).start() - warnings = manager.list_warnings() if warnings: for warning in warnings: dialog.show_warning(title=locale_keys['warning'].capitalize(), body=warning) +CacheCleaner(caches).start() sys.exit(app.exec_()) diff --git a/fpakman/core/controller.py b/fpakman/core/controller.py index 2d312634..99161e8e 100755 --- a/fpakman/core/controller.py +++ b/fpakman/core/controller.py @@ -99,7 +99,6 @@ class GenericApplicationManager(ApplicationManager): self.map = {m.get_app_type(): m for m in self.managers} self.disk_loader_factory = disk_loader_factory self._enabled_map = {} if app_args.check_packaging_once else None - self.prepare() def _sort(self, apps: List[Application], word: str) -> List[Application]: exact_name_matches, contains_name_matches, others = [], [], [] diff --git a/fpakman/core/flatpak/controller.py b/fpakman/core/flatpak/controller.py index 72f04040..83292e4e 100644 --- a/fpakman/core/flatpak/controller.py +++ b/fpakman/core/flatpak/controller.py @@ -147,7 +147,7 @@ class FlatpakManager(ApplicationManager): raise Exception("'refresh' is not supported for {}".format(app.__class__.__name__)) def prepare(self): - flatpak.set_default_remotes() + pass def list_updates(self) -> List[ApplicationUpdate]: updates = [] @@ -179,4 +179,5 @@ class FlatpakManager(ApplicationManager): return updates def list_warnings(self) -> List[str]: - return None + if not flatpak.has_remotes_set(): + return [self.locale_keys['flatpak.notification.no_remotes']] diff --git a/fpakman/core/flatpak/flatpak.py b/fpakman/core/flatpak/flatpak.py index f22cd646..7b6a0646 100755 --- a/fpakman/core/flatpak/flatpak.py +++ b/fpakman/core/flatpak/flatpak.py @@ -1,6 +1,6 @@ import re import subprocess -from typing import List, Set +from typing import List from fpakman.core import system from fpakman.core.exception import NoInternetException @@ -219,3 +219,7 @@ def install_and_stream(app_id: str, origin: str): def set_default_remotes(): system.run_cmd('flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo') + + +def has_remotes_set() -> bool: + return bool(system.run_cmd('{} remotes'.format(BASE_CMD)).strip()) diff --git a/fpakman/resources/locale/en b/fpakman/resources/locale/en index d1295dfe..ef4f5544 100644 --- a/fpakman/resources/locale/en +++ b/fpakman/resources/locale/en @@ -102,4 +102,5 @@ version.installed_outdated=the installed version is outdated version.unknown=not informed app.name=application name warning=warning -snap.notification.snapd_unavailable=snapd seems not to be enabled. snap packages will not be available. \ No newline at end of file +snap.notification.snapd_unavailable=snapd seems not to be enabled. snap packages will not be available. +flatpak.notification.no_remotes=No Flatpak remotes set. It will not be possible to search for Flatpak apps. \ No newline at end of file diff --git a/fpakman/resources/locale/es b/fpakman/resources/locale/es index 887c8456..9b56fb71 100644 --- a/fpakman/resources/locale/es +++ b/fpakman/resources/locale/es @@ -103,4 +103,5 @@ version.installed_outdated=la versión instalada está desactualizada version.unknown=versión no informada app.name=nombre del aplicativo warning=aviso -snap.notification.snapd_unavailable=snapd no parece estar habilitado. los paquetes snap estarán indisponibles. \ No newline at end of file +snap.notification.snapd_unavailable=snapd no parece estar habilitado. los paquetes snap estarán indisponibles. +flatpak.notification.no_remotes=No hay repositorios (remotes) Flatpak configurados. No será posible buscar aplicativos Flatpak. \ No newline at end of file diff --git a/fpakman/resources/locale/pt b/fpakman/resources/locale/pt index 75ac7880..4be66ea8 100644 --- a/fpakman/resources/locale/pt +++ b/fpakman/resources/locale/pt @@ -103,4 +103,5 @@ version.installed_outdated=a versão instalada está desatualizada version.unknown=versão não informada app.name=nome do aplicativo warning=aviso -snap.notification.snapd_unavailable=snapd não parece estar habilitado. os pacotes snap estarão indisponíveis. \ No newline at end of file +snap.notification.snapd_unavailable=snapd não parece estar habilitado. os pacotes snap estarão indisponíveis. +flatpak.notification.no_remotes=Não há repositórios (remotes) Flatpak configurados. Não será possível buscar aplicativos Flatpak. \ No newline at end of file