GUI development

This commit is contained in:
BarsTiger
2022-01-27 21:24:54 +02:00
parent a2f6a34506
commit ff3be0916a
3 changed files with 37 additions and 8 deletions

View File

@@ -140,7 +140,7 @@ def install(package):
pass
def uninstall(package, is_gui=False):
def uninstall(package, login_ui=None, Ui_LoginWindow=None):
if os.path.exists('{1}apps/{0}'.format(package, horsy_vars.horsypath)):
os.system('rmdir /s /q "{1}apps/{0}"'.format(package, horsy_vars.horsypath))
print(f"[green][OK] Files deleted[/]")

View File

@@ -25,20 +25,20 @@ def search(query, is_gui=False):
return ret_res
def info(package):
def info(package, download_ui=None, UiDownloadWindow=None):
r = requests.get(f"{horsy_vars.protocol}{horsy_vars.server_url}/packages/json/{package}").text
if r == "":
print(f"[red]Package {package} not found[/]")
return
return f"Package {package} not found"
try:
r = json.loads(r)
except:
print("[red]Error with unsupported message[/]")
return
return "Error with unsupported message"
try:
if r["message"] == "Internal server error":
print("[red]Internal server error[/]")
return
return "Internal server error"
except:
pass
@@ -54,3 +54,20 @@ def info(package):
"Keep in mind, developers can change the code after verification \n"
"We [red]don't call you to trust this app[/], use it at your own risk \n"
"but we recommend you more to install verified packages")
if download_ui is not None:
download_ui.logs_box.clear()
UiDownloadWindow.show()
download_ui.logs_box.append(f"{r['name']}{'' if r['verified'] else ''} by {r['authorName']}")
download_ui.logs_box.append(f"{r['description']}")
download_ui.logs_box.append(f"👍{r['likes']} | 👎{r['dislikes']}")
if not r['verified']:
download_ui.logs_box.append("This package is not verified by the horsy team. This means that it \n"
"can be unstable or it can be malware. Most packages have unverified\n"
"state, but use it at your own risk.")
else:
download_ui.logs_box.append("This package is verified by the horsy team! \n"
"Keep in mind, developers can change the code after verification \n"
"We don't call you to trust this app, use it at your own risk \n"
"but we recommend you more to install verified packages")
return None