suggestions button sketch

This commit is contained in:
Vinicius Moreira
2019-12-22 22:33:13 -03:00
parent 44da79c03c
commit 4696fc34d4
8 changed files with 12 additions and 7 deletions

View File

@@ -231,9 +231,10 @@ class SoftwareManager(ABC):
pass pass
@abstractmethod @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 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 :return: a list of package suggestions
""" """
pass pass

View File

@@ -416,7 +416,7 @@ class AppImageManager(SoftwareManager):
def list_warnings(self, internet_available: bool) -> List[str]: def list_warnings(self, internet_available: bool) -> List[str]:
pass pass
def list_suggestions(self, limit: int) -> List[PackageSuggestion]: def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
res = [] res = []
connection = self._get_db_connection(DB_APPS_PATH) connection = self._get_db_connection(DB_APPS_PATH)

View File

@@ -834,7 +834,7 @@ class ArchManager(SoftwareManager):
return warnings 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)) self.logger.info("Downloading suggestions file {}".format(SUGGESTIONS_FILE))
file = self.http_client.get(SUGGESTIONS_FILE) file = self.http_client.get(SUGGESTIONS_FILE)

View File

@@ -260,7 +260,7 @@ class FlatpakManager(SoftwareManager):
return [self.i18n['flatpak.notification.no_remotes'], return [self.i18n['flatpak.notification.no_remotes'],
self.i18n['flatpak.notification.disable'].format(bold('Flatpak'), bold(self.i18n['manage_window.settings.gems']))] 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() cli_version = flatpak.get_version()
res = [] res = []

View File

@@ -235,7 +235,7 @@ class SnapManager(SoftwareManager):
else: else:
self.logger.warning("Could not retrieve suggestion '{}'".format(pkg_name)) 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 = [] res = []
if snap.is_snapd_running(): if snap.is_snapd_running():

View File

@@ -765,7 +765,7 @@ class WebApplicationManager(SoftwareManager):
return PackageSuggestion(priority=SuggestionPriority(suggestion['priority']), package=app) 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: if self.suggestions:
suggestions = self.suggestions suggestions = self.suggestions

View File

@@ -341,7 +341,7 @@ class GenericSoftwareManager(SoftwareManager):
suggestions.extend(man_sugs) 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 bool(self.config['suggestions']['enabled']):
if self.managers and internet.is_available(self.context.http_client, self.context.logger): if self.managers and internet.is_available(self.context.http_client, self.context.logger):
suggestions, threads = [], [] suggestions, threads = [], []

View File

@@ -1113,6 +1113,10 @@ class ManageWindow(QWidget):
def _show_settings_menu(self): def _show_settings_menu(self):
menu_row = QMenu() menu_row = QMenu()
# TODO
# action_suggestions = QAction(self.i18n['manage_window.settings.suggestions'])
# action_suggestions.setIcon(QIcon())
if isinstance(self.manager, GenericSoftwareManager): if isinstance(self.manager, GenericSoftwareManager):
action_gems = QAction(self.i18n['manage_window.settings.gems']) action_gems = QAction(self.i18n['manage_window.settings.gems'])
action_gems.setIcon(self.icon_app) action_gems.setIcon(self.icon_app)