[web] displaying the config dir on the info window | removing the config dir during uninstallation

This commit is contained in:
Vinícius Moreira
2019-12-18 19:41:22 -03:00
parent ce1f30365d
commit 14008e4ad5
5 changed files with 66 additions and 34 deletions

View File

@@ -308,7 +308,18 @@ class WebApplicationManager(SoftwareManager):
except:
watcher.show_message(title=self.i18n['error'],
body=self.i18n['web.uninstall.error.remove'].format(bold(autostart_path)),
type_=MessageType.ERROR)
type_=MessageType.WARNING)
traceback.print_exc()
config_path = pkg.get_config_dir()
if os.path.exists(config_path):
try:
shutil.rmtree(config_path)
except:
watcher.show_message(title=self.i18n['error'],
body=self.i18n['web.uninstall.error.remove'].format(bold(config_path)),
type_=MessageType.WARNING)
traceback.print_exc()
return True
@@ -318,15 +329,20 @@ class WebApplicationManager(SoftwareManager):
def get_info(self, pkg: WebApplication) -> dict:
if pkg.installed:
info = {'{}_{}'.format(idx + 1, att): getattr(pkg, att) for idx, att in enumerate(('url', 'description', 'version', 'categories', 'installation_dir', 'desktop_entry'))}
info['7_exec_file'] = pkg.get_exec_path()
info['8_icon_path'] = pkg.get_disk_icon_path()
info = {'0{}_{}'.format(idx + 1, att): getattr(pkg, att) for idx, att in enumerate(('url', 'description', 'version', 'categories', 'installation_dir', 'desktop_entry'))}
info['07_exec_file'] = pkg.get_exec_path()
info['08_icon_path'] = pkg.get_disk_icon_path()
if os.path.exists(pkg.installation_dir):
info['9_size'] = get_human_size_str(get_dir_size(pkg.installation_dir))
info['09_size'] = get_human_size_str(get_dir_size(pkg.installation_dir))
if info.get('4_categories'):
info['4_categories'] = [self.i18n[c.lower()].capitalize() for c in info['4_categories']]
config_dir = pkg.get_config_dir()
if config_dir:
info['10_config_dir'] = config_dir
if info.get('04_categories'):
info['04_categories'] = [self.i18n[c.lower()].capitalize() for c in info['04_categories']]
return info

View File

@@ -1,3 +1,5 @@
import glob
import os
from pathlib import Path
from typing import List
@@ -113,3 +115,14 @@ class WebApplication(SoftwarePackage):
if custom_icon:
self.icon_url = custom_icon
def get_config_dir(self) -> str:
if self.installation_dir:
config_path = '{}/.config'.format(Path.home())
if os.path.exists(config_path):
config_dirs = glob.glob('{}/{}-nativefier-*'.format(config_path, self.installation_dir.split('/')[-1]))
if config_dirs:
return config_dirs[0]

View File

@@ -44,12 +44,13 @@ web.install.option.icon.label=Custom icon
web.install.global_nativefier.unavailable={n} seems not to be installed on your system. It will not be possible to install {app}
web.uninstall.error.install_dir.not_found=The installation directory {} was not found
web.uninstall.error.remove_dir=It was not possible to remove {}
web.info.1_url=URL
web.info.2_description=description
web.info.3_version=version
web.info.4_categories=categories
web.info.5_installation_dir=installation dir
web.info.6_desktop_entry=shortcut
web.info.7_exec_file=executable
web.info.8_icon_path=icon
web.info.9_size=size
web.info.01_url=URL
web.info.02_description=description
web.info.03_version=version
web.info.04_categories=categories
web.info.05_installation_dir=installation dir
web.info.06_desktop_entry=shortcut
web.info.07_exec_file=executable
web.info.08_icon_path=icon
web.info.09_size=size
web.info.10_config_dir=configuration dir

View File

@@ -44,12 +44,13 @@ web.install.option.icon.label=Icono personalizado
web.install.global_nativefier.unavailable={n} parece no estar instalado en su sistema. No será posible instalar {app}
web.uninstall.error.install_dir.not_found=No se encontró el directorio de instalación {}
web.uninstall.error.remove_dir=No fue posible eliminar {}
web.info.1_url=URL
web.info.2_description=descripción
web.info.3_version=versión
web.info.4_categories=categorías
web.info.5_installation_dir=directorio de instalación
web.info.6_desktop_entry=atajo
web.info.7_exec_file=ejecutable
web.info.8_icon_path=icono
web.info.9_size=tamaño
web.info.01_url=URL
web.info.02_description=descripción
web.info.03_version=versión
web.info.04_categories=categorías
web.info.05_installation_dir=directorio de instalación
web.info.06_desktop_entry=atajo
web.info.07_exec_file=ejecutable
web.info.08_icon_path=icono
web.info.09_size=tamaño
web.info.10_config_dir=directorio de configuración

View File

@@ -44,12 +44,13 @@ web.install.option.icon.label=Ícone alternativo
web.install.global_nativefier.unavailable={n} não parece estar instalado no seu sistema. Não será possível instalar {app}
web.uninstall.error.install_dir.not_found=O diretório de instalação {} não foi encontrado
web.uninstall.error.remove=Não foi possível remover {}
web.info.1_url=URL
web.info.2_description=descrição
web.info.3_version=versão
web.info.4_categories=categorias
web.info.5_installation_dir=diretório de instalação
web.info.6_desktop_entry=atalho
web.info.7_exec_file=executável
web.info.8_icon_path=ícone
web.info.9_size=tamanho
web.info.01_url=URL
web.info.02_description=descrição
web.info.03_version=versão
web.info.04_categories=categorias
web.info.05_installation_dir=diretório de instalação
web.info.06_desktop_entry=atalho
web.info.07_exec_file=executável
web.info.08_icon_path=ícone
web.info.09_size=tamanho
web.info.10_config_dir=diretório de configuração