From 83cd0f843a51240cb5f09ff12c35fa0e915f0898 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 11 Mar 2022 09:58:57 -0300 Subject: [PATCH] [appimage] improvement: always setting attributes not available for database installed applications (search) --- bauh/gems/appimage/controller.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index 9b13c8a4..9cdd16fc 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -79,6 +79,7 @@ class AppImageManager(SoftwareManager): self.file_downloader = context.file_downloader self.configman = AppImageConfigManager() self._custom_actions: Optional[Iterable[CustomSoftwareAction]] = None + self._search_unfilled_attrs: Optional[Tuple[str, ...]] = None def install_file(self, root_password: Optional[str], watcher: ProcessWatcher) -> bool: file_chooser = FileChooserComponent(label=self.i18n['file'].capitalize(), @@ -217,6 +218,11 @@ class AppImageManager(SoftwareManager): new_found = found_map.get(key) if new_found: + if not appim.imported: + for attr in self.search_unfilled_attrs: + if getattr(appim, attr) is None: + setattr(appim, attr, getattr(new_found['app'], attr)) + del not_installed[new_found['idx']] installed_found.append(appim) found = True @@ -936,3 +942,12 @@ class AppImageManager(SoftwareManager): res = db_updater.download_databases() return res + + @property + def search_unfilled_attrs(self) -> Tuple[str, ...]: + if self._search_unfilled_attrs is None: + self._search_unfilled_attrs = ('icon_url', 'url_download_latest_version', 'author', 'license', 'github', + 'source', 'url_screenshot') + + return self._search_unfilled_attrs +