mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[web] new save_icon attr for WebApplication | fix removing non existing config dir
This commit is contained in:
@@ -312,7 +312,7 @@ class WebApplicationManager(SoftwareManager):
|
||||
|
||||
config_path = pkg.get_config_dir()
|
||||
|
||||
if os.path.exists(config_path):
|
||||
if config_path and os.path.exists(config_path):
|
||||
try:
|
||||
shutil.rmtree(config_path)
|
||||
except:
|
||||
@@ -344,6 +344,8 @@ class WebApplicationManager(SoftwareManager):
|
||||
info['04_categories'] = [self.i18n[c.lower()].capitalize() for c in info['04_categories']]
|
||||
|
||||
return info
|
||||
else:
|
||||
return {'0{}_{}'.format(idx + 1, att): getattr(pkg, att) for idx, att in enumerate(('url', 'description', 'version', 'categories'))}
|
||||
|
||||
def get_history(self, pkg: SoftwarePackage) -> PackageHistory:
|
||||
pass
|
||||
@@ -561,7 +563,7 @@ class WebApplicationManager(SoftwareManager):
|
||||
|
||||
# if a custom icon is defined for an app suggestion:
|
||||
icon_path, icon_bytes = None, None
|
||||
if pkg.is_suggestion and pkg.icon_url and not {o for o in install_options if o.startswith('--icon')}:
|
||||
if pkg.icon_url and pkg.save_icon and not {o for o in install_options if o.startswith('--icon')}:
|
||||
download = self._download_suggestion_icon(pkg, app_dir)
|
||||
|
||||
if download and download[1]:
|
||||
@@ -683,15 +685,6 @@ class WebApplicationManager(SoftwareManager):
|
||||
def requires_root(self, action: str, pkg: SoftwarePackage):
|
||||
return False
|
||||
|
||||
# def _update_environment(self, handler: ProcessHandler = None) -> bool:
|
||||
# updated_settings = self.env_updater.update_environment(self.context.is_system_x86_64(), handler=handler)
|
||||
#
|
||||
# if updated_settings is not None:
|
||||
# self.env_settings = updated_settings
|
||||
# return True
|
||||
#
|
||||
# return False
|
||||
|
||||
def _update_env_settings(self):
|
||||
self.env_settings = self.env_updater.read_settings()
|
||||
|
||||
@@ -739,7 +732,7 @@ class WebApplicationManager(SoftwareManager):
|
||||
icon_url=suggestion.get('icon_url'),
|
||||
categories=[suggestion['category']] if suggestion.get('category') else None,
|
||||
preset_options=suggestion.get('options'),
|
||||
is_suggestion=True)
|
||||
save_icon=suggestion.get('save_icon', False))
|
||||
|
||||
app.set_version(suggestion.get('version'))
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class WebApplication(SoftwarePackage):
|
||||
|
||||
def __init__(self, id: str = None, url: str = None, name: str = None, description: str = None, icon_url: str = None,
|
||||
installation_dir: str = None, desktop_entry: str = None, installed: bool = False, version: str = None,
|
||||
categories: List[str] = None, custom_icon: str = None, preset_options: List[str] = None, is_suggestion: bool = False):
|
||||
categories: List[str] = None, custom_icon: str = None, preset_options: List[str] = None, save_icon: bool = False):
|
||||
super(WebApplication, self).__init__(id=id if id else url, name=name, description=description,
|
||||
icon_url=icon_url, installed=installed, version=version,
|
||||
categories=categories)
|
||||
@@ -21,7 +21,7 @@ class WebApplication(SoftwarePackage):
|
||||
self.desktop_entry = desktop_entry
|
||||
self.set_custom_icon(custom_icon)
|
||||
self.preset_options = preset_options
|
||||
self.is_suggestion = is_suggestion
|
||||
self.save_icon = save_icon # if the icon_url should be used instead of the one retrieved by nativefier
|
||||
|
||||
def set_version(self, version: str):
|
||||
self.version = str(version) if version else None
|
||||
@@ -31,7 +31,7 @@ class WebApplication(SoftwarePackage):
|
||||
return False
|
||||
|
||||
def has_info(self):
|
||||
return self.installed
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def _get_cached_attrs() -> tuple:
|
||||
|
||||
Reference in New Issue
Block a user