From 4696fc34d41a4c8199ed7852f1f48669fec58e4c Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Sun, 22 Dec 2019 22:33:13 -0300 Subject: [PATCH] suggestions button sketch --- bauh/api/abstract/controller.py | 3 ++- bauh/gems/appimage/controller.py | 2 +- bauh/gems/arch/controller.py | 2 +- bauh/gems/flatpak/controller.py | 2 +- bauh/gems/snap/controller.py | 2 +- bauh/gems/web/controller.py | 2 +- bauh/view/core/controller.py | 2 +- bauh/view/qt/window.py | 4 ++++ 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bauh/api/abstract/controller.py b/bauh/api/abstract/controller.py index 67d995c7..3876d0a9 100644 --- a/bauh/api/abstract/controller.py +++ b/bauh/api/abstract/controller.py @@ -231,9 +231,10 @@ class SoftwareManager(ABC): pass @abstractmethod - def list_suggestions(self, limit: int) -> List[PackageSuggestion]: + def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]: """ :param limit: max suggestions to be returned. If limit < 0, it should not be considered + :param filter_installed: if the installed suggestions should not be retrieved :return: a list of package suggestions """ pass diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index f5ee83c1..4250a800 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -416,7 +416,7 @@ class AppImageManager(SoftwareManager): def list_warnings(self, internet_available: bool) -> List[str]: pass - def list_suggestions(self, limit: int) -> List[PackageSuggestion]: + def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]: res = [] connection = self._get_db_connection(DB_APPS_PATH) diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index af93e3c1..05857d71 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -834,7 +834,7 @@ class ArchManager(SoftwareManager): return warnings - def list_suggestions(self, limit: int) -> List[PackageSuggestion]: + def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]: self.logger.info("Downloading suggestions file {}".format(SUGGESTIONS_FILE)) file = self.http_client.get(SUGGESTIONS_FILE) diff --git a/bauh/gems/flatpak/controller.py b/bauh/gems/flatpak/controller.py index 9b753cec..35980742 100644 --- a/bauh/gems/flatpak/controller.py +++ b/bauh/gems/flatpak/controller.py @@ -260,7 +260,7 @@ class FlatpakManager(SoftwareManager): return [self.i18n['flatpak.notification.no_remotes'], self.i18n['flatpak.notification.disable'].format(bold('Flatpak'), bold(self.i18n['manage_window.settings.gems']))] - def list_suggestions(self, limit: int) -> List[PackageSuggestion]: + def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]: cli_version = flatpak.get_version() res = [] diff --git a/bauh/gems/snap/controller.py b/bauh/gems/snap/controller.py index 4b2f3be8..47608311 100644 --- a/bauh/gems/snap/controller.py +++ b/bauh/gems/snap/controller.py @@ -235,7 +235,7 @@ class SnapManager(SoftwareManager): else: self.logger.warning("Could not retrieve suggestion '{}'".format(pkg_name)) - def list_suggestions(self, limit: int) -> List[PackageSuggestion]: + def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]: res = [] if snap.is_snapd_running(): diff --git a/bauh/gems/web/controller.py b/bauh/gems/web/controller.py index 74c48ddc..d54c01e8 100644 --- a/bauh/gems/web/controller.py +++ b/bauh/gems/web/controller.py @@ -765,7 +765,7 @@ class WebApplicationManager(SoftwareManager): return PackageSuggestion(priority=SuggestionPriority(suggestion['priority']), package=app) - def list_suggestions(self, limit: int) -> List[PackageSuggestion]: + def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]: if self.suggestions: suggestions = self.suggestions diff --git a/bauh/view/core/controller.py b/bauh/view/core/controller.py index e6dff286..92011cd0 100755 --- a/bauh/view/core/controller.py +++ b/bauh/view/core/controller.py @@ -341,7 +341,7 @@ class GenericSoftwareManager(SoftwareManager): suggestions.extend(man_sugs) - def list_suggestions(self, limit: int) -> List[PackageSuggestion]: + def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]: if bool(self.config['suggestions']['enabled']): if self.managers and internet.is_available(self.context.http_client, self.context.logger): suggestions, threads = [], [] diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 3fcf0af8..442470c3 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -1113,6 +1113,10 @@ class ManageWindow(QWidget): def _show_settings_menu(self): menu_row = QMenu() + # TODO + # action_suggestions = QAction(self.i18n['manage_window.settings.suggestions']) + # action_suggestions.setIcon(QIcon()) + if isinstance(self.manager, GenericSoftwareManager): action_gems = QAction(self.i18n['manage_window.settings.gems']) action_gems.setIcon(self.icon_app)