add addon de/install errorhandling

This commit is contained in:
Semjon Kerner 2021-03-26 10:35:00 +01:00
parent a5bcbaf28c
commit 439a3d707a
2 changed files with 12 additions and 5 deletions

View File

@ -61,12 +61,13 @@ def _create(gui: 'GUI'):
def installer():
if filemenu.entrycget(4, 'label') == "Remove Chalutier":
helper.remove_addon(chalutier[0])
filemenu.entryconfigure(4, label="Install Chalutier")
if helper.remove_addon(chalutier[0]) == 0:
filemenu.entryconfigure(4, label="Install Chalutier")
else:
helper.install_addon(*chalutier)
helper.install_addon(*lam2)
filemenu.entryconfigure(4, label="Remove Chalutier")
r = helper.install_addon(*chalutier)
r += helper.install_addon(*lam2)
if r == 0:
filemenu.entryconfigure(4, label="Remove Chalutier")
chaEntry = "Remove Chalutier" if helper.addon_exists(chalutier[0]) else "Install Chalutier"
filemenu.add_command(label=chaEntry, command=installer)
menubar.add_cascade(label="Options", menu=filemenu)

View File

@ -176,8 +176,10 @@ def install_addon(name, url, v=None):
z = ZipFile(BytesIO(r.content))
z.extractall(path=get_addondir())
logging.info("Add-On "+name+" installed successfully!\nPlease make sure to enable \"Allow outdated addons\" in ESO")
return 0
except Exception as ex:
logging.error("Could not install Add-On "+name+", try doing it manually")
return 1
def remove_addon(name, url=None, v=None):
@ -186,6 +188,10 @@ def remove_addon(name, url=None, v=None):
logging.info("Add-On "+name+" removed!")
except FileNotFoundError:
pass
except PermissionError as ex:
logging.error("Fishy has no permission to remove "+name+" Add-On")
return 1
return 0
def get_documents():